Class: GeoRuby::SimpleFeatures::EWKBParser
- Inherits:
-
Object
- Object
- GeoRuby::SimpleFeatures::EWKBParser
- Defined in:
- lib/geo_ruby/simple_features/ewkb_parser.rb
Overview
Parses EWKB strings and notifies of events (such as the beginning of the definition of geometry, the value of the SRID…) the factory passed as argument to the constructor.
Example
factory = GeometryFactory::new ewkb_parser = EWKBParser::new(factory) ewkb_parser.parse(<EWKB String>) geometry = @factory.geometry
You can also use directly the static method Geometry.from_ewkb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(factory) ⇒ EWKBParser
constructor
A new instance of EWKBParser.
-
#parse(ewkb) ⇒ Object
Parses the ewkb string passed as argument and notifies the factory of events.
Constructor Details
#initialize(factory) ⇒ EWKBParser
Returns a new instance of EWKBParser.
28 29 30 |
# File 'lib/geo_ruby/simple_features/ewkb_parser.rb', line 28 def initialize(factory) @factory = factory end |
Instance Method Details
#parse(ewkb) ⇒ Object
Parses the ewkb string passed as argument and notifies the factory of events
33 34 35 36 37 38 39 40 41 |
# File 'lib/geo_ruby/simple_features/ewkb_parser.rb', line 33 def parse(ewkb) @factory.reset @with_z = false @with_m = false @unpack_structure = UnpackStructure::new(ewkb) parse_geometry @unpack_structure.done @srid = nil end |