VisioWeb2D 1.8.0

Class

MyMultiBuildingView

Enables the MultiBuilding storyboard.

Constructor

new MyMultiBuildingView(mapviewer, venueLayout, venueLayoutLocalization, parameters)

Initial implementation of multi-building storyboard, it is subject to change in future versions.
Requirements:
  • Dataset should be published with sdk.web=1.7.14 or sdk.web2d=1.7.14

Storyboard:
  • There are three modes: Global, Building, Floor
  • View starts in the global View
  • clicking on any building, will change into building mode focusing on a single building
  • the building view shows all the floors of a building as a stack
  • clicking on any floor, will change the floor in building view then pass onto floor view
  • clicking the global button will bring you back to global view
  • clicking the buiding name button will bring you to the building view
  • mouseover/out has been commented out on mapviewer.web.js
  • clicking on a show will display bubble. clicking set origin, will add Start Pin, clicking set destination will add End Pin if no Start Pin, otherwise will compute route
  • When routes are computed, stepping through instructions in Building view will only change the floor.
  • When routes are viewed in Building View, there is a Link that connects the routes through different floors.
Triggers signals: 'MyMultiBuildingView.exploreStateChanged', 'MyMultiBuildingView.exploreStateWillChange'
Parameters:
Name Type Description
mapviewer vg.mapviewer.web.Mapviewer | vg.mapviewer.web2d.Mapviewer
venueLayout object describes the venue layout. Usually mapviewer.getExtraData().config.venue_layout
venueLayoutLocalization object describes the .name, .shortName, .description for each building and floor. Usually mapviewer.getExtraData().resources[language].localized.locale[language].venueLayout {"B3": { name: 'building 3', description: 'my building', shortName: 'bldg3'}, "B2"....}
parameters object
Properties
Name Type Description
containerDivSelector string selector, e.g. #container to find the right div where the mapviewer and map are on.
Since:
  • 1.7.18 Experimental "multi-floor" mode, for datasets not configured in multi-building on the mapeditor side.
Example
// for the most part, we go for the defaults
var parameters = {
	'containerDivSelector': '#container'
};
multiBuildingView = new MyMultiBuildingView(mapviewer,mapviewer.getExtraData().config.venue_layout, parameters);

Members

buildingMarkerHeight :number

distance above the ground building markers on the global view will be placed. default value is 50.

buildingMarkerScale :number

scale size for building markers on the global view. default value is 30.

buildingModeEnabled :boolean

Determines whether buildingMode should be allowed, otherwise it will only use global and floor mode. default is true.

buildingModelAnimationDurationDown :number

duration in seconds for animating buildings going down. Default is 0 seconds.
Since:
  • 1.7.19
See:

buildingModelAnimationDurationUp :number

duration in seconds for animating buildings going up. Default is 0.7 seconds.
Since:
  • 1.7.19
See:

buildingModePaddingFactor :number

padding as a percentage of the border of the screen that the building mode view point should be calculated using getViewPointFromPositions(). values should range from 0 to 0.5. Default value is 0.1 for VisioWeb and 0.0 for VisioWeb2D.

buildingModePitch :number

Camera pitch in degrees for building mode. default is -35.
See:

cameraPositionAnimationDuration :number

duration in seconds for animating the camera position when changing modes, overridden if animationDuration is passed to goTo(). default value is 0.7 second.
See:

(constant) DEFAULT :string

value to indicate that one would like to go to the default floor or building.
Example
MyMultiBuildingView#goTo
 multiBuildingView.goTo({
     mode: 'global',
     buildingID: MyMultiBuildingView.DEFAULT,
     floorID: MyMultiBuildingView.DEFAULT,
     animationDuration: 0
 });

floorAnimationDuration :number

duration in seconds for animating floors in and out, overridden if animationDuration is passed to goTo(). default value is 0.7 second.
See:

floorModePaddingFactor :number

padding as a percentage of the border of the screen that the building mode view point should be calculated using getViewPointFromPositions(). values should range from 0 to 0.5. Default value is 0.1 for VisioWeb and 0.0 for VisioWeb2D.

floorModePitch :number

Camera pitch in degrees for foo mode. default is -50.
See:

globalModePaddingFactor :number

padding as a percentage of the border of the screen that global mode view point should be calculated using getViewPointFromPositions(). values should range from 0 to 0.5. Default value is 0.

globalModePitch :number

Camera pitch in degrees for global mode. default is -50.
See:

headingAnimationDuration :number

duration in seconds for animating the camera heading when changing modes, overridden if animationDuration is passed to goTo(). default value is 0.7 second.
See:

