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

Constructor Details

#initialize(points) ⇒ BBox

Returns a new instance of BBox.



118
119
120
# File 'lib/cloudmade/geometry.rb', line 118

def initialize(points)
  self.points = points
end

Instance Attribute Details

#pointsObject

Returns the value of attribute points.



116
117
118
# File 'lib/cloudmade/geometry.rb', line 116

def points
  @points
end

Class Method Details

.from_coordinates(coords) ⇒ Object



127
128
129
130
131
# File 'lib/cloudmade/geometry.rb', line 127

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



123
124
125
# File 'lib/cloudmade/geometry.rb', line 123

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

Instance Method Details

#==(bbox) ⇒ Object



134
135
136
137
# File 'lib/cloudmade/geometry.rb', line 134

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