Class: GeoScript::Geom::Bounds

Inherits:
ReferencedEnvelope
  • Object
show all
Includes:
GeoScript::Geom
Defined in:
lib/geoscript/geom/bounds.rb

Constant Summary

Constants included from GeoScript::Geom

GEOM_FACTORY, PREP_FACTORY

Class Method Summary collapse

Instance Method Summary collapse

Methods included from GeoScript::Geom

buffer, enhance, from_wkt, get_bounds, prepare, simplify, to_wkt

Constructor Details

#initialize(env, proj = nil) ⇒ Bounds

Returns a new instance of Bounds.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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

Class Method Details

.scale(bounds, factor) ⇒ Object



64
65
66
67
68
69
# 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

Instance Method Details

#expand(other_bounds) ⇒ Object



71
# File 'lib/geoscript/geom/bounds.rb', line 71

def expand(other_bounds);end

#get_eastObject



51
52
53
# File 'lib/geoscript/geom/bounds.rb', line 51

def get_east
  self.max_x
end

#get_northObject



55
56
57
# File 'lib/geoscript/geom/bounds.rb', line 55

def get_north
  self.max_y
end

#get_projectionObject



59
60
61
62
# File 'lib/geoscript/geom/bounds.rb', line 59

def get_projection
  crs = self.coordinate_reference_system
  GeoScript::Projection.new crs if crs
end

#get_southObject



47
48
49
# File 'lib/geoscript/geom/bounds.rb', line 47

def get_south
  self.min_y
end

#get_westObject



43
44
45
# File 'lib/geoscript/geom/bounds.rb', line 43

def get_west
  self.min_x
end

#tile(resolution) ⇒ Object



75
# File 'lib/geoscript/geom/bounds.rb', line 75

def tile(resolution);end

#to_polygonObject



73
# File 'lib/geoscript/geom/bounds.rb', line 73

def to_polygon;end