Module: GeoMagic::Util

Defined in:
lib/geo_magic/util.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.extract_point(point) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/geo_magic/util.rb', line 5

def self.extract_point point
  case point
  when Hash
    [ point[:lat] || point[:latitude], point[:long] || point[:longitude] ]      
  when GeoMagic::Point
    [point.latitude, point.longitude]
  when GeoMagic::Location
    [point.latitude, point.longitude]
  when Array
    [point[0], point[1]]
  end 
end

.extract_points(from_point, to_point) ⇒ Object



18
19
20
# File 'lib/geo_magic/util.rb', line 18

def self.extract_points from_point, to_point
  [extract_point(from_point), extract_point(to_point)].flatten.map(&:to_f)
end