Class: CloudMade::BBox
Instance Attribute Summary collapse
-
#points ⇒ Object
Returns the value of attribute points.
Class Method Summary collapse
Instance Method Summary collapse
- #==(bbox) ⇒ Object
-
#initialize(points) ⇒ BBox
constructor
A new instance of BBox.
Methods inherited from Geometry
Constructor Details
#initialize(points) ⇒ BBox
Returns a new instance of BBox.
118 119 120 |
# File 'lib/geometry.rb', line 118 def initialize(points) self.points = points end |
Instance Attribute Details
#points ⇒ Object
Returns the value of attribute points.
116 117 118 |
# File 'lib/geometry.rb', line 116 def points @points end |
Class Method Details
.from_coordinates(coords) ⇒ Object
127 128 129 130 131 |
# File 'lib/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/geometry.rb', line 123 def from_points(points) return BBox.new(points) end |
Instance Method Details
#==(bbox) ⇒ Object
134 135 136 137 |
# File 'lib/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 |