Class: OGR::Envelope
- Inherits:
-
Object
- Object
- OGR::Envelope
- Defined in:
- lib/ffi-ogr/envelope.rb
Instance Attribute Summary collapse
-
#max_x ⇒ Object
Returns the value of attribute max_x.
-
#max_y ⇒ Object
Returns the value of attribute max_y.
-
#min_x ⇒ Object
Returns the value of attribute min_x.
-
#min_y ⇒ Object
Returns the value of attribute min_y.
Instance Method Summary collapse
-
#initialize(env) ⇒ Envelope
constructor
A new instance of Envelope.
- #to_a(se_nw = false) ⇒ Object
- #to_hash ⇒ Object
- #to_json ⇒ Object
- #to_polygon ⇒ Object
Constructor Details
#initialize(env) ⇒ Envelope
Returns a new instance of Envelope.
5 6 7 8 9 10 |
# File 'lib/ffi-ogr/envelope.rb', line 5 def initialize(env) raise RuntimeError.new("Invalid envelope specified") unless env.size == 4 @min_x, @max_x = env[0], env[1] @min_y, @max_y = env[2], env[3] end |
Instance Attribute Details
#max_x ⇒ Object
Returns the value of attribute max_x.
3 4 5 |
# File 'lib/ffi-ogr/envelope.rb', line 3 def max_x @max_x end |
#max_y ⇒ Object
Returns the value of attribute max_y.
3 4 5 |
# File 'lib/ffi-ogr/envelope.rb', line 3 def max_y @max_y end |
#min_x ⇒ Object
Returns the value of attribute min_x.
3 4 5 |
# File 'lib/ffi-ogr/envelope.rb', line 3 def min_x @min_x end |
#min_y ⇒ Object
Returns the value of attribute min_y.
3 4 5 |
# File 'lib/ffi-ogr/envelope.rb', line 3 def min_y @min_y end |
Instance Method Details
#to_a(se_nw = false) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/ffi-ogr/envelope.rb', line 12 def to_a(se_nw=false) unless se_nw [@min_x, @max_x, @min_y, @max_y] else [@min_x, @min_y, @max_x, @max_y] end end |
#to_hash ⇒ Object
20 21 22 |
# File 'lib/ffi-ogr/envelope.rb', line 20 def to_hash {min_x: @min_x, max_x: @max_x, min_y: @min_y, max_y: @max_y} end |
#to_json ⇒ Object
24 25 26 |
# File 'lib/ffi-ogr/envelope.rb', line 24 def to_json MultiJson.dump(to_hash) end |