Class: CloudMade::BBox

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Geometry

parse, #wkt_helper

Constructor Details

#initialize(points) ⇒ BBox

Returns a new instance of BBox.



164
165
166
# File 'lib/cloudmade/geometry.rb', line 164

def initialize(points)
  self.points = points
end

Instance Attribute Details

#pointsObject

Returns the value of attribute points.



162
163
164
# File 'lib/cloudmade/geometry.rb', line 162

def points
  @points
end

Class Method Details

.from_coordinates(coords) ⇒ Object



173
174
175
176
177
# File 'lib/cloudmade/geometry.rb', line 173

def from_coordinates(coords)
  point1 = Point.new(coords[0][0], coords[0][1])
  point2 = Point.new(coords[1][0], coords[1][1])
  return BBox.new([point1, point2])
end

.from_points(points) ⇒ Object



169
170
171
# File 'lib/cloudmade/geometry.rb', line 169

def from_points(points)
  return BBox.new(points)
end

Instance Method Details

#==(bbox) ⇒ Object



180
181
182
183
# File 'lib/cloudmade/geometry.rb', line 180

def ==(bbox)
  return (bbox.points[0] == self.points[0] and bbox.points[1] = self.points[1] or
      bbox.points[0] == self.points[1] and bbox.points[1] = self.points[0])
end