File tree 4 files changed +12
-17
lines changed
4 files changed +12
-17
lines changed Original file line number Diff line number Diff line change 1
- $:. push File . expand_path ( File . join ( File . dirname ( __FILE__ ) , 'geoscript' ) )
1
+ $: << File . expand_path ( File . dirname ( __FILE__ ) )
2
+ $: << File . expand_path ( File . join ( File . dirname ( __FILE__ ) , 'geoscript' ) )
2
3
3
4
if defined? ( JRUBY_VERSION )
4
5
require 'java'
13
14
require 'geoscript/util'
14
15
require 'geoscript/projection'
15
16
require 'geoscript/geom'
17
+ require 'geoscript/feature'
16
18
else
17
19
warn "GeoScript requires JRuby (http://jruby.org)"
18
20
end
Original file line number Diff line number Diff line change
1
+ require 'feature/field'
Original file line number Diff line number Diff line change
1
+ module GeoScript
2
+ module Feature
3
+ class Field < Struct . new ( :name , :type , :proj ) ; end
4
+ end
5
+ end
Original file line number Diff line number Diff line change 3
3
module GeoScript
4
4
module Util
5
5
class Bytes
6
- def self . decode ( str , base ) # str.to_java_bytes
7
- #n = Math.log(256, base).ceil
8
- #bytes = []
9
- #(0...str.size).step(n) do |i|
10
- # bytes << string_to_byte(str[i...(i + n)].join(''), base)
11
- #end
12
- #bytes.to_java java.lang.Byte
6
+ def self . decode ( str , base )
13
7
str . to_java_bytes
14
8
end
15
9
16
- def self . encode ( bytes , base ) # bytes.from_java_bytes
17
- #bytes_array = []
18
- #
19
- #bytes.each do |byte|
20
- # bytes_array << byte_to_string(byte, base)
21
- #end
22
- #
23
- #bytes_array.join ''
10
+ def self . encode ( bytes , base )
24
11
bytes . from_java_bytes
25
12
end
26
13
27
14
def self . byte_to_string ( byte , base )
28
15
n = Math . log ( 256 , base ) . ceil
29
- s = byte < 0 ? JInt . to_string ( ( ( b . abs ^ 0xff ) + 0x01 ) , base ) : JInt . to_string ( b , base )
16
+ s = byte < 0 ? java . lang . Integer . to_string ( ( ( b . abs ^ 0xff ) + 0x01 ) , base ) : java . lang . Integer . to_string ( b , base )
30
17
"%0#{ n } d" % s
31
18
end
32
19
You can’t perform that action at this time.
0 commit comments