Class: Proj::Area

Inherits:
Object
  • Object
show all
Defined in:
lib/area.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, west_lon_degree, south_lat_degree, east_lon_degree, north_lat_degree) ⇒ Area

Returns a new instance of Area.



24
25
26
27
28
29
30
# File 'lib/area.rb', line 24

def initialize(name, west_lon_degree, south_lat_degree, east_lon_degree, north_lat_degree)
  @name = name
  @west_lon_degree = west_lon_degree
  @south_lat_degree = south_lat_degree
  @east_lon_degree = east_lon_degree
  @north_lat_degree = north_lat_degree
end

Instance Attribute Details

#east_lon_degreeObject (readonly)

Returns the value of attribute east_lon_degree.



3
4
5
# File 'lib/area.rb', line 3

def east_lon_degree
  @east_lon_degree
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/area.rb', line 3

def name
  @name
end

#north_lat_degreeObject (readonly)

Returns the value of attribute north_lat_degree.



3
4
5
# File 'lib/area.rb', line 3

def north_lat_degree
  @north_lat_degree
end

#south_lat_degreeObject (readonly)

Returns the value of attribute south_lat_degree.



3
4
5
# File 'lib/area.rb', line 3

def south_lat_degree
  @south_lat_degree
end

#west_lon_degreeObject (readonly)

Returns the value of attribute west_lon_degree.



3
4
5
# File 'lib/area.rb', line 3

def west_lon_degree
  @west_lon_degree
end

Class Method Details

.for_object(pj_object) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/area.rb', line 5

def self.for_object(pj_object)
  p_name = FFI::MemoryPointer.new(:pointer)
  p_west_lon_degree = FFI::MemoryPointer.new(:double)
  p_south_lat_degree = FFI::MemoryPointer.new(:double)
  p_east_lon_degree = FFI::MemoryPointer.new(:double)
  p_north_lat_degree = FFI::MemoryPointer.new(:double)

  result = Api.proj_get_area_of_use(Context.current, pj_object,
                                    p_west_lon_degree, p_south_lat_degree, p_east_lon_degree, p_north_lat_degree,
                                    p_name)
  unless result
    Error.check
  end

  name = p_name.read_pointer.read_string_to_null.force_encoding('utf-8')
  self.new(name,
           p_west_lon_degree.read_double, p_south_lat_degree.read_double, p_east_lon_degree.read_double, p_north_lat_degree.read_double)
end