Class: Proj::Area

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

Overview

Areas are used to specify the area of use for the choice of relevant coordinate operations. See Transformation#new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Area.



15
16
17
18
19
20
21
22
# File 'lib/proj/area.rb', line 15

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

Instance Attribute Details

#east_lon_degreeObject (readonly)

Returns the value of attribute east_lon_degree.



7
8
9
# File 'lib/proj/area.rb', line 7

def east_lon_degree
  @east_lon_degree
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/proj/area.rb', line 7

def name
  @name
end

#north_lat_degreeObject (readonly)

Returns the value of attribute north_lat_degree.



7
8
9
# File 'lib/proj/area.rb', line 7

def north_lat_degree
  @north_lat_degree
end

#south_lat_degreeObject (readonly)

Returns the value of attribute south_lat_degree.



7
8
9
# File 'lib/proj/area.rb', line 7

def south_lat_degree
  @south_lat_degree
end

#west_lon_degreeObject (readonly)

Returns the value of attribute west_lon_degree.



7
8
9
# File 'lib/proj/area.rb', line 7

def west_lon_degree
  @west_lon_degree
end

Class Method Details

.finalize(pointer) ⇒ Object



9
10
11
12
13
# File 'lib/proj/area.rb', line 9

def self.finalize(pointer)
  proc do
    Api.proj_area_destroy(pointer)
  end
end

Instance Method Details

#set_bounds(west_lon_degree:, south_lat_degree:, east_lon_degree:, north_lat_degree:) ⇒ Object

Sets the bounds for an area

Parameters:

  • west_lon_degree (Float)

    West longitude, in degrees. In [-180,180] range.

  • south_lat_degree (Float)

    South latitude, in degrees. In [-90,90] range.

  • east_lon_degree (Float)

    East longitude, in degrees. In [-180,180] range.

  • north_lat_degree (Float)

    North latitude, in degrees. In [-90,90] range.

See Also:



36
37
38
# File 'lib/proj/area.rb', line 36

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_ptrObject



24
25
26
# File 'lib/proj/area.rb', line 24

def to_ptr
  @area
end

#to_sString

Returns nice printout of an Area

Returns:

  • (String)


54
55
56
# File 'lib/proj/area.rb', line 54

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