Skip to content
chrissy25 edited this page Nov 15, 2016 · 7 revisions

initialize

Call with:

$('#myMaps').wayfinding();

The initialize call needs an object with at least 'maps', 'defaultMap', and startpoint set in order to be useful. Technically these have defaults, but unless you map is named floorplan.svg and your defaultMap name is map.1 and your startpoint is startpoint you are going to need to provide some configuration.

maps

an array of objects with path and id. The path, including filename, is the URI for the the svg file to use for either the floor or region. The id is used to change floors and as a part of the identifier for portals to indicate which other map the portal binds to.

'maps': [
  {'path': 'demo_map_1.svg', 'id': 'floor1'},
  {'path': 'demo_map_2.svg', 'id': 'floor2'}
],

path

If not supplied with default to:

'path': {
  color: 'red',
  radius: 10,
  speed: 8,
  width: 3
},
  • color is any valid CSS color including #ff00ff notation.
  • radius is the turn radius in SVG integer units to use when smoothing the solution path for drawing it
  • speed controls the rate at which the solution path is animated to the screen
  • width controls the width of the solution path in pixels, but it may be scaled.

startpoint

either a string or a function that will return the identifier of the point to start the routing from

Both

'startpoint': 'lcd.1',

and

'startpoint': function () {
	return 'lcd.1';
},

are valid.

endpoint

either a string or a function that will return the identifier of the destination. Formatting is similar to startpoint.

accessibleRoute

a Boolean that defaults to false; which will allow the route returned to take stairs

defaultMap

either a string or a function to return the id of the map that should be displayed by default. Formatting is similar to startpoint.

loadMessage

The string to display in the target div while waiting for the maps to load.

dataStoreCache

Sets the behavior for the use of dataStores.

  • Defaults to null, which does not use datastores.
  • An object if the datastore is being passed in.
  • A string representing the base path from which datastores will be loaded.

showLocation

Boolean. If set to true map pins will be shown for the startpoint and endpoint.

locationIndicator

Styling for the map pins if displayed:

{
	fill: 'red',
	height: 40
}

zoomToRoute

Boolean that causes the map to be zoomed in to show just the region of travel.

zoomPadding

integer

routeTo

the function that will find the shortest route and display it

$('#myMaps').wayfinding('routeTo', 'destinationId');

animatePath

If there is an existing solution it will redraw the solution.

startpoint

$('#myMaps').wayfinding('startpoint', 'startingId');

currentMap

$('#myMaps').wayfinding('currentMap', 'targetMapId');

accessibleRoute

to change to using accessible routes and avoiding stairs

$('#myMaps').wayfinding('accessibleRoute', true);

path

getDataStore

will return a representation of the parsed collection of all loaded maps

$('#myMaps').wayfinding('getDataStore');

destroy