Module: OGR::GeometryMixins::ContainerMixins
- Includes:
- Enumerable
- Included in:
- OGR::GeometryCollection, OGR::GeometryCollection25D, MultiLineString, MultiLineString25D, MultiPoint, MultiPoint25D, MultiPolygon, MultiPolygon25D, Polygon, Polygon25D
- Defined in:
- lib/ogr/extensions/geometry/container_mixins.rb
Instance Method Summary collapse
- #collection? ⇒ Boolean
-
#each {|| ... } ⇒ Enumerator
Iterates over each geometry in the container geometry.
Instance Method Details
#collection? ⇒ Boolean
19 20 21 |
# File 'lib/ogr/extensions/geometry/container_mixins.rb', line 19 def collection? true end |
#each {|| ... } ⇒ Enumerator
Iterates over each geometry in the container geometry. Per ‘OGR` docs, the yielded geometry should not be modified; if you need to do something to that geometry, you should OGR::GeometryMixins::ContainerMixins.{{#clone} it. Additionally, the yielded geometry is only valid until the container changes.
31 32 33 34 35 36 37 |
# File 'lib/ogr/extensions/geometry/container_mixins.rb', line 31 def each return enum_for(:each) unless block_given? geometry_count.times do |i| yield geometry_at(i) end end |