Logo
Developer

VisioWeb 1.16.3

Class

visioweb.Route

new Route(viewer, routeData, optionsopt)

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 options.imagePath (by default "../media"), which contains:
  • image for route style: track_arrow.png (in previous versions: 2d_track_blue_boomerang.png)
  • image for floor transtion tags: track_floor_change_tag.png
  • images for pins for start, end of route and change floor: track_*.png
  • images for transit instructions: transit_instruction_*.png
Parameters:
Name Type Attributes Description
viewer visioweb.Mapviewer
routeData Object result of visioweb.Mapviewer.computeRoute()
options Object <optional>
Properties
Name Type Attributes Default Description
imagePath string <optional>
../media the folder where to find icons expected for route rendering. Default: '../media'
images Object <optional>
a collection of (type, url) pairs allowing to customize the icons used for route rendering.
Expected image types are track, start, end, waypoint, up, down, modalityChange and layerChange.
arrowWidth number <optional>
5 the arrow's width or thickness in meters.
arrowSpeed number <optional>
1 the arrow's speed in meters per second (see speed in visioweb.Mapviewer#addPath).
arrowRepeat number <optional>
-0.8 the arrow's repeating period(see repeat in visioweb.Mapviewer#addPath).
pathOpacity number <optional>
0.7 the route's opacity.
pathOverlay boolean <optional>
false whether to draw the route on top of other scene objects.
pathColor Object <optional>
a triplet of hexadecimal color values, provided as strings preceded by the hash sign.
Properties
Name Type Attributes Default Description
past string <optional>
#d7d8d9 color value for past instructions.
current string <optional>
#00c5eb color value for current instruction.
future string <optional>
#0099ae color value for future instructions.
pathSegments number <optional>
-1 the path's resolution, i.e. number of segments. Negative values are interpreted as number of meters per segment.
pathQuality number <optional>
0.8 the coefficient, between 0 and 1, that will be used to optimize path geometry. 0 = minimal number of faces. 1 = no optimization.
pathWidth number <optional>
2 the path's width or thickness in meters.
pathHeight number <optional>
1 the path's height over the ground in meters.
pinHeight number <optional>
3 the route pins' height in meters.
onClickStart function <optional>
event handler called when user clicks on start pin.
onClickWaypoint function <optional>
event handler called when user clicks on waypoint pin(s).
onClickEnd function <optional>
event handler called when user clicks on end pin.
showStartPin boolean <optional>
true flag to activate/deactivate display of start pin.
showWaypointPin boolean <optional>
true flag to activate/deactivate display of waypoint pin(s).
showEndPin boolean <optional>
true flag to activate/deactivate display of end pin.
useLinks boolean <optional>
false flag to activate/deactivate display of links: animated arrows highlighting floor connections.
addGoBackPins boolean <optional>
false flag to activate/deactivate display of pins highlighting a floor connection in the backward direction.
By default, the Route instance will create a pin to highlight a floor connection in the forward direction (e.g. corresponding to a 'go up' instruction).
This option activates a pin in the destination floor in a symmetrical way. Will have no effect when using "Links" (useLinks==true).
floorFilter string <optional>
all can be 'involved', 'traversed' or 'all' (default).
Useful to show only the relevant floors when the route is displayed.
'involved' will show only the floors where a part of the route is shown.
'traversed' will show the 'involved' floors + the ones that are in between (traversed).
Recommendation: disable any floor selection UI component when showing the route if you use this option.
See:
Example
routeData should 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 summary


Name Description
finalFloor The route's final floor's name
initialFloor The route's initial floor's name

Methods summary


Name Description
getViewpointPosition computes a viewpoint to see either the start point, the end point, the first part or the last part of the route, or the whole route.
hide Hides the route if visible
hideLinks Hide the links between floors
isValid Determine if the object has been succesfully created AND is currently valid.
remove removes the route and its links
show Display the route if hidden
showLinks Display the links between floors

Members detail

(static) finalFloor :string

The route's final floor's name
Default Value:
  • false

(static) initialFloor :string

The route's initial floor's name
Default Value:
  • false

Methods detail

getViewpointPosition(mode) → {object}

computes a viewpoint to see either the start point, the end point, the first part or the last part of the route, or the whole route.
Parameters:
Name Type Description
mode string 'start', 'end', 'initialFloor', 'finalFloor', 'wholeRoute'. Default: 'initialFloor'.
Returns:
a camera position (x,y,radius)
Type
object

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() → {Promise}

Display the route if hidden
Returns:
utility to delay further actions to next frame, thus making sure route objects are loaded and displayed.
Type
Promise

showLinks()

Display the links between floors
Since:
  • 1.7.14