Class: CloudMade::Polygon
- Defined in:
- lib/cloudmade/geometry.rb
Instance Attribute Summary collapse
-
#border_line ⇒ Object
Returns the value of attribute border_line.
-
#holes ⇒ Object
Returns the value of attribute holes.
Instance Method Summary collapse
-
#initialize(coords) ⇒ Polygon
constructor
A new instance of Polygon.
- #to_s ⇒ Object
- #to_wkt ⇒ Object
- #wkt_helper ⇒ Object
Methods inherited from Geometry
Constructor Details
Instance Attribute Details
#border_line ⇒ Object
Returns the value of attribute border_line.
119 120 121 |
# File 'lib/cloudmade/geometry.rb', line 119 def border_line @border_line end |
#holes ⇒ Object
Returns the value of attribute holes.
120 121 122 |
# File 'lib/cloudmade/geometry.rb', line 120 def holes @holes end |
Instance Method Details
#to_s ⇒ Object
127 128 129 |
# File 'lib/cloudmade/geometry.rb', line 127 def to_s "Polygon(#{@border_line} - (#{@holes.join(',')}))" end |
#to_wkt ⇒ Object
131 132 133 |
# File 'lib/cloudmade/geometry.rb', line 131 def to_wkt "POLYGON (#{wkt_helper})" end |
#wkt_helper ⇒ Object
135 136 137 138 |
# File 'lib/cloudmade/geometry.rb', line 135 def wkt_helper holes = @holes.map(&:wkt_helper).join(', ') if @holes.any? [@border_line.wkt_helper, holes].compact.join(', ') end |