class JpmGeo::Bounds

Bounds is a bounding box defined by two Points. If the bounding box crosses the 180th meridian, there will be two sets of bounding boxes defined by four Points.

Attributes

points[R]
radians[R]

Public Class Methods

from_points(*points) click to toggle source
# File lib/jpm_geo/bounds.rb, line 39
def from_points(*points)
  new(*points)
end
new(*points) click to toggle source
# File lib/jpm_geo/bounds.rb, line 46
def initialize(*points)
  @points = points
  @radians = points[0].radians
end

Public Instance Methods

[](index) click to toggle source
# File lib/jpm_geo/bounds.rb, line 10
def [](index)
  to_a[index]
end
size() click to toggle source
# File lib/jpm_geo/bounds.rb, line 18
def size
  points.size
end
to_a() click to toggle source
# File lib/jpm_geo/bounds.rb, line 14
def to_a
  points
end
to_degrees() click to toggle source
# File lib/jpm_geo/bounds.rb, line 28
def to_degrees
  return self unless radians

  Bounds.from_points(*points.collect(&:to_degrees))
end
to_radians() click to toggle source
# File lib/jpm_geo/bounds.rb, line 22
def to_radians
  return self if radians

  Bounds.from_points(*points.collect(&:to_radians))
end
to_s() click to toggle source
# File lib/jpm_geo/bounds.rb, line 34
def to_s
  "JpmGeo::Bounds[#{points}]"
end