multifloorCompatibilityMode :number

Changes some parameters to have a view close to multifloor stack view: In building mode see all floors, in floor mode see only active floor; In building mode use always lod 0, in floor let auto; Content is always enabled, even on forced lod; floors move out of the way on the right direction when switching floors in 'floor' mode; in compatibility mode hide route links in floor mode; save initial position for building mode if no footprint; When no footprint is found we use the inital camera position gap between floors, if no mapviewer.getExtraData() is in synthesizeVenueLayout
Since:
  • 1.7.18?

pitchAnimationDuration :number

duration in seconds for animating the camera pitch when changing modes, overridden if animationDuration is passed to goTo(). default value is 0.7 second.
See:

stackHeightFarAway :number

distance above the ground that layers will be sent to, before they are hidden. default value is 750.

Methods

(static) intersects2D(point, of) → {boolean}

Determines if a point {x:,y:} is inside a polygon (Array of points), ignore z attribute.
Parameters:
Name Type Description
point point
of Array points, polygon
Returns:
true if point is inside polygon
Type
boolean

(static) setupMultiBuilding(mapviewer) → {boolean}

Setup listerners and UI for Multi-Building storyboard.
Parameters:
Name Type Description
mapviewer vg.mapviewer.web.Mapviewer | vg.mapviewer.web2d.Mapviewer
Returns:
true mapviewer.getExtraData() has correct multi building data (venue_layout)
Type
boolean

(static) synthesizeVenueLayout(mapviewer) → {Object}

Experimental: Create a single building with no outside to have multifloor like view of a non-multibuilding dataset.
Parameters:
Name Type Description
mapviewer vg.mapviewer.web.Mapviewer | vg.mapviewer.web2d.Mapviewer
Since:
  • 1.7.18
Returns:
object that will look like the result of mapviewer.getExtraData() of a multi-building dataset.
Type
Object

animateHeading(value, optionsopt) → {jQuery.Deferred.Promise}

This method is used to animate the pitch of the camera.
Parameters:
Name Type Attributes Description
value number target rotation
options.durationInSeconds number <optional>
duration in seconds, if not constant degrees at 4 degrees per second.
options object <optional>
Returns:
where a done() or fail() callback can be added.
Type
jQuery.Deferred.Promise
Example
multiBuildingView.animateHeading(30, {durationInSeconds: 2})
.done(function() { ... update something})
.fail(function() { alert('error'); });

animatePitch(value, optionsopt) → {jQuery.Deferred.Promise}

This method is used to animate the pitch of the camera.
Parameters:
Name Type Attributes Description
value number target pitch
options object <optional>
Properties
Name Type Attributes Description
durationInSeconds number <optional>
duration in seconds, if not constant degrees at 4 degrees per second.
Returns:
where a done() or fail() callback can be added.
Type
jQuery.Deferred.Promise
Example
multiBuildingView.animatePitch(-85, {durationInSeconds: 2})
.done(function() { ... update 2D labels})
.fail(function() { alert('error'); });

changeFloorOverride(targetFloorName, optionsopt) → {jQuery.Deferred.Promise}

Used (carefully) to override mapviewer's original changeFloor function in case it is use elsewhere in the application. For example by MyNavigation or MyRoute
Parameters:
Name Type Attributes Description
targetFloorName string The floor to change to. If it is the same as the current floor, the done() function is called directly.
options object <optional>
Additional options to change floor.
Properties
Name Type Attributes Default Description
animationDuration number <optional>
this.floorAnimationDuration Duration of the change floor animation in milliseconds like found in vg.mapviewer.Mapviewer.Web or Web2D, other animation durations are in seconds.
Since:
  • 1.7.21 updated to not change viewpoint, to be more similar to SDK's changeFloor implementation.
Returns:
where a done() or fail() callback can be added.
Type
jQuery.Deferred.Promise

getCurrentExploreState(Object) → {jQuery.Promise}

returns the current explore state.
Parameters:
Name Type Description
Object ExploreState with attributes mode, buildingID, floorID
Since:
  • 1.7.17
Returns:
Type
jQuery.Promise

getCurrentFloor() → {string}

Returns the current floor.
Since:
  • 1.7.21
Returns:
if it is in global mode, it return the globalLayerID, otherwise the current exploreState floorID.
Type
string

getLocalizedName(id) → {string}

get the localized name for an ID
Parameters:
Name Type Description
id string
Returns:
Type
string

getMapStateForExploreState(exploreState, optionsopt) → {MapState}

