Class: GeoScript::Geom::MultiPolygon
- Inherits:
-
JTSMultiPolygon
- Object
- GeoScript::Geom::MultiPolygon
- Includes:
- GeoScript::Geom
- Defined in:
- lib/geoscript/geom/multipolygon.rb
Constant Summary
Constants included from GeoScript::Geom
Instance Attribute Summary collapse
-
#bounds ⇒ Object
Returns the value of attribute bounds.
Instance Method Summary collapse
- #buffer(dist) ⇒ Object
-
#initialize(*polygons) ⇒ MultiPolygon
constructor
A new instance of MultiPolygon.
- #to_json ⇒ Object
- #to_wkb ⇒ Object
- #to_wkt ⇒ Object
Methods included from GeoScript::Geom
buffer, enhance, from_wkt, get_bounds, prepare, simplify, to_wkt
Constructor Details
#initialize(*polygons) ⇒ MultiPolygon
Returns a new instance of MultiPolygon.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/geoscript/geom/multipolygon.rb', line 10 def initialize(*polygons) polys = [] if polygons.first.kind_of? JTSMultiPolygon multi_polygon = polygons.first for i in range(0...multi_polygon.num_geometries) polys << multi_polygon.get_geometry_n(i) end else polygons.each do |polygon| if polygon.kind_of? Java::ComVividsolutionsJtsGeom::Polygon polys << polygon else polys << Polygon.new(*polygon) end end end super(polys.to_java(com.vividsolutions.jts.geom.Polygon), GEOM_FACTORY) end |
Instance Attribute Details
#bounds ⇒ Object
Returns the value of attribute bounds.
8 9 10 |
# File 'lib/geoscript/geom/multipolygon.rb', line 8 def bounds @bounds end |
Instance Method Details
#buffer(dist) ⇒ Object
30 31 32 |
# File 'lib/geoscript/geom/multipolygon.rb', line 30 def buffer(dist) Polygon.new super end |
#to_json ⇒ Object
42 43 44 |
# File 'lib/geoscript/geom/multipolygon.rb', line 42 def to_json IO.write_json self end |