Documentation

Navigation

One of the most exciting features of Micello maps is the ability to navigate from one geometry on the map to any other. The navigation controls are exposed to the user inside of the default popup, allowing them to request navigation to and from any two geometries.

 
The resulting navigation path will look like this.


Navigation requests that span levels will direct the user through an appropriate level change ( stairs or escalator ).

There may be a time when the developer wishes to show a predefined navigation path when the map loads, or as the result of an event being triggered. The methods requestNavFromGeom() and requestNavToGeom() provide exactly that functionality.

Each of these methods accept the same two arguments. The first is the geometry object where the navigation begins or ends. The second is the level id of the geometry being specified. An optional third argument, doIsoLevel, can be passed as 'true' to indicate that the navigation should stay isolated to the level of the original geometry. This is only applicable for geometries that span multiple levels.

First, the map is initialized and a mapChanged override is set up:

micello.maps.init (apikey, mapInit);
var mapControl;
var mapDataObject;
function  mapInit() {
    mapControl =  new micello.maps.MapControl('mapElement');
    mapDataObject = mapControl.getMapData();
    mapDataObject.mapChanged = onMapChanged;
    mapDataObject.loadCommunity(15);
}
function onMapChanged (e) {
    if (e.comLoad) { // the map has loaded
        getNavigation();
    }
}

Then the function getNavigation makes use of the requestNavToGeom() and requestNavFromGeom() methods:

function getNavigation () {
     var fromGID = 3217169;
     var toGID = 3217287;
     mapControl.requestNavFromGeom(mapDataObject.geomMap[fromGID].g, mapDataObject.geomMap[fromGID].pl.id, true);
     mapControl.requestNavToGeom(mapDataObject.geomMap[toGID].g, mapDataObject.geomMap[toGID].pl.id, true);
}

Try changing the geometry ids in the code above and clicking 'Find Route' to see the resulting navigation path.