Class: Proj4::ProjXY

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/ffi-proj4/projxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ProjXY

Returns a new instance of ProjXY.



9
10
11
12
13
14
15
16
17
# File 'lib/ffi-proj4/projxy.rb', line 9

def initialize(*args)
  case args.first
    when FFI::Pointer, FFI::Buffer
      super
    else
      super()
      self.init(*args)
  end
end

Instance Method Details

#init(*args) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/ffi-proj4/projxy.rb', line 19

def init(*args)
  if !args.empty?
    self[:x] = args[0].to_f
    self[:y] = args[1].to_f
  end

  self
end

#to_degObject



50
51
52
# File 'lib/ffi-proj4/projxy.rb', line 50

def to_deg
  self.dup.to_deg!
end

#to_deg!Object



44
45
46
47
48
# File 'lib/ffi-proj4/projxy.rb', line 44

def to_deg!
  self[:x] = self[:x] * Proj4::RAD_TO_DEG
  self[:y] = self[:y] * Proj4::RAD_TO_DEG
  self
end

#to_radObject



60
61
62
# File 'lib/ffi-proj4/projxy.rb', line 60

def to_rad
  self.dup.to_rad!
end

#to_rad!Object



54
55
56
57
58
# File 'lib/ffi-proj4/projxy.rb', line 54

def to_rad!
  self[:x] = self[:x] * Proj4::DEG_TO_RAD
  self[:y] = self[:y] * Proj4::DEG_TO_RAD
  self
end

#xObject



36
37
38
# File 'lib/ffi-proj4/projxy.rb', line 36

def x
  self[:x]
end

#x=(v) ⇒ Object



28
29
30
# File 'lib/ffi-proj4/projxy.rb', line 28

def x=(v)
  self[:x] = v
end

#yObject



40
41
42
# File 'lib/ffi-proj4/projxy.rb', line 40

def y
  self[:y]
end

#y=(v) ⇒ Object



32
33
34
# File 'lib/ffi-proj4/projxy.rb', line 32

def y=(v)
  self[:y] = v
end