Class MyNavigation

Navigation Example class. It allows the rendering of navigation instructions if available from computeRoute(). Creates a navigation object to simplify the display of instructions. It uses for the media directory the value of vg.imagePath (by default "../media"), which contains:

  • images for transit instructions: transit_*.png

  • Defined in: <application/mapviewer/js/MyNavigation.js>
Class Summary
Constructor Attributes Constructor Name and Description
 
MyNavigation(pMapViewer, pNavigationData,, vg_ids,)

Method Summary

Class Detail

MyNavigation(pMapViewer, pNavigationData,, vg_ids,)
 
 This class asummes that the following elements exist on your .html file

<div id="instructions" class="instructions">
	<div id="instructions_prev_button" class="instructions"><img src="media/leftArrow.png"/></div>
	<div id="instructions_count" class="instructions"></div>
	<div id="instructions_brief" class="instructions"></div>
	<div id="instructions_detail" class="instructions"></div>
	<img id="instructions_icon" class="instructions"></img>
	<div id="instructions_time" class="instructions"></div>
	<div id="instructions_next_button" class="instructions"><img src="media/rightArrow.png"/></div>
</div>

pNavigationData will have the form

{ "navigation": {
 "instructions" : [{
	"icon": "transit_instruction_turn_left.png",
	"dataset": "0",
	"modality": "pedestrian",
	"time": "0.000000",
	"totalTime": "45.953415","position" : { "lat" : "48.782332", "lon" : "2.221195" },
	"detail": "Go straight for a few seconds then turn left",
	"brief": "Go straight",
	"duration": " for a few seconds"
  }
  ,...
  ]
}
Parameters:
{vg.mapviewer.Mapviewer} pMapViewer
{object} pNavigationData,
result of vg.mapviewer.Mapviewer.computeRoute()
{object} vg_ids,
place id name correspondance, using the same file format as ids.json: {"targets":["default"],"labels":{"UL0-ID0003":["UL0-ID0003","Zara"],...} }
See:
vg.mapviewer.kiosk.Mapviewer#computeRoute
vg.mapviewer.web.Mapviewer#computeRoute

Field Detail

<static> {number} MyNavigation.navigationInstructionRadius
radius in meters to use when moving the camera to the beginning of an instruction.

Method Detail

  • displayNextInstruction()
    displays the previous instruction if possible and move the camera to the start of the instruction
  • displayPrevInstruction()
    displays the previous instruction if possible and move the camera to the start of the instruction
  • {boolean} isValid()
    returns false if there was no navigation data (for example missing "computeNavigation: true" in the routing request)
    Returns:
    {boolean} false if there was no navigation data
  • remove()
    clear all information associated with the navigation.
  • removeInstructionOverlays()
    clear any instruction extra overlays.