Class: GeoRuby::SimpleFeatures::HexEWKBParser
- Inherits:
-
EWKBParser
- Object
- EWKBParser
- GeoRuby::SimpleFeatures::HexEWKBParser
- Defined in:
- lib/geo_ruby/simple_features/ewkb_parser.rb,
lib/geo_ruby/simple_features/ewkb_parser.rb
Overview
Parses HexEWKB strings. In reality, it just transforms the HexEWKB string into the equivalent EWKB string and lets the EWKBParser do the actual parsing.
Instance Method Summary collapse
-
#decode_hex(hexewkb) ⇒ Object
transforms a HexEWKB string into an EWKB string.
-
#initialize(factory) ⇒ HexEWKBParser
constructor
A new instance of HexEWKBParser.
-
#parse(hexewkb) ⇒ Object
parses an HexEWKB string.
Constructor Details
#initialize(factory) ⇒ HexEWKBParser
Returns a new instance of HexEWKBParser.
150 151 152 |
# File 'lib/geo_ruby/simple_features/ewkb_parser.rb', line 150 def initialize(factory) super(factory) end |
Instance Method Details
#decode_hex(hexewkb) ⇒ Object
transforms a HexEWKB string into an EWKB string
158 159 160 161 162 163 164 165 |
# File 'lib/geo_ruby/simple_features/ewkb_parser.rb', line 158 def decode_hex(hexewkb) result="" num_bytes = (hexewkb.size + 1) / 2 0.upto(num_bytes-1) do |i| result << hexewkb[i*2,2].hex end result end |
#parse(hexewkb) ⇒ Object
parses an HexEWKB string
154 155 156 |
# File 'lib/geo_ruby/simple_features/ewkb_parser.rb', line 154 def parse(hexewkb) super(decode_hex(hexewkb)) end |