Module: RGeo::Geos::FFILineStringMethods
- Included in:
- FFILineImpl, FFILineStringImpl, FFILinearRingImpl
- Defined in:
- lib/rgeo/geos/ffi_feature_methods.rb
Overview
:nodoc:
Instance Method Summary collapse
- #coordinates ⇒ Object
- #end_point ⇒ Object
- #geometry_type ⇒ Object
- #hash ⇒ Object
- #is_closed? ⇒ Boolean
- #is_ring? ⇒ Boolean
- #length ⇒ Object
- #num_points ⇒ Object
- #point_n(n_) ⇒ Object
- #points ⇒ Object
- #rep_equals?(rhs_) ⇒ Boolean
- #start_point ⇒ Object
Instance Method Details
#coordinates ⇒ Object
374 375 376 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 374 def coordinates points.map(&:coordinates) end |
#end_point ⇒ Object
342 343 344 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 342 def end_point point_n(@fg_geom.num_points - 1) end |
#geometry_type ⇒ Object
316 317 318 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 316 def geometry_type Feature::LineString end |
#hash ⇒ Object
370 371 372 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 370 def hash @hash ||= Utils.ffi_coord_seq_hash(@fg_geom.coord_seq, [@factory, geometry_type].hash) end |
#is_closed? ⇒ Boolean
357 358 359 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 357 def is_closed? @fg_geom.closed? end |
#is_ring? ⇒ Boolean
361 362 363 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 361 def is_ring? @fg_geom.ring? end |
#length ⇒ Object
320 321 322 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 320 def length @fg_geom.length end |
#num_points ⇒ Object
324 325 326 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 324 def num_points @fg_geom.num_points end |
#point_n(n_) ⇒ Object
328 329 330 331 332 333 334 335 336 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 328 def point_n(n_) if n_ >= 0 && n_ < @fg_geom.num_points coord_seq_ = @fg_geom.coord_seq x_ = coord_seq_.get_x(n_) y_ = coord_seq_.get_y(n_) extra_ = @factory._has_3d ? [coord_seq_.get_z(n_)] : [] @factory.point(x_, y_, *extra_) end end |
#points ⇒ Object
346 347 348 349 350 351 352 353 354 355 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 346 def points coord_seq_ = @fg_geom.coord_seq has_3d_ = @factory._has_3d ::Array.new(@fg_geom.num_points) do |n_| x_ = coord_seq_.get_x(n_) y_ = coord_seq_.get_y(n_) extra_ = has_3d_ ? [coord_seq_.get_z(n_)] : [] @factory.point(x_, y_, *extra_) end end |
#rep_equals?(rhs_) ⇒ Boolean
365 366 367 368 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 365 def rep_equals?(rhs_) rhs_.class == self.class && rhs_.factory.eql?(@factory) && Utils.ffi_coord_seqs_equal?(rhs_.fg_geom.coord_seq, @fg_geom.coord_seq, @factory._has_3d) end |
#start_point ⇒ Object
338 339 340 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 338 def start_point point_n(0) end |