Module: RGeo::ImplHelper::BasicGeometryCollectionMethods
- Included in:
- Cartesian::GeometryCollectionImpl, Cartesian::MultiLineStringImpl, Cartesian::MultiPointImpl, Cartesian::MultiPolygonImpl, Geographic::ProjectedGeometryCollectionImpl, Geographic::ProjectedMultiLineStringImpl, Geographic::ProjectedMultiPointImpl, Geographic::ProjectedMultiPolygonImpl, Geographic::SphericalGeometryCollectionImpl, Geographic::SphericalMultiLineStringImpl, Geographic::SphericalMultiPointImpl, Geographic::SphericalMultiPolygonImpl
- Defined in:
- lib/rgeo/impl_helper/basic_geometry_collection_methods.rb
Overview
:nodoc:
Instance Method Summary collapse
- #dimension ⇒ Object
- #each(&block_) ⇒ Object
- #eql?(rhs_) ⇒ Boolean
- #geometry_n(n_) ⇒ Object
- #geometry_type ⇒ Object
- #initialize(factory_, elements_) ⇒ Object
- #is_empty? ⇒ Boolean
- #num_geometries ⇒ Object
Instance Method Details
#dimension ⇒ Object
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/rgeo/impl_helper/basic_geometry_collection_methods.rb', line 82 def dimension unless @dimension @dimension = -1 @elements.each do |elem_| dim_ = elem_.dimension @dimension = dim_ if @dimension < dim_ end end @dimension end |
#each(&block_) ⇒ Object
77 78 79 |
# File 'lib/rgeo/impl_helper/basic_geometry_collection_methods.rb', line 77 def each(&block_) @elements.each(&block_) end |
#eql?(rhs_) ⇒ Boolean
58 59 60 61 62 63 64 |
# File 'lib/rgeo/impl_helper/basic_geometry_collection_methods.rb', line 58 def eql?(rhs_) if rhs_.is_a?(self.class) && rhs_.factory.eql?(@factory) && @elements.size == rhs_.num_geometries rhs_.each_with_index{ |p_, i_| return false unless @elements[i_].eql?(p_) } else false end end |
#geometry_n(n_) ⇒ Object
72 73 74 |
# File 'lib/rgeo/impl_helper/basic_geometry_collection_methods.rb', line 72 def geometry_n(n_) @elements[n_] end |
#geometry_type ⇒ Object
94 95 96 |
# File 'lib/rgeo/impl_helper/basic_geometry_collection_methods.rb', line 94 def geometry_type Feature::GeometryCollection end |
#initialize(factory_, elements_) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rgeo/impl_helper/basic_geometry_collection_methods.rb', line 45 def initialize(factory_, elements_) _set_factory(factory_) @elements = elements_.map do |elem_| elem_ = Feature.cast(elem_, factory_) unless elem_ raise Error::InvalidGeometry, "Could not cast #{elem_}" end elem_ end _validate_geometry end |
#is_empty? ⇒ Boolean
99 100 101 |
# File 'lib/rgeo/impl_helper/basic_geometry_collection_methods.rb', line 99 def is_empty? @elements.size == 0 end |
#num_geometries ⇒ Object
67 68 69 |
# File 'lib/rgeo/impl_helper/basic_geometry_collection_methods.rb', line 67 def num_geometries @elements.size end |