Class: Proj::Point Deprecated
- Inherits:
-
Object
- Object
- Proj::Point
- Defined in:
- lib/point.rb
Overview
Deprecated.
This class is DEPRECATED. It will be removed when Proj 7 is released and removes the underlying API’s this class uses. Code should be ported to use Coordinate objects.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(x, y) ⇒ Point
constructor
Create new Point object from coordinates.
-
#lat ⇒ Object
Get latitude/y coordinate.
-
#lat=(value) ⇒ Object
Set latitude/y coordinate.
-
#lon ⇒ Object
Get longitude/x coordinate.
-
#lon=(value) ⇒ Object
Set longitude/x coordinate.
- #to_degrees ⇒ Object
- #to_ptr ⇒ Object
- #to_radians ⇒ Object
-
#x ⇒ Object
Get x coordinate.
-
#x=(value) ⇒ Object
Set x coordinate.
-
#y ⇒ Object
Get y coordinate.
-
#y=(value) ⇒ Object
Set y coordinate.
Constructor Details
Class Method Details
.from_pointer(pointer) ⇒ Object
7 8 9 10 11 |
# File 'lib/point.rb', line 7 def self.from_pointer(pointer) result = self.allocate result.instance_variable_set(:@struct, pointer) result end |
Instance Method Details
#lat ⇒ Object
Get latitude/y coordinate.
63 64 65 |
# File 'lib/point.rb', line 63 def lat @struct[:v] end |
#lat=(value) ⇒ Object
Set latitude/y coordinate.
68 69 70 |
# File 'lib/point.rb', line 68 def lat=(value) @struct[:v] = value end |
#lon ⇒ Object
Get longitude/x coordinate.
53 54 55 |
# File 'lib/point.rb', line 53 def lon @struct[:u] end |
#lon=(value) ⇒ Object
Set longitude/x coordinate.
58 59 60 |
# File 'lib/point.rb', line 58 def lon=(value) @struct[:u] = value end |
#to_degrees ⇒ Object
28 29 30 |
# File 'lib/point.rb', line 28 def to_degrees self.class.new(Api.proj_todeg(self.x), Api.proj_todeg(self.y)) end |
#to_ptr ⇒ Object
20 21 22 |
# File 'lib/point.rb', line 20 def to_ptr @struct.to_ptr end |
#to_radians ⇒ Object
24 25 26 |
# File 'lib/point.rb', line 24 def to_radians self.class.new(Api.proj_torad(self.x), Api.proj_torad(self.y)) end |
#x ⇒ Object
Get x coordinate.
33 34 35 |
# File 'lib/point.rb', line 33 def x @struct[:u] end |
#x=(value) ⇒ Object
Set x coordinate.
38 39 40 |
# File 'lib/point.rb', line 38 def x=(value) @struct[:u] = value end |
#y ⇒ Object
Get y coordinate.
43 44 45 |
# File 'lib/point.rb', line 43 def y @struct[:v] end |
#y=(value) ⇒ Object
Set y coordinate.
48 49 50 |
# File 'lib/point.rb', line 48 def y=(value) @struct[:v] = value end |