VisioWeb2D 1.8.0

Class

MyRoute

Route example class.

Constructor

new MyRoute(mapviewer, routeData)

It allows the rendering of a route if available from computeRoute(). Creates a route object to simplify the display of line routes, start/end/change floor icons. It uses for the media directory the value of vg.imagePath (by default "../media"), which contains:
  • image for route style: 2d_track_blue_boomerang.png
  • images for pins for start, end of route and change floor
Parameters:
Name Type Description
mapviewer vg.mapviewer.Mapviewer
routeData object result of vg.mapviewer.Mapviewer.computeRoute()
See:
  • vg.mapviewer.Mapviewer.html#computeRoute
Example
pRouteData will have the form
{
    "name" : "Route Result",
    "src" : "LG002",
    "dst" : "LG011",
    "status" : "200",
    "legs" :[
     {
    	 "dataset" : "L",
    	 "points" : [{ "lat" : "5.1980516","lon" : "45.2789357" }, ... ]
     }
     , ...
    ],
     "length": "62.7925949"
}

Members

add_go_back_pois :number

Show pois that allow you to back on the route (like the previous floor). default is false.
Since:
  • 1.7.18 moved it as a prototype variable.

use_links :number

use links between floors, useful only if useing MyMultiBuildingView.multifloorCompatibilityMode. default is false.
Since:
  • 1.7.18 moved it outside as a class variable.

Methods

addEndPOI(floorName, position)

Create a end POI at a given floor name and position. It is used when creating a route, but can also be used separately, for example creating start POI after setting the start.
Parameters:
Name Type Description
floorName string
position position object with {x:,y:,z:}
Since:
  • 1.7.14
Example
var routeStartEnd = new MyRoute(mapviewer);
...
routeStartEnd.remove();
...
var place = mapviewer.getPlace(id);
if (place)
{
	var position = {x: place.vg.position.x, y: place.vg.position.y, z: 3};
	routeStartEnd.addEndPOI(place.vg.floor, position);
}

addStartPOI(floorName, position)

Create a start POI at a given floor name and position. It is used when creating a route, but can also be used separately, for example creating start POI after setting the start.
Parameters:
Name Type Description
floorName string
position position object with {x:,y:,z:}
Since:
  • 1.7.14
Example
var routeStartEnd = new MyRoute(mapviewer);
...
routeStartEnd.remove();
...
var place = mapviewer.getPlace(id);
if (place)
{
	var position = {x: place.vg.position.x, y: place.vg.position.y, z: 3};
	routeStartEnd.addStartPOI(place.vg.floor, position);
}

addWaypointPOI(floorName, position)

Create a waypoint POI at a given floor name and position. It is used when creating a route, but can also be used separately, for example creating start POI after setting the start.
Parameters:
Name Type Description
floorName string
position position object with {x:,y:,z:}
Since:
  • 1.7.15
Example
var routeStartEnd = new MyRoute(mapviewer);
...
routeStartEnd.remove();
...
var place = mapviewer.getPlace(id);
if (place)
{
	var position = {x: place.vg.position.x, y: place.vg.position.y, z: 3};
	routeStartEnd.addWaypointPOI(place.vg.floor, position);
}

getInitialFloor()

returns the floor name of the first floor of the route

getInitialViewpointPosition()

returns the floor name of the first floor of the route

hide()

Hides the route if visible

hideLinks()

Hide the links between floors
Since:
  • 1.7.14

isValid() → {Boolean}

Determine if the object has been succesfully created AND is currently valid.
Returns:
True if the object is valid, otherwise false.
Type
Boolean

remove()

removes the route and its links

show()

Display the route if hidden

showLinks()

Display the links between floors
Since:
  • 1.7.14