class Proj::Area
Areas are used to specify the area of use for the choice of relevant coordinate operations. See Transformation#new
Attributes
east_lon_degree[R]
name[R]
north_lat_degree[R]
south_lat_degree[R]
west_lon_degree[R]
Public Class Methods
finalize(pointer)
click to toggle source
@!visibility private
# File lib/proj/area.rb, line 10 def self.finalize(pointer) proc do Api.proj_area_destroy(pointer) end end
new(west_lon_degree:, south_lat_degree:, east_lon_degree:, north_lat_degree:, name: nil)
click to toggle source
# File lib/proj/area.rb, line 16 def initialize(west_lon_degree:, south_lat_degree:, east_lon_degree:, north_lat_degree:, name: nil) @west_lon_degree = west_lon_degree @south_lat_degree = south_lat_degree @east_lon_degree = east_lon_degree @north_lat_degree = north_lat_degree @name = name create_area end
Public Instance Methods
name=(value)
click to toggle source
Sets the name for an area
@param value [String] The name of the area
# File lib/proj/area.rb, line 44 def name=(value) @name = name # This Api wasn't added until proj 9.1 if defined?(Api.proj_area_set_name) Api.proj_area_set_name(self, value) end end
set_bounds(west_lon_degree:, south_lat_degree:, east_lon_degree:, north_lat_degree:)
click to toggle source
Sets the bounds for an area
@see proj.org/development/reference/functions.html#c.proj_area_set_bbox
@param west_lon_degree
[Float] West longitude, in degrees. In [-180,180] range. @param south_lat_degree
[Float] South latitude, in degrees. In [-90,90] range. @param east_lon_degree
[Float] East longitude, in degrees. In [-180,180] range. @param north_lat_degree
[Float] North latitude, in degrees. In [-90,90] range.
# File lib/proj/area.rb, line 37 def set_bounds(west_lon_degree:, south_lat_degree:, east_lon_degree:, north_lat_degree:) Api.proj_area_set_bbox(self, west_lon_degree, south_lat_degree, east_lon_degree, north_lat_degree) end
to_ptr()
click to toggle source
# File lib/proj/area.rb, line 25 def to_ptr @area end
to_s()
click to toggle source
Returns nice printout of an Area
@return [String]
# File lib/proj/area.rb, line 55 def to_s "Area west_lon_degree: #{self.west_lon_degree}, south_lat_degree: #{self.south_lat_degree}, east_lon_degree: #{self.east_lon_degree}, north_lat_degree: #{self.north_lat_degree}" end
Private Instance Methods
create_area()
click to toggle source
Creates an area
@see proj.org/development/reference/functions.html#c.proj_area_create
# File lib/proj/area.rb, line 64 def create_area @area = Api.proj_area_create self.set_bounds(west_lon_degree: west_lon_degree, south_lat_degree: south_lat_degree, east_lon_degree: east_lon_degree, north_lat_degree: north_lat_degree) if name self.name = name end ObjectSpace.define_finalizer(self, self.class.finalize(@area)) end