class GeoScript::Geom::Bounds

Public Class Methods

new(env, proj = nil) click to toggle source
Calls superclass method
# File lib/geoscript/geom/bounds.rb, line 9
def initialize(env, proj = nil)
  projection = GeoScript::Projection.new proj if proj

  if env.kind_of? Envelope
    if projection
      super(env, projection)
    elsif env.respond_to? :crs
      if env.crs
        super(env, env.crs)
      else
        super(env, nil)
      end
    else
      super(env, nil)
    end
  else
    if env.kind_of? Hash
      if projection
        super(env[:x_min], env[:x_max], env[:y_min], env[:y_max], projection)
      else
        super(env[:x_min], env[:x_max], env[:y_min], env[:y_max], nil)
      end
    elsif env.kind_of? Array
      if projection
        super(env[0], env[1], env[2], env[3], projection)
      else
        super(env[0], env[1], env[2], env[3])
      end
    else
      super()
    end
  end
end
scale(bounds, factor) click to toggle source
# File lib/geoscript/geom/bounds.rb, line 64
def self.scale(bounds, factor)
  width = self.width * (factor - 1) / 2
  height = self.height * (factor - 1) / 2

  Bounds.new self.west - width, self.south - height, self.east + width, self.north + height
end

Public Instance Methods

expand(other_bounds) click to toggle source
# File lib/geoscript/geom/bounds.rb, line 71
def expand(other_bounds);end
get_east() click to toggle source
# File lib/geoscript/geom/bounds.rb, line 51
def get_east
  self.max_x
end
get_north() click to toggle source
# File lib/geoscript/geom/bounds.rb, line 55
def get_north
  self.max_y
end
get_projection() click to toggle source
# File lib/geoscript/geom/bounds.rb, line 59
def get_projection
  crs = self.coordinate_reference_system
  GeoScript::Projection.new crs if crs
end
get_south() click to toggle source
# File lib/geoscript/geom/bounds.rb, line 47
def get_south
  self.min_y
end
get_west() click to toggle source
# File lib/geoscript/geom/bounds.rb, line 43
def get_west
  self.min_x
end
tile(resolution) click to toggle source
# File lib/geoscript/geom/bounds.rb, line 75
def tile(resolution);end
to_polygon() click to toggle source
# File lib/geoscript/geom/bounds.rb, line 73
def to_polygon;end