Class: CloudMade::MultiPolygon
- Defined in:
- lib/cloudmade/geometry.rb
Instance Attribute Summary collapse
-
#polygons ⇒ Object
Returns the value of attribute polygons.
Instance Method Summary collapse
-
#initialize(coords) ⇒ MultiPolygon
constructor
A new instance of MultiPolygon.
- #to_s ⇒ Object
- #to_wkt ⇒ Object
- #wkt_helper ⇒ Object
Methods inherited from Geometry
Constructor Details
#initialize(coords) ⇒ MultiPolygon
Returns a new instance of MultiPolygon.
144 145 146 |
# File 'lib/cloudmade/geometry.rb', line 144 def initialize(coords) @polygons = coords.map { |poly_coords| Polygon.new(poly_coords) } end |
Instance Attribute Details
#polygons ⇒ Object
Returns the value of attribute polygons.
142 143 144 |
# File 'lib/cloudmade/geometry.rb', line 142 def polygons @polygons end |
Instance Method Details
#to_s ⇒ Object
148 149 150 |
# File 'lib/cloudmade/geometry.rb', line 148 def to_s "MultiPolygon(#{@polygons.join(',')})" end |
#to_wkt ⇒ Object
152 153 154 |
# File 'lib/cloudmade/geometry.rb', line 152 def to_wkt "MULTIPOLYGON (#{wkt_helper})" end |
#wkt_helper ⇒ Object
156 157 158 |
# File 'lib/cloudmade/geometry.rb', line 156 def wkt_helper @polygons.map { |polygon| "(#{polygon.wkt_helper})"}.join(', ') end |