Class: Charta::MultiPolygon
- Inherits:
-
GeometryCollection
- Object
- Geometry
- GeometryCollection
- Charta::MultiPolygon
- Defined in:
- lib/charta/multi_polygon.rb
Overview
Represent a Geometry with contains only polygons
Instance Method Summary collapse
- #each_polygon(&block) ⇒ Object
-
#polygons ⇒ Object
Extract polygons ordered by ‘PointOnSurface’ position.
Methods inherited from GeometryCollection
empty, #to_json_feature_collection
Methods inherited from Geometry
#!=, #==, #area, #bounding_box, #buffer, #centroid, #collection?, #convert_to, #difference, #empty?, #ewkt, factory, feature, #feature, #feature=, #find_srid, #flatten_multi, from_ewkt, from_rgeo, #initialize, #inspect, #intersection, #intersects?, #merge, #method_missing, #point_on_surface, #respond_to_missing?, #srid, srs_database, #surface?, #to_binary, #to_ewkt, #to_geojson, #to_json_feature, #to_json_object, #to_rgeo, #to_svg, #to_svg_path, #to_text, #transform, #type
Constructor Details
This class inherits a constructor from Charta::Geometry
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Charta::Geometry
Instance Method Details
#each_polygon(&block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/charta/multi_polygon.rb', line 4 def each_polygon(&block) if block.arity == 1 polygons.each(&block) elsif block.arity == 2 polygons.each_with_index do |polygon, index| yield polygon, index + 1 end else raise 'Cannot browse each polygon without parameter' end end |