Class: CloudMade::Polygon

Inherits:
Geometry show all
Defined in:
lib/geometry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Geometry

parse

Constructor Details

#initialize(coords) ⇒ Polygon

Returns a new instance of Polygon.



93
94
95
96
# File 'lib/geometry.rb', line 93

def initialize(coords)
  @border_line = Line.new(coords[0])
  @holes = coords.slice(1, coords.length).map { |line_coords| Line.new(line_coords) }
end

Instance Attribute Details

#border_lineObject

Returns the value of attribute border_line.



90
91
92
# File 'lib/geometry.rb', line 90

def border_line
  @border_line
end

#holesObject

Returns the value of attribute holes.



91
92
93
# File 'lib/geometry.rb', line 91

def holes
  @holes
end

Instance Method Details

#to_sObject



98
99
100
# File 'lib/geometry.rb', line 98

def to_s
  "Polygon(#{@border_line} - (#{@holes.join(',')}))"
end