Class: Proj::Point Deprecated

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(x, y) ⇒ Point

Create new Point object from coordinates.



14
15
16
17
18
# File 'lib/point.rb', line 14

def initialize(x, y)
  @struct = Api::ProjUV.new
  @struct[:u] = x
  @struct[:v] = y
end

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

#latObject

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

#lonObject

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_degreesObject



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_ptrObject



20
21
22
# File 'lib/point.rb', line 20

def to_ptr
  @struct.to_ptr
end

#to_radiansObject



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

#xObject

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

#yObject

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