File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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' ) )
23
34if defined? ( JRUBY_VERSION )
45 require 'java'
1314 require 'geoscript/util'
1415 require 'geoscript/projection'
1516 require 'geoscript/geom'
17+ require 'geoscript/feature'
1618else
1719 warn "GeoScript requires JRuby (http://jruby.org)"
1820end
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 33module GeoScript
44 module Util
55 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 )
137 str . to_java_bytes
148 end
159
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 )
2411 bytes . from_java_bytes
2512 end
2613
2714 def self . byte_to_string ( byte , base )
2815 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 )
3017 "%0#{ n } d" % s
3118 end
3219
You can’t perform that action at this time.
0 commit comments