Class: Geos::WktReader
- Inherits:
-
Object
- Object
- Geos::WktReader
- Includes:
- Tools
- Defined in:
- lib/ffi-geos/wkt_reader.rb
Constant Summary
Constants included from GeomTypes
GeomTypes::GEOS_GEOMETRYCOLLECTION, GeomTypes::GEOS_LINEARRING, GeomTypes::GEOS_LINESTRING, GeomTypes::GEOS_MULTILINESTRING, GeomTypes::GEOS_MULTIPOINT, GeomTypes::GEOS_MULTIPOLYGON, GeomTypes::GEOS_POINT, GeomTypes::GEOS_POLYGON
Instance Attribute Summary collapse
-
#ptr ⇒ Object
readonly
Returns the value of attribute ptr.
Class Method Summary collapse
-
.release(ptr) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(*args) ⇒ WktReader
constructor
A new instance of WktReader.
- #read(wkt, options = {}) ⇒ Object
Methods included from Tools
#bool_result, #cast_geometry_ptr, #check_enum_value, #check_geometry, #pick_srid_according_to_policy, #pick_srid_from_geoms, #symbol_for_enum
Constructor Details
#initialize(*args) ⇒ WktReader
Returns a new instance of WktReader.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ffi-geos/wkt_reader.rb', line 9 def initialize(*args) ptr = if args.first.is_a?(FFI::Pointer) args.first else FFIGeos.GEOSWKTReader_create_r(Geos.current_handle, *args) end @ptr = FFI::AutoPointer.new( ptr, self.class.method(:release) ) end |
Instance Attribute Details
#ptr ⇒ Object (readonly)
Returns the value of attribute ptr.
7 8 9 |
# File 'lib/ffi-geos/wkt_reader.rb', line 7 def ptr @ptr end |
Class Method Details
.release(ptr) ⇒ Object
:nodoc:
28 29 30 |
# File 'lib/ffi-geos/wkt_reader.rb', line 28 def self.release(ptr) #:nodoc: FFIGeos.GEOSWKTReader_destroy_r(Geos.current_handle, ptr) end |
Instance Method Details
#read(wkt, options = {}) ⇒ Object
22 23 24 25 26 |
# File 'lib/ffi-geos/wkt_reader.rb', line 22 def read(wkt, = {}) cast_geometry_ptr(FFIGeos.GEOSWKTReader_read_r(Geos.current_handle, self.ptr, wkt), { :srid => [:srid] }) end |