Sha256: 6bb7e255da19ec7096d0899399f73ae3a8e75f032ee09ecc0f5c3648da4142cc

Contents?: true

Size: 752 Bytes

Versions: 9

Compression:

Stored size: 752 Bytes

Contents

# frozen_string_literal: true

module OGR
  module GeometryMixins
    module ContainerMixins
      include Enumerable

      # 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 {{#clone}} it. Additionally, the yielded
      # geometry is only valid until the containing changes.
      #
      # @yieldparam [OGR::Geometry]
      # @return [Enumerator]
      # @see http://gdal.org/1.11/ogr/ogr__api_8h.html#a6bac93150529a5c98811db29e289dd66
      def each
        return enum_for(:each) unless block_given?

        geometry_count.times do |i|
          yield geometry_at(i)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta16 lib/ogr/geometry_mixins/container_mixins.rb
ffi-gdal-1.0.0.beta15 lib/ogr/geometry_mixins/container_mixins.rb
ffi-gdal-1.0.0.beta14 lib/ogr/geometry_mixins/container_mixins.rb
ffi-gdal-1.0.0.beta13 lib/ogr/geometry_mixins/container_mixins.rb
ffi-gdal-1.0.0.beta12 lib/ogr/geometry_mixins/container_mixins.rb
ffi-gdal-1.0.0.beta11 lib/ogr/geometry_mixins/container_mixins.rb
ffi-gdal-1.0.0.beta10 lib/ogr/geometry_mixins/container_mixins.rb
ffi-gdal-1.0.0.beta9 lib/ogr/geometry_mixins/container_mixins.rb
ffi-gdal-1.0.0.beta8 lib/ogr/geometry_mixins/container_mixins.rb