Module: RGeo::ImplHelper::BasicMultiPolygonMethods
- Included in:
- Cartesian::MultiPolygonImpl, Geographic::ProjectedMultiPolygonImpl, Geographic::SphericalMultiPolygonImpl
- Defined in:
- lib/rgeo/impl_helper/basic_geometry_collection_methods.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#area ⇒ Object
213 214 215 |
# File 'lib/rgeo/impl_helper/basic_geometry_collection_methods.rb', line 213 def area @elements.inject(0.0){ |sum_, obj_| sum_ + obj_.area } end |
#boundary ⇒ Object
218 219 220 221 222 223 224 225 226 227 |
# File 'lib/rgeo/impl_helper/basic_geometry_collection_methods.rb', line 218 def boundary array_ = [] @elements.each do |poly_| unless poly_.is_empty? array_ << poly_.exterior_ring end array_.concat(poly_.interior_rings) end factory.multi_line_string(array_) end |
#geometry_type ⇒ Object
208 209 210 |
# File 'lib/rgeo/impl_helper/basic_geometry_collection_methods.rb', line 208 def geometry_type Feature::MultiPolygon end |
#initialize(factory_, elements_) ⇒ Object
195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/rgeo/impl_helper/basic_geometry_collection_methods.rb', line 195 def initialize(factory_, elements_) _set_factory(factory_) @elements = elements_.map do |elem_| elem_ = Feature.cast(elem_, factory_, Feature::Polygon, :keep_subtype) unless elem_ raise Error::InvalidGeometry, "Could not cast #{elem_}" end elem_ end _validate_geometry end |