Module: RGeo::Geos::FFIPolygonMethods
- Included in:
- FFIPolygonImpl
- Defined in:
- lib/rgeo/geos/ffi_feature_methods.rb
Overview
:nodoc:
Instance Method Summary collapse
- #area ⇒ Object
- #centroid ⇒ Object
- #coordinates ⇒ Object
- #exterior_ring ⇒ Object
- #geometry_type ⇒ Object
- #hash ⇒ Object
- #interior_ring_n(n_) ⇒ Object
- #interior_rings ⇒ Object
- #num_interior_rings ⇒ Object
- #point_on_surface ⇒ Object
- #rep_equals?(rhs_) ⇒ Boolean
Instance Method Details
#area ⇒ Object
396 397 398 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 396 def area @fg_geom.area end |
#centroid ⇒ Object
400 401 402 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 400 def centroid @factory._wrap_fg_geom(@fg_geom.centroid, FFIPointImpl) end |
#coordinates ⇒ Object
453 454 455 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 453 def coordinates ([exterior_ring] + interior_rings).map(&:coordinates) end |
#exterior_ring ⇒ Object
408 409 410 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 408 def exterior_ring @factory._wrap_fg_geom(@fg_geom.exterior_ring, FFILinearRingImpl) end |
#geometry_type ⇒ Object
392 393 394 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 392 def geometry_type Feature::Polygon end |
#hash ⇒ Object
443 444 445 446 447 448 449 450 451 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 443 def hash @hash ||= begin hash_ = Utils.ffi_coord_seq_hash(@fg_geom.exterior_ring.coord_seq, [@factory, geometry_type].hash) @fg_geom.interior_rings.inject(hash_) do |h_, r_| Utils.ffi_coord_seq_hash(r_.coord_seq, h_) end end end |
#interior_ring_n(n_) ⇒ Object
416 417 418 419 420 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 416 def interior_ring_n(n_) if n_ >= 0 && n_ < @fg_geom.num_interior_rings @factory._wrap_fg_geom(@fg_geom.interior_ring_n(n_), FFILinearRingImpl) end end |
#interior_rings ⇒ Object
422 423 424 425 426 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 422 def interior_rings ::Array.new(@fg_geom.num_interior_rings) do |n_| @factory._wrap_fg_geom(@fg_geom.interior_ring_n(n_), FFILinearRingImpl) end end |
#num_interior_rings ⇒ Object
412 413 414 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 412 def num_interior_rings @fg_geom.num_interior_rings end |
#point_on_surface ⇒ Object
404 405 406 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 404 def point_on_surface @factory._wrap_fg_geom(@fg_geom.point_on_surface, FFIPointImpl) end |
#rep_equals?(rhs_) ⇒ Boolean
428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
# File 'lib/rgeo/geos/ffi_feature_methods.rb', line 428 def rep_equals?(rhs_) if rhs_.class == self.class && rhs_.factory.eql?(@factory) && rhs_.exterior_ring.rep_equals?(exterior_ring) sn_ = @fg_geom.num_interior_rings rn_ = rhs_.num_interior_rings if sn_ == rn_ sn_.times do |i_| return false unless interior_ring_n(i_).rep_equals?(rhs_.interior_ring_n(i_)) end return true end end false end |