Class: CloudMade::RouteInstruction

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudmade/routing.rb

Overview

Instructions on route passing

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ RouteInstruction

Returns a new instance of RouteInstruction.



131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/cloudmade/routing.rb', line 131

def initialize(data)
  @instruction = data[0]
  @length = Float(data[1])
  @position = Integer(data[2])
  @time = Integer(data[3])
  @length_caption = data[4]
  @earth_direction = data[5]
  @azimuth = Float(data[6])
  if data.length == 9
    @turn_type = data[7]
    @turn_angle = data[8]
  end
end

Instance Attribute Details

#azimuthObject (readonly)

North-based azimuth



125
126
127
# File 'lib/cloudmade/routing.rb', line 125

def azimuth
  @azimuth
end

#earth_directionObject (readonly)

Earth direction



123
124
125
# File 'lib/cloudmade/routing.rb', line 123

def earth_direction
  @earth_direction
end

#instructionObject (readonly)

Text instruction



113
114
115
# File 'lib/cloudmade/routing.rb', line 113

def instruction
  @instruction
end

#lengthObject (readonly)

Length of the segment in meters



115
116
117
# File 'lib/cloudmade/routing.rb', line 115

def length
  @length
end

#length_captionObject (readonly)

Length of the segments in specified units



121
122
123
# File 'lib/cloudmade/routing.rb', line 121

def length_caption
  @length_caption
end

#positionObject (readonly)

Index of the first point of the segment



117
118
119
# File 'lib/cloudmade/routing.rb', line 117

def position
  @position
end

#timeObject (readonly)

Estimated time required to travel the segment in seconds



119
120
121
# File 'lib/cloudmade/routing.rb', line 119

def time
  @time
end

#turn_angleObject (readonly)

Angle in degress of the turn between two segments



129
130
131
# File 'lib/cloudmade/routing.rb', line 129

def turn_angle
  @turn_angle
end

#turn_typeObject (readonly)

Code of the turn type



127
128
129
# File 'lib/cloudmade/routing.rb', line 127

def turn_type
  @turn_type
end