Class: SimpleMapnik::Bounds

Inherits:
Object
  • Object
show all
Includes:
FFI
Defined in:
lib/simple_mapnik/bounds.rb

Constant Summary

Constants included from FFI

FFI::MAPNIK_FUNCTIONS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from FFI

attach_functions, find_lib, mapnik_c_api_path

Constructor Details

#initialize(x_min, y_min, x_max, y_max) ⇒ Bounds

Returns a new instance of Bounds.



7
8
9
10
11
12
13
14
15
# File 'lib/simple_mapnik/bounds.rb', line 7

def initialize(x_min, y_min, x_max, y_max)
  @x_min = x_min
  @y_min = y_min
  @x_max = x_max
  @y_max = y_max
  ptr = mapnik_bbox x_min, y_min, x_max, y_max
  @ptr = ::FFI::AutoPointer.new ptr, self.class.method(:release)
  @ptr.autorelease = false
end

Instance Attribute Details

#ptrObject

Returns the value of attribute ptr.



5
6
7
# File 'lib/simple_mapnik/bounds.rb', line 5

def ptr
  @ptr
end

#x_maxObject

Returns the value of attribute x_max.



5
6
7
# File 'lib/simple_mapnik/bounds.rb', line 5

def x_max
  @x_max
end

#x_minObject

Returns the value of attribute x_min.



5
6
7
# File 'lib/simple_mapnik/bounds.rb', line 5

def x_min
  @x_min
end

#y_maxObject

Returns the value of attribute y_max.



5
6
7
# File 'lib/simple_mapnik/bounds.rb', line 5

def y_max
  @y_max
end

#y_minObject

Returns the value of attribute y_min.



5
6
7
# File 'lib/simple_mapnik/bounds.rb', line 5

def y_min
  @y_min
end

Class Method Details

.releaseObject



17
# File 'lib/simple_mapnik/bounds.rb', line 17

def self.release; end

Instance Method Details

#freeObject



19
20
21
# File 'lib/simple_mapnik/bounds.rb', line 19

def free
  mapnik_bbox_free @ptr
end