converts a given exploreState to a MapState describing new layer positions, if 3D Models will be visible, camera position. normally it does not have to be so robust as it will be called with a resolved state
Parameters:
Name Type Attributes Description
exploreState Object
Properties
Name Type Attributes Description
mode Object <optional>
buildingID Object <optional>
undefined (if mode is global) or valid buildingID, cannot be DEFAULT.
floorID Object <optional>
undefined (if mode is global) or valid floorID, cannot be DEFAULT.
place Object <optional>
placeID
noViewpoint Object <optional>
do not change the current viewpoint, do not animate camera.
viewpoint Object <optional>
viewpoint has preference over place
Properties
Name Type Attributes Description
position Object <optional>
viewpoint has preference over place
pitch Object <optional>
optional pitch, otherwise use default for mode.
heading Object <optional>
optional heading, otherwise use one defined on footprint for building or outside layer. If it is the same as the current floor, the done() function is called directly.
options object <optional>
Additional options to change floor.
Since:
  • 1.7.18 fixed exploreState.viewpoint.pitch and heading, and added exploreState.noViewpoint to skip moving the camera.
Returns:
Type
MapState

goTo(exploreState) → {jQuery.Deferred.Promise}

Goto a explore state. Triggers signals: 'MyMultiBuildingView.exploreStateWillChange' with arguments .target, .current and .view , and 'MyMultiBuildingView.exploreStateChanged' with arguments .current, .previous and .view
Parameters:
Name Type Description
exploreState Object
Properties
Name Type Attributes Default Description
mode string <optional>
mode one of 'global', 'building', 'floor'
buildingID string <optional>
MyMultiBuildingView.DEFAULT
floorID string <optional>
MyMultiBuildingView.DEFAULT If it is the same as the current floor, the done() function is called directly.
noViewpoint boolean <optional>
false if true the camera position will not be updated to default viewpoint for mode.
animationDuration number <optional>
default for cameraPositionDuration, pitchAnimationDuration and headingAnimationDuration Duration in seconds for cameraPosition, heading, and pitch animation, note that mapviewer.camera.goTo has different signature.
cameraPositionAnimationDuration number <optional>
this.cameraPositionAnimationDuration Duration in seconds for animation of camera position change if any.
pitchAnimationDuration number <optional>
this.pitchAnimationDuration Duration in seconds for animation of camera pitch change if any.
headingAnimationDuration number <optional>
this.headingAnimationDuration Duration in seconds for animation of camera heading change if any.
floorAnimationDuration number <optional>
this.floorAnimationDuration Duration in seconds for animation of floors (same as animationDuration for changeFloor())
viewpoint Object <optional>
viewpoint that shows the whole floor or outside viewpoint has preference over place
Properties
Name Type Attributes Description
position Object <optional>
viewpoint has preference over place
pitch Object <optional>
optional pitch, otherwise use default for mode.
heading Object <optional>
optional heading, otherwise use one defined on footprint for building or outside layer.
Since:
  • 1.7.21 can specify the duration for pitch,heading, camera position, floor individually. Best just to update this.*animationDuration parameters.
Returns:
where a done() or fail() callback can be added.
Type
jQuery.Deferred.Promise
Example
multiBuildingView.goTo({mode: 'global',animationDuration: 0});
multiBuildingView.goTo({
  mode: 'building',
  buildingID: "B2",
  animationDuration: 0.5})
.done(function(){... update UI here ....});

multiBuildingView.goTo({
    mode: 'global',
    buildingID: MyMultiBuildingView.DEFAULT,
    floorID: MyMultiBuildingView.DEFAULT,
    animationDuration: 0
});

multiBuildingView.goTo({
    mode: 'floor',
    floorID: 'B4-UL04',
    animationDuration: 0,
    viewpoint: {
      position: {x: -127.8117136719601, y: -135.464972367098, radius: 64.24722758526218}
    }
});

mapviewerCustomPreManipulatorListener(event)

handles custom manipulation to be able to swipe up/down to change floor, and tap to go into floor view.
Parameters:
Name Type Description
event object

setLocalizationData(localizationData)

Set the localization data for floor and building names
Parameters:
Name Type Description
localizationData Object of the form {"B3": { name: 'building 3', description: 'my building', shortName: 'bldg3'}, "B2"....}

setupActiveBuildingMarkerPOIs()

setup handlers so put markers on the global view for the focused building. Should only be called once. if there is no global layer, it will do nothing.

setupMultibuildingFloorUI()

Setup selectors and listeners to update UI for current mode, building and floor. It expects div #floor_container, #global_mode_button, #floor_mode_button, #change_building_select, #change_floor_select