Class: Viewer

Mapspace.street. Viewer

This is 3D viewer that uses internally Three.js classes to show 3D objects, 3D geometries and Street image imagery. This viewer is based on Marzipano viewer but expands the capabilities further away to support any 3D objects to be rendered in the scene. The Marzipano viewer is based on an internal set of objects to render Street images. This viewer uses internally Three.js, a more flexible and robust API to render 3D objects, including Street images.

Note that with Mapspace.street.Viewer and all its subclasses, any property set in the options is set as a ol.Object property on the viewer object, so is observable, and has get/set accessors.


new Viewer( [options])

Parameters:
Name Type Argument Description
options Mapspace.street.ViewerOptions <optional>

Viewer options.

Source:
mapspace-street/streetviewer.js
Fires:
  • ol.events.Event#change:imageid
  • ol.events.Event#change:center
  • ol.Object.Event#change:rotation
  • ol.Object.Event#change:roll
  • ol.Object.Event#change:pitch
  • ol.Object.Event#change:yaw
  • ol.Object.Event#change:fov
  • ol.Object.Event#change:brightness
  • ol.Object.Event#change:contrast
  • ol.Object.Event#change:layergroup
  • ol.events.Event#change:outputprojection
  • ol.events.Event#change:layer
  • Mapspace.event:TaskEvent
  • Mapspace.event:ViewerLayerEvent
  • ol.Object.Event#event:change:autoAddNVDBRefToStreetImage
  • ol.Object.Event#event:change:autoLoadFeaturesInWFS
  • ol.Object.Event#event:change:autoSelectStreetImage
  • ol.Object.Event#event:change:autoShowFeaturePanel
  • ol.Object.Event#event:change:auxiliaryLines
  • ol.Object.Event#event:change:brightness
  • ol.Object.Event#event:change:changed
  • ol.Object.Event#event:change:contrast
  • ol.Object.Event#event:change:debugGrid
  • ol.Object.Event#event:change:debugGridColor
  • ol.Object.Event#event:change:debugMode
  • ol.Object.Event#event:change:fOV
  • ol.Object.Event#event:change:layer
  • ol.Object.Event#event:change:maxDistance
  • ol.Object.Event#event:change:yaw
  • ol.events.Event#event:cubicpanoramaadded
  • ol.events.Event#change:imageopened
  • ol.Object.Event#event:change:interactiveTool
  • ol.Object.Event#event:change:name
  • ol.Object.Event#event:change:pitch
  • ol.Object.Event#event:change:roll
  • ol.Object.Event#event:change:size
  • ol.Object.Event#event:change:snapshotOptions
  • ol.Object.Event#event:change:target
  • ol.Object.Event#event:change:time
  • ol.events.Event#event:interactedchanged
  • ol.events.Event#event:layercollectionchanged
  • ol.events.Event#event:layernamechanged
  • ol.events.Event#event:layervisibilitychanged
  • ol.events.Event#event:moveend
  • ol.events.Event#event:rotatorchanged
  • ol.events.Event#event:vieweractivated
  • ol.events.Event#event:viewerdeactivated
  • ol.events.Event#event:visiblechanged

Extends

Members


autorotate :number

Time in milliseconds to wait to start an autorotateTimeout movement if no other movement has been set. If not value then never autorotates.

Source:
mapspace-street/streetviewer.js

debugPanel :Element

Element to show debug info. Do not use directly. Use addDebugData instead.

Source:
mapspace-street/streetviewer.js

extraZoomLevels :number|undefined

This property represents the number of zoom levels to add to existing zoom levels defined in any panorama. In the new zoom levels the tiles will be rescaled.

Source:
mapspace-street/streetviewer.js

initialized :boolean

Source:
mapspace-street/streetviewer.js

showPin :boolean

Inherited From:
Source:
mapspace/viewer.js

showReverseGeocodingLabel :boolean|string

Inherited From:
Source:
mapspace/viewer.js

state :Mapspace.ViewerState

Inherited From:
Source:
mapspace/viewer.js

totalZoomLevels :number|undefined

This property represents the maximum number of zoom levels. Zoom levels defined in any panorama will be redefined to have this number. If this number is greater than the size of the last zoom level defined in the panorama metadata, then the tiles will be shown rescaled.

Source:
mapspace-street/streetviewer.js

viewType :Mapspace.ViewType|undefined

Overrides:
Source:
mapspace-street/streetviewer.js

Methods


addDebugData(group, property, format)

Adds a debug data to the debug panel. If data was previously added then replace the previous value.

Parameters:
Name Type Description
group string

The group the debug data belongs to.

property string

The debug property inside the given group.

format string

Pattern to be filled. The rest of the arguments are the values for filling the pattern. To ouptput a message without any pattern just pass the message in the format param.

Source:
mapspace-street/streetviewer.js

addImagesAsFeatures(images)

Adds an array of images as point features in the panoramas layers.

Parameters:
Name Type Description
images Array.<Mapspace.PanoramaMetadata>

Array of images.

Source:
mapspace-street/streetviewer.js
Returns:

features Array of images.

Type
Array.<ol.Feature>

addInteraction(id, interaction)

Adds a Mapspace.interaction.Interaction to the viewer.

Parameters:
Name Type Description
id string

Identifier of the interaction.

interaction Mapspace.interaction.Interaction

The interaction to add.

Source:
mapspace-street/streetviewer.js

addLayer(layer)

Adds the given layer to the top of this viewer. If you want to add a layer elsewhere in the stack, use getLayers() and the methods available on ol.Collection.

Parameters:
Name Type Description
layer ol.layer.Base

Layer.

Inherited From:
Source:
mapspace/viewer.js

addToSelection(feature, layer)

Adds a feature to selection.

Parameters:
Name Type Description
feature ol.Feature

The feature.

layer Mapspace.layer.Vector

The layer of the feature.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

animate(var_args)

Animate the viewer. The viewer's properties (center, zoom or resolution, rotation and pitch) can be animated for smooth transitions between viewer states. For example, to animate the viewer to a new rotation:

viewer.animate({rotation: viewer.getRotation() + 90.0});

If the property has no sense for a given viewer (some viewers do not have a zoom, resolution or pitch property) then that property is ignored and continues with the rest of the properties. For some viewers like Mapspace.oblique.Viewer, Mapspace.global.Viewer or Mapspace.street.Viewer the center property has no sense to be animated and here it is ignored. This is the list of properties supported for animation in each type of viewer:

For Mapspace.ortho.Viewer: center (2D coords), resolution, zoom, rotation.

For Mapspace.oblique.Viewer: resolution, zoom, rotation.

For Mapspace.global.Viewer: center (2D coords and only if resolutions are always above 7.0 meters per pixel), resolution, zoom, rotation.

For Mapspace.street.Viewer: zoom, rotation, pitch.

For Mapspace.threed.Viewer: center (3D coords), rotation, pitch.

By default, the animation lasts one second and uses in-and-out easing. You can customize this behavior by including duration (in milliseconds) and easing options (see ol.easing).

To chain together multiple animations, call the method with multiple animation objects. For example, to first zoom and then pan:

viewer.animate({zoom: 10}, {center: [0, 0]});

Or to first rotate and then pitch:

viewer.animate({rotation: 45}, {pitch: 15});

If you provide a function as the last argument to the animate method, it will get called at the end of an animation series. The callback will be called with true if the animation series completed on its own or false if it was cancelled.

Animations are cancelled by user interactions (e.g. dragging) or by calling viewer.setCenter(), viewer.setRotation(), viewer.setPitch(), or any method that changes the properties supported in the animation.

Coordinates for the center animations must always be WGS84 lonlat, with fisrt value the longitude, second value the latitude and optionally a third value with heights in meters following the same restrictions that setCenter method has.

Angles must always be in decimal degrees with values following the same restrictions that setRotation and setPitch methods has.

Parameters:
Name Type Argument Description
var_args Mapspace.ViewerAnimationOption | function <repeatable>

Animation options. Multiple animations can be run in series by passing multiple options objects. To run multiple animations in parallel, call the method multiple times. An optional callback can be provided as a final argument. The callback will be called with a boolean indicating whether the animation completed without being cancelled.

Inherited From:
Source:
mapspace/viewer.js

applyOptions(options)

Apply the options to the queue.

Parameters:
Name Type Description
options Mapspace.ViewerLocationOptions | undefined

The options to use.

Source:
mapspace-street/streetviewer.js

cancelAnimations()

Cancel any ongoing animations.

Inherited From:
Source:
mapspace/viewer.js

clearSelection(opt_layer)

Clears the selection.

Parameters:
Name Type Description
opt_layer Mapspace.layer.Vector

An optional layer for clearing only the selection of the layer.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

<abstract> clone()

Clones this viewer reinitializing the new one with main values of current one.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The viewer cloned.

Type
Mapspace.Viewer

executeAnimation(animation, progress)

Executes one animation.

This function can be overriden in inherited viewers for extra functionality.

Parameters:
Name Type Description
animation Mapspace.ViewerAnimation

The animation to execute.

progress number

Progress of the animation from 0 to 1 once applied the easing.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

flashFeature(feature, duration)

Highlights a feature in the viewer using an animation.

Parameters:
Name Type Argument Description
feature ol.Feature

The feature.

duration number <nullable>

The duration of the animation in milliseconds. If not provided the default is 1000.

Source:
mapspace-street/streetviewer.js

forEachFeatureAtPixel(pixel, callback [, options])

Detect features that intersect a pixel on the viewport, and execute a callback with each intersecting feature. Layers included in the detection can be configured through the layerFilter option in options.

Parameters:
Name Type Argument Description
pixel ol.Pixel

Pixel. For Street viewers this pixel coordinate must be a NDC coordinate with origin at center. For the other viewers this is pixel coordinate with origin in top-left corner.

callback function

Feature callback. The callback will be called with four arguments, two required and two optional. The first argument is the feature found at the pixel, the second is the layer of the feature, the third argument is an optional Mapspace.Coordinate of the closest point to mouse in feature found (in local coordinates), and the fourth argument is and optional number with the index of a redefinition point (if the feature has redefinition points). To stop detection, callback functions can return any truthy value.

options olx.AtPixelOptions <optional>

Optional options.

Inherited From:
Overrides:
Source:
mapspace/viewer.js
Returns:

Callback result, i.e. the returned value of last callback execution, or the first truthy callback return value.

Type
T | undefined

getAllImageFeatures()

Returns an array with all current image features in extent of current image.

Source:
mapspace-street/streetviewer.js
Returns:
Type
Array.<ol.Feature>

getAllLoadableVectorLayers()

Returns the array of vector layers that are suitable for a loading of features. These layers are refreshed in each MOVEEND event to load features that exist in the viewer extent. Layers returned are visible layers with a Mapspace.source.ServerVector source.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
Array.<Mapspace.layer.Vector>

getAllowedAuxiliaryLineTools()

Get the array of elements as an auxiliary lines for the crosshair.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The viewer overlay that shows the crosshair auxiliary lines.

Type
boolean

getAnimating()

Determine if the viewer is being animated.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The viewer is being animated.

Type
boolean

getAttributions()

Returns an array of two objects, the first with the ol.Attribution of layers currently visible in the viewer and the second with the same for the layers not visible. It can return null in case of no attributions at all.

Inherited From:
Overrides:
Source:
mapspace/viewer.js
Returns:

Attributions.

Type
Array.<Object.<string, ol.Attribution>>

getAutoAddNVDBRefToStreetImage()

Returns if NVDB road reference must be added to attributes of point features of Street images.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

getAutoLoadFeaturesInWFS()

Returns if features of WFS user vector layers must be loaded automatically after changing the view extent of the viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

getAutoSelectStreetImage()

Returns if point features of Street images must appear as selected when a Street image is opened.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

getAutoShowFeaturePanel()

Returns if a Mapspace.control.SidePanel must be opened after a selection is done in the vector features of the viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

getAuxiliaryLines()

Returns if the auxiliary lines should be visible or not.

Inherited From:
Source:
mapspace/viewer.js
Returns:

If visible or not.

Type
boolean

getBrightness()

Returns the current brightness value of the viewer. Value range in [-100,100].

Source:
mapspace-street/streetviewer.js
Returns:

The brightness.

Type
number

getCenter()

Returns the current Mapspace.Coordinate center of the viewer. This center is the point where the Street image is shot. Coordinates are always in WGS84 latlon, first value in the coordinate is longitude and second latitude, and the third value is the height over ground in meters. Returns null if no center has been set.

Overrides:
Source:
mapspace-street/streetviewer.js
Returns:

The viewer center or null.

Type
Mapspace.Coordinate

getChanged()

Gets if the viewer is changed from the last time it was saved.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

getContrast()

Returns the current contrast value of the viewer. Value range in [-100,100].

Source:
mapspace-street/streetviewer.js
Returns:

The contrast.

Type
number

getCrosshair()

Get the element that serves as a mid crosshair in the viewer, useful for debugging purposes.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The viewer overlay that shows the crosshair.

Type
Element

getCrosshairAuxiliaryLines()

Get the array of elements as an auxiliary lines for the crosshair.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The viewer overlay that shows the crosshair auxiliary lines.

Type
Array.<!Element>

getCurrentLoadableVectorLayers(forceWFSLoad)

Returns a subset of loadable vector layers returned by Mapspace.Viewer#getAllLoadableVectorLayers but taking consideration if layer has a source type Mapspace.source.WFS, the property autoLoadFeaturesInWFS, and if a forceWFSLoad is required.

Parameters:
Name Type Description
forceWFSLoad boolean

If true then the autoLoadFeaturesInWFS property is considered.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
Array.<Mapspace.layer.Vector>

getCurrentPanoramaID(viewIndex)

Gets the current panorama ID for a given Mapspace.street.Viewer identified by its viewIndex inside the workspace layout.

Parameters:
Name Type Description
viewIndex number

The index inside of the workpace layout that identifies the street viewer for which the ID is set.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The ID of the panorama.

Type
string

getDebugGrid()

Returns if the debug grid should be visible or not when debug mode is true.

Inherited From:
Source:
mapspace/viewer.js
Returns:

If visible or not.

Type
boolean

getDebugGridColor()

Gets the color for the debug grid. The color is a CSS color. https://developer.mozilla.org/en-US/docs/Web/CSS/color_value

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
string

getDebugMessage()

Returns a debug message in several paragraphs to include in a div.

Source:
mapspace-street/streetviewer.js
Returns:

Debug message.

Type
string

getDebugMode()

Returns the current debug mode of the viewer. If true then the debug mode is activated. Debug mode is a special mode that show extra information in the viewer of tiles and other tools that are useful when debugging. Initially any viewer uses the global Mapspace.DEBUG property to set if debug mode must be used. The initial value could later be change through this property.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The debug mode.

Type
boolean

getDepthMapVisible()

Gets if the depth map is visible.

Source:
mapspace-street/streetviewer.js
Returns:
Type
boolean

getFeaturesInPickedObjects(objs, layerFilter)

Returns an array of Objects with a feature and layer for each picked object.

Parameters:
Name Type Description
objs Array.<THREE.Object3D>

The array of picked objects.

layerFilter function | undefined

An optional layer filter to search for the features. The filter function will receive one argument, the layer-candidate and it should return a boolean value. Only layers which are visible and for which this function returns true will be tested for features. By default, all visible vector layers will be tested.

Source:
mapspace-street/streetviewer.js
Returns:

Each object has a 'feature' key with the feature and a 'layer' key with the layer the feature belongs to.

Type
Array.<Object>

getFOV()

Returns the current FOV of the viewer in decimal degrees. FOV or Field of View is the angle of the Street image that is currently visible in the viewer, the camera frustum vertical field of view, from bottom to top of view, in degrees. It depends on the size of the viewer and the angular resolution of the current zoom level. Changing this value causes the same effect of changing zoom level but this value gives more grain control. Value range is [0,180].

Source:
mapspace-street/streetviewer.js
Returns:

The viewer vertical FOV.

Type
number

getHFOV()

Returns the current horizontal FOV of the viewer. This is not the same as common vertical FOV, which is main FOV of the viewr. It is the angle of camera frustum from left to right. Value range is [0,180]. Could be higher values but should not be of practical use.

Source:
mapspace-street/streetviewer.js
Returns:

The viewer horizontal FOV.

Type
number

getHints( [opt_hints])

Return the hints of this viewer.

Parameters:
Name Type Argument Description
opt_hints Array.<number> <optional>

Destination array.

Inherited From:
Source:
mapspace/viewer.js
Returns:

Hint.

Type
Array.<number>

getImage()

Returns the current street image. It return null if no image is currently loaded.

Source:
mapspace-street/streetviewer.js
Returns:

The image.

Type
Mapspace.street.Image

getImageHeight()

Returns the height in meters above the ground of the current Mapspace street image or undefined if no image is loaded.

Source:
mapspace-street/streetviewer.js
Returns:

The height in meters.

Type
number | undefined

getImageID()

Returns the image ID of the Mapspace street image currently loaded or null if no image is loaded.

Source:
mapspace-street/streetviewer.js
Returns:

The image ID.

Type
string

getInteracted()

Returns if the viewer is being interacted.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

getInteracting()

Determine if the user is interacting with the viewer, such as panning or zooming.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The viewer is being interacted with.

Type
boolean

getInteraction(id)

Returns the interaction with the given ID or null if not exists.

Parameters:
Name Type Description
id string

ID of the interaction.

Source:
mapspace-street/streetviewer.js
Returns:

The interaction found or null.

Type
Mapspace.interaction.Interaction

getInteractionContainer()

Returns the interaction container.

Source:
mapspace-street/streetviewer.js
Returns:
Type
Element

getInteractions()

Returns the array of interactions.

Source:
mapspace-street/streetviewer.js
Returns:
Type
Array.<Mapspace.interaction.Interaction>

getInteractiveTool()

Returns the current interactive tool that is active. If it is null then the basic pan & zoom interactions are active.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The tool.

Type
Mapspace.InteractiveToolNames

getInteractiveToolControl()

Returns the current control that activated the current interactive tool if any is activated. If current interactive tool is null then the control is the control that deactivated the tool. If null that means that no interactive tool has been selected.

This value is important in cases where several controls contains the exactly same interactive tool.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The control.

Type
Mapspace.control.Control

getIsActive()

Gets if the viewer is active.

Inherited From:
Source:
mapspace/viewer.js

getLastAddressInfo()

Returns the last address information obtained in an address search or geocoding action. If no one has been executed returns an empy object.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
Mapspace.geocoding.Result

getLastCenterOffset()

Returns the center offset since the last Mapspace.ViewerEventType.MOVESTART event. Values are WGS84 longitude, latitude and height offsets, the first longitude offset, the second latitude, and the third height offset in meters. The third value could be not exist in certain viewers. Returns null if no offset was found.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The center offset.

Type
Array.<number>

getLayer()

Get the layer used in the viewer. The layer property is a filter for sets of images when requesting for panoramas.

Source:
mapspace-street/streetviewer.js
Returns:

A layer for this viewer.

Type
string

getLayerExtentToUpdate(layer, maxSize)

Returns the extent that the given vector layer needs to load when loadFeatures is invoked in the source. It can be null in some viewers. The extent is returned in Mercator Spheric coordinates.

Parameters:
Name Type Argument Description
layer Mapspace.layer.Vector <nullable>

Optional layer. If not present the extent will be the same for any layer. Some viewers require a layer.

maxSize number <nullable>

Optional maximum size in meters. Maximum size is clamped to a maximum value of 2000 m.

Inherited From:
Overrides:
Source:
mapspace/viewer.js
Returns:

The extent.

Type
Mapspace.Extent

getLayerForSelectedFeature(feature)

Returns the associated vectorlayer of a selected feature.

Parameters:
Name Type Description
feature ol.Feature | ol.render.Feature

Feature

Inherited From:
Source:
mapspace/viewer.js
Returns:

Layer or undefined if the feature is not selected.

Type
Mapspace.layer.Vector

getLayerGroup()

Get the layergroup associated with this viewer.

Inherited From:
Overrides:
Source:
mapspace/viewer.js
Returns:

A layer group containing the layers in this viewer.

Type
ol.layer.Group

getLayers()

Get the collection of layers associated with this viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:

Layers.

Type
ol.Collection.<ol.layer.Base>

getLayersArray()

Get the array of layers associated with this viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
Array.<ol.layer.Base>

getMaxDistance()

Returns the current maximum distance value of the viewer. Value range in [10,100] in meters. Vector objects that are far from this distance are not requested and shown.

Source:
mapspace-street/streetviewer.js
Returns:

The maximum distance.

Type
number

getMaxZoom()

Returns the maximum zoom of the viewer.

Source:
mapspace-street/streetviewer.js
Returns:

The maximum zoom of the viewer.

Type
number

getMinZoom()

Returns the minimum zoom of the viewer.

Source:
mapspace-street/streetviewer.js
Returns:

The minimum zoom of the viewer.

Type
number

getModelTypeFromProjectName(item)

Returns the model type (street, indoor or drone) to which the item passed belongs. Returns null if model type cannot be found.

Parameters:
Name Type Description
item string | Mapspace.street.Image | ol.Feature

Item.

Source:
mapspace-street/streetviewer.js
Returns:
Type
Mapspace.Viewer360ModelType

getName()

Returns the current name of the viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The name.

Type
string

getNDCEventPixel(event)

Returns the NDC pixel position (Normalized Device Coordinates) for a browser event relative to the viewport.

Parameters:
Name Type Description
event Event

Event.

Source:
mapspace-street/streetviewer.js
Returns:

NDC pixel as two values x and y.

Type
Array.<number>

getNearImageFeatures(options, errors)

Returns the image features that candidates to be used, either for opening them or for using them in redefinition of geometries drawn.

Parameters:
Name Type Argument Description
options Object <nullable>

Options.

Properties
Name Type Argument Description
center Mapspace.Coordinate <optional>

Coordinates to calculate distance (lon lat WGS84). If not passed then center of current image is used.

features Array.<ol.Feature> <optional>

Input features to search. If not passed then all features in current image extent are used.

numImages number <optional>

Max number of images to return. Default is 1.

included boolean <optional>

Optional boolean to include current image or not. Default is true.

coord Mapspace.Coordinate <nullable>

Optional local coordinate of a point to filter near images. This point represents a ray direction from the Street image point of capture that filters the images to only those close to that ray. If not set then all surrounding images will be used in the filter. If set to a value then only images close to the given direction will be returned.

byTime boolean <optional>

Optional boolean indicating if filter images closest in time instead of using filtering by distance, that is the default. If true then the coord param is ignored. By default is false and images are returned by distance.

firstUnderTolerance boolean <optional>

Optional boolean indicating if only first image must be returned when first is under a tolerance distance of 50 cm. By default is true.

errors Array.<string> <nullable>

Optional array of errors in which store errors.

Source:
mapspace-street/streetviewer.js
Returns:

If numImages is 1 then returns a feature or null, otherwise returns an array.

Type
Array.<ol.Feature> | ol.Feature

getOutputProjection()

Gets the viewer output projection. The 'EPSG:code' string with the projection to use in any control linked to this viewer when showing coordinates.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
string | undefined

getOverlayContainerStopEvent()

Get the element that serves as a container for overlays that don't allow event propagation. Elements added to this container won't let mousedown and touchstart events through to the viewer, so clicks and gestures on an overlay don't trigger any event.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The viewer's overlay container that stops events.

Type
Element

getPitch()

Returns the current pitch value of the viewer in decimal degrees. Valid range is [-90, 90]. When pitch value is 0 the viewer is aligned with horizon, -90 value is the highest angle we can target of the image and 90 is the lowest.

Source:
mapspace-street/streetviewer.js
Returns:

The pitch value of the viewer. Range is [-90,90].

Type
number

getRedefinitionFeature()

Gets the redefinition feature. This feature is shown with a different style with labels in the vertices. There can only be one redefinition feature at a time. Returns null if no feature is in redefinition mode.

Source:
mapspace-street/streetviewer.js
Returns:
Type
ol.Feature

getRoll()

Returns the current roll value of the viewer in decimal degrees. Valid range is [-180, 180]. This value has no sense in normal displays, where always be zero, but has some of sense in VR/AR displays where head can roll even to 180 degrees (very unsual but possible). When roll value is 0 the viewer is aligned with horizon, -180/180 is upside down.

Source:
mapspace-street/streetviewer.js
Returns:

The roll value of the viewer. Range is [-180,180].

Type
number

getRotation()

Returns the rotation of the viewer. When it is zero the viewer has the north in the upward direction. This rotation rotates the viewer clockwise, so 90.0 means rotate 90.0 degrees clockwise so west is upward, and so on. The valid range is [0, 360). Returns null if no rotation has been set.

Inherited From:
Overrides:
Source:
mapspace/viewer.js
Returns:

The rotation of the viewer in decimal degrees or null.

Type
number

getRotatorType()

Gets the rotator type.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
Mapspace.control.RotatorType

getSelectedFeatures(opt_layer)

Returns the array of current selected features.

Parameters:
Name Type Argument Description
opt_layer Mapspace.layer.Vector <nullable>

An optional layer for returning only the selected features in that layer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
Array.<ol.Feature>

getSerializableCenter()

Returns the center that can be serialized. As the viewer do not returns a valid center in getCenter until the viewer has been initialized through the use of the target property, this function returns the center set in the options for the case the viewer is created but not initialized. Coordinates are always in WGS84 latlon, first value in the coordinate is longitude and second latitude.

Source:
mapspace-street/streetviewer.js
Returns:

The serializable center or undefined if no one is set through options or through initialization.

Type
Mapspace.Coordinate | undefined

getSerializableLayersArray()

Get the array of layers associated with this viewer that are serializable. Some layers in this viewer are managed by the viewer and this function do not return them from the list of current layers.

Source:
mapspace-street/streetviewer.js
Returns:
Type
Array.<ol.layer.Base>

getSize()

Get the size of this viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The size in pixels of the viewer in the DOM.

Type
Mapspace.Size | undefined

getSnapshotOptions()

Returns the current snapshot options of the viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The options.

Type
Array.<string>

getState()

Return the viewer state.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
Mapspace.ViewerState

getTarget()

Get the target in which the viewer is rendered. Note that this returns what is entered as an option or in setTarget: if that was an element, it returns an element; if a string, it returns that.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The Element or id of the Element that the viewer is rendered in.

Type
Element | string | undefined

getTargetElement()

Get the DOM element into which this viewer is rendered. In contrast to getTarget this method always return an Element, or null if the viewer has no target.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The element that the viewer is rendered in.

Type
Element

getTime()

Returns the current time filter of the viewer. Valid time values are any string like *, YYYYMMDD, YYYYMMDD-* or YYYYMMDD-YYYYMMDD. Asterisk means that that maximum date is the maximum possible date (the latest date of current year). YYYYMMDD filters images before the date, and the other patterns filter images between the dates. In the YYYYMMDD pattern both MM and DD can be omitted. If only one date is provided YYYYMM means the last day of given month and YYYY means last day of year. If two dates are provided the fisrt one means the first day of month or year and the second the last day. For example:

    • = 20231231 (if current year is 2023), 20241231 (if is 2024) and so on
  • 2016 = 20161231
  • 201611 = 20161130
  • 2016-* = 20160101-20231231 (if current year is 2023) and so on
  • 2016-2017 = 20160101-20171231
  • 201605-2017 = 20160501-20171231
Inherited From:
Source:
mapspace/viewer.js
Returns:

The time string.

Type
string

getTimestamp()

Return an object that can be compared between frames to check idleness.

Inherited From:
Overrides:
Source:
mapspace/viewer.js
Returns:
Type
Object

getUnits()

Gets the viewer units. The units to use in any control linked to this viewer when showing measurements but not coordinates.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
ol.proj.Units | undefined

getUpdatableVectorLayers()

Returns the array of vector layers that are suitable for an update of features. These layers are refreshed in each MOVEEND event to obtain the final version of objects that are rendered in the viewers.

Inherited From:
Overrides:
Source:
mapspace/viewer.js
Returns:
Type
Array.<Mapspace.layer.Vector>

getUsePanoramas()

Returns if this viewer must use panoramas. If true a vector layer rendering panoramas will be shown on top and interactions with the layer will trigger a search for near panoramas.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The value of the property.

Type
boolean

getVectorLayers()

Returns the array of vector layers that are in current viewer, including layers inside groups.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
Array.<Mapspace.layer.Vector>

getViewport()

Return the viewport of the viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The viewport.

Type
Element

getViewType()

Return the type of the viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The viewer type.

Type
Mapspace.ViewType

getYaw()

Returns the current yaw value of the viewer in decimal degrees. Valid range is [-180, 180]. When yaw value is 0 the viewer is aligned with the vehicle direction. Yaw and rotation are related by the directionYaw value that all panorama images has as metadata. directionYaw is the angle between north and vehicle direction.

Source:
mapspace-street/streetviewer.js
Returns:

The yaw value of the viewer. Range is [-180, 180].

Type
number

getZoom()

Get the zoom level or undefined if not found.

Source:
mapspace-street/streetviewer.js
Returns:
Type
number | undefined

<protected> handleLayerGroupChanged(evt)

Handles the change of the reference in the layerGroup.

Parameters:
Name Type Description
evt ol.Object.Event

The event.

Inherited From:
Source:
mapspace/viewer.js

<protected> handleLayersAdd(evt)

Handles the addition of a new layer in the layerGroup, adding listeners for it.

Parameters:
Name Type Description
evt ol.Collection.Event

The event.

Inherited From:
Source:
mapspace/viewer.js

<abstract> handleLayersChanged(evt)

Handles the change of the reference in the 'layers' property of the layerGroup.

Parameters:
Name Type Description
evt ol.Object.Event

The event.

Inherited From:
Source:
mapspace/viewer.js

<protected> handleLayersRemove(evt)

Handles the deletion of a layer in the layerGroup, removing listeners for it.

Parameters:
Name Type Description
evt ol.Collection.Event

The event.

Inherited From:
Source:
mapspace/viewer.js

handleSingleClick(evt)

Handles single clicks (not any pair of clicks or double clicks).

Parameters:
Name Type Description
evt Object

Event object. It is different object for each type of viewer.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

is2DViewer()

Return true if current viewer of the action is a 2D viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

is3DViewer()

Return true if current viewer of the action is a 3D viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

isFeatureSelectable(feature, layer)

Returns true if the feature can be selected.

Parameters:
Name Type Description
feature ol.Feature

The feature.

layer Mapspace.layer.Vector

The layer of the feature.

Inherited From:
Overrides:
Source:
mapspace/viewer.js
Returns:
Type
boolean

isFeatureSelected(feature, opt_layer)

Returns true if the feature passed is selected.

Parameters:
Name Type Argument Description
feature ol.Feature

The feature.

opt_layer Mapspace.layer.Vector <nullable>

The layer of the feature. This is optional. If provided the search of the feature is faster.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

isGlobalViewer()

Return true if current viewer of the action is a Mapspace.global.Viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

isObliqueViewer()

Return true if current viewer of the action is a Mapspace.oblique.Viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

isObliqueViewerVisible()

Return true if current viewer of the action is a Mapspace.oblique.Viewer or a Mapspace.global.Viewer in Oblique mode.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

isOrthoViewer()

Return true if current viewer of the action is a Mapspace.ortho.Viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

isOrthoViewerVisible()

Return true if current viewer of the action is a Mapspace.ortho.Viewer or a Mapspace.global.Viewer in Ortho mode.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

isProfile3dViewer()

Return true if current viewer of the action is a Mapspace.profile3d.Viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

isRemovableLayer(layer)

Returns if layer is removable in this viewer.

Removable layers include:

  1. Any removable layer as defined in Mapspace.Viewer#isRemovableLayer.
Parameters:
Name Type Description
layer ol.layer.Base

Layer to check.

Overrides:
Source:
mapspace-street/streetviewer.js
Returns:
Type
boolean

isStreetViewer()

Return true if current viewer of the action is a Mapspace.street.Viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

isTableViewer()

Return true if current viewer of the action is a Mapspace.table.Viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

isThreedViewer()

Return true if current viewer of the action is a Mapspace.threed.Viewer.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

isVisible()

Gets if the viewer is visible or not.

Inherited From:
Source:
mapspace/viewer.js
Returns:
Type
boolean

listenLayer(layer)

Adds listeners for a given layer.

Parameters:
Name Type Description
layer ol.layer.Base

The layer.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

moveLayerDown(index)

Moves down a layer given by index so now position is index - 1.

Parameters:
Name Type Description
index number

Index of layer to move. Layers inside a layer group cannot be moved, only the full layer group can be moved.

Inherited From:
Source:
mapspace/viewer.js
Returns:

If layer is moved or not.

Type
boolean

moveLayerUp(index)

Moves up a layer given by index so now position is index + 1.

Parameters:
Name Type Description
index number

Index of layer to move. Layers inside a layer group cannot be moved, only the full layer group can be moved.

Inherited From:
Source:
mapspace/viewer.js
Returns:

If layer is moved or not.

Type
boolean

notifyAddressInfoRetrieved(address, copyAddress, htmlAddress, geocodingType [, coordinate])

Triggers a Mapspace.AddressInfoEvent event notifying that this viewer has retrieved an address information from a geocoding search or reverse geocoding.

Parameters:
Name Type Argument Description
address string

The address information.

copyAddress string

The address information formatted to be copied to clipboard.

htmlAddress string

The address information formatted as HTML content.

geocodingType Mapspace.GecodingType

Type of geocoding action.

coordinate Mapspace.Coordinate <optional>

An optional coordinate (in local projection) used to overlay a point icon in any viewer. Projection of the coordinate is different for each type of viewer:

  • Ortho viewer or Global viewer in ortho mode: Mercator Spheric
  • Oblique viewer or Global viewer in oblique mode: local projection of oblique
  • Street viewer: local projection of the image
  • 3D viewer: lonlat
Inherited From:
Source:
mapspace/viewer.js

notifyLayerChanged(type, opt_layer, opt_features, opt_shiftPressed)

Triggers a Mapspace.ViewerLayerEvent event notifying that something in the layer has changed (in all the layer or some features).

Parameters:
Name Type Argument Description
type Mapspace.ViewerLayerEventType

The type of change.

opt_layer Mapspace.layer.Vector <nullable>

An optional layer that has changed or contains vector features that has changed. It can be undefined when vector features has changed but they are not inside any layer (for example, temporary vector features).

opt_features Array.<ol.Feature> | undefined

An optional array (only for vector layers) with the list of features that have changed. If no array is provided and the layer is a vector layer that means all the features in the layer have changed.

opt_shiftPressed boolean <nullable>

Indicates if shift key is pressed.

Inherited From:
Source:
mapspace/viewer.js

notifySelection()

Checks if any selection has changed in layers and then save and notifies the changes. This is where selection is saved and must be called after changes made to the selection through 'addToSelection', 'removeFromSelection', 'clearSelection' and 'selectAll'.

Inherited From:
Source:
mapspace/viewer.js

notifyTaskEnd(id [, title] [, message] [, type])

Triggers a Mapspace.TaskEvent event notifying that the long task identified by ID has ended successfully.

Parameters:
Name Type Argument Description
id number

Unique number that identifies the task.

title string <optional>

Optional title or title globalization subkey for the control Mapspace.control.Notifier or any other control consuming the event triggered.

message string <optional>

Optional message or message globalization subkey for the control Mapspace.control.Notifier or any other control consuming the event triggered.

type Mapspace.NotificationType <optional>

Optional type of notification. By default is ERROR but can be changed to other type if needed.

Inherited From:
Source:
mapspace/viewer.js

notifyTaskError(id [, title] [, message] [, type])

Triggers a Mapspace.TaskEvent event notifying that the long task identified by ID has ended with an error.

Parameters:
Name Type Argument Description
id number

Unique number that identifies the task.

title string <optional>

Optional title or title globalization subkey for the control Mapspace.control.Notifier or any other control consuming the event triggered.

message string <optional>

Optional message or message globalization subkey for the control Mapspace.control.Notifier or any other control consuming the event triggered.

type Mapspace.NotificationType <optional>

Optional type of notification. By default is ERROR but can be changed to other type if needed.

Inherited From:
Source:
mapspace/viewer.js

notifyTaskProgress(id [, title] [, message] [, progress])

Triggers a Mapspace.TaskEvent event notifying that a long task identified by ID has progressed.

Parameters:
Name Type Argument Description
id number

Unique number that identifies the task.

title string <optional>

Optional title or title globalization subkey for the control Mapspace.control.Notifier or any other control consuming the event triggered.

message string <optional>

Optional message or message globalization subkey for the control Mapspace.control.Notifier or any other control consuming the event triggered.

progress number <optional>

Optional percentage progress of the task. Default is 0.

Inherited From:
Source:
mapspace/viewer.js

notifyTaskStart(id, title, message [, progress])

Triggers a Mapspace.TaskEvent event notifying that a long task has started.

Parameters:
Name Type Argument Description
id number

Unique number that identifies the task.

title string

Title or title globalization subkey for the control Mapspace.control.Notifier or any other control consuming the event triggered.

message string

Message or message globalization subkey for the control Mapspace.control.Notifier or any other control consuming the event triggered.

progress number <optional>

Optional percentage progress of the task. Default is 0.

Inherited From:
Source:
mapspace/viewer.js

notifyViewerActivated()

Triggers a ol.events.Event event notifying that a viewer has been activated.

Inherited From:
Source:
mapspace/viewer.js

notifyViewerDeactivated()

Triggers a ol.events.Event event notifying that a viewer has been deactivated.

Inherited From:
Source:
mapspace/viewer.js

notifyVisibleChanged()

Triggers a ol.events.Event event notifying that visibility of the viewer has changed.

Inherited From:
Source:
mapspace/viewer.js

openImage(image)

Opens image.

Parameters:
Name Type Argument Description
image Mapspace.street.Image <nullable>

The street image or null to clean the viewer.

Source:
mapspace-street/streetviewer.js

overwriteFeature(layer, origin, target)

Modifies the target feature overwriting its values with values from origin. Values that are in target feature but not in origin will be removed. Values like Mapspace.OBLIQUE_GEOMETRY_NAME or Mapspace.STREET_GEOMETRY_NAME that contain the objects to show in Oblique and Streeet viewers are updated. The overwrite is executed in silent mode to avoid feature events on each change except for Mapspace.GEOMETRY_NAME value that no silent mode is used to force Rtree update.

Parameters:
Name Type Description
layer Mapspace.layer.Vector

The layer.

origin ol.Feature

The origin feature.

target ol.Feature

The target feature. This feature must be contained in layer and it is not checked.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

removeFromSelection(feature)

Removes a feature from selection.

Parameters:
Name Type Description
feature ol.Feature

The feature.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

removeInteraction(interaction)

Removes a Mapspace.interaction.Interaction from the viewer.

Parameters:
Name Type Description
interaction string | Mapspace.interaction.Interaction

Identifier of the interaction or interaction object to be removed.

Source:
mapspace-street/streetviewer.js

removeLayer(layer)

Removes the given layer from this viewer.

Parameters:
Name Type Description
layer ol.layer.Base

Layer.

Inherited From:
Source:
mapspace/viewer.js
Returns:

The removed layer (or undefined if the layer was not found).

Type
ol.layer.Base | undefined

render()

Renders the viewer.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

renderFeature(layer, feature)

Forces a render of a feature. This updates special geometries of the feature in some viewers and refresh it in the viewer to render correctly.

Parameters:
Name Type Description
layer Mapspace.layer.Vector

The layer.

feature ol.Feature

The feature.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

resetAnnotationLabels()

Resets all annotations labels, removing them and adding them again.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

resetMeasurementLabels()

Resets all measurement labels, removing them and adding them again.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

resetSyncOffset()

Resets the offset used to synchronize this viewer with others using center offsets instead of absolute coordinates.

Inherited From:
Source:
mapspace/viewer.js

<abstract> restartInteractions()

Restarts interactions to the latest state when they were stopped. If no previous stop was called then this does nothing.

Inherited From:
Source:
mapspace/viewer.js

selectAll(opt_layer)

Selects all features.

Parameters:
Name Type Description
opt_layer Mapspace.layer.Vector

An optional layer for selecting only all the features of the layer.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

setAnimationValues(animation, type, target)

Sets tha values for a Mapspace.ViewerAnimation object of the given type and with the given source and target values.

Parameters:
Name Type Description
animation Mapspace.ViewerAnimation

The animation object.

type Mapspace.ViewerAnimationProperty

Type of animation property.

target Mapspace.Coordinate | number

The target value for the property to be animated.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

setAutoAddNVDBRefToStreetImage(autoAdd)

Sets if NVDB road reference must be added to attributes of point features of Street images.

Parameters:
Name Type Description
autoAdd boolean

If true NVDB road reference is added to attributes of point features of Street images.

Inherited From:
Source:
mapspace/viewer.js

setAutoLoadFeaturesInWFS(autoLoad)

Sets if features of WFS user vector layers must be loaded automatically after changing the view extent of the viewer.

Parameters:
Name Type Description
autoLoad boolean

If true new features are automatically requested each time the viewer changes the view extent after a user interaction or a sync in the viewer with other viewers. If false features are only loaded when explicitly calling Mapspace.source.WFS#loadFeatures.

Inherited From:
Source:
mapspace/viewer.js

setAutoSelectStreetImage(autoSelect)

Sets if point features of Street images must appear as selected when a Street image is opened.

Parameters:
Name Type Description
autoSelect boolean

If true point features of Street images will appear as selected when a Street image is opened.

Inherited From:
Source:
mapspace/viewer.js

setAutoShowFeaturePanel(autoShow)

Sets if a Mapspace.control.SidePanel must be opened after a selection is done in the vector features of the viewer.

Parameters:
Name Type Description
autoShow boolean

If true a Mapspace.control.SidePanel must be opened after a selection is done in the vector features of the viewer.

Inherited From:
Source:
mapspace/viewer.js

setAuxiliaryLines(visible)

Sets if the auxiliary lines should be visible or not.

Parameters:
Name Type Description
visible boolean

If visible or not.

Inherited From:
Source:
mapspace/viewer.js

setBrightness(brightness)

Sets the current brightness value of the viewer. Value range in [-100,100].

Parameters:
Name Type Description
brightness number

The brightness.

Source:
mapspace-street/streetviewer.js

setCenter(center, callback)

Sets the current Mapspace.Coordinate center of the viewer. If this center do not matches the point where a Street image was shot then the neareast shotpoint is searched and that is the final center set. Coordinates are always in WGS84 latlon, first value in the coordinate is longitude and second latitude. There is no need to set the third coordinate and it is set after the search for the image.

Parameters:
Name Type Description
center Mapspace.Coordinate

The viewer center.

callback function | undefined

An optional function to call when centering ends.

Overrides:
Source:
mapspace-street/streetviewer.js

setCenterOffset(offset)

Sets an offset in the center. First value must be a longitude offset in degrees, second a latitude offset in degrees, both in WGS84. Optionally a third value can be added with a height offset in meters.

Parameters:
Name Type Description
offset Array.<number>

Center offset.

Inherited From:
Source:
mapspace/viewer.js

setChanged(changed)

Sets if the viewer is changed or not.

Parameters:
Name Type Description
changed boolean

If the viewer has changed or not.

Inherited From:
Source:
mapspace/viewer.js

setContrast(contrast)

Sets the current contrast value of the viewer. Value range in [-100,100].

Parameters:
Name Type Description
contrast number

The contrast.

Source:
mapspace-street/streetviewer.js

setCrosshairAuxiliaryLinesVisibility(visible)

Set the crosshair auxiliary lines visibility.

Parameters:
Name Type Description
visible boolean

If visible or not.

Inherited From:
Source:
mapspace/viewer.js

setCrosshairVisibility(visible)

Sets the crosshair visibility.

Parameters:
Name Type Description
visible boolean

If visible or not.

Inherited From:
Source:
mapspace/viewer.js

setCurrentPanoramaID(viewIndex, id)

Sets the current panorama ID for a given Mapspace.street.Viewer identified by its viewIndex inside the workspace layout. When this value is set if a Mapspace.layer.Panoramas is used inside the viewer it will show the current panorama in a highlighted color.

Parameters:
Name Type Argument Description
viewIndex number

The index inside of the workpace layout that identifies the street viewer for which the ID is set.

id string <nullable>

The ID of the panorama or null if no panorama is opened.

Inherited From:
Source:
mapspace/viewer.js

setDebugGrid(visible)

Sets if the debug grid should be visible or not when debug mode is true.

Parameters:
Name Type Description
visible boolean

If visible or not.

Inherited From:
Source:
mapspace/viewer.js

setDebugGridColor(color)

Sets the color of the debug grid. The color is a CSS color. https://developer.mozilla.org/en-US/docs/Web/CSS/color_value

Parameters:
Name Type Description
color string

The color as a CSS color.

Inherited From:
Source:
mapspace/viewer.js

setDebugMode(debugmode)

Sets the debug mode of the viewer. If true then the debug mode is activated. Debug mode is a special mode that show extra information in the viewer of tiles and other tools that are useful when debugging. Initially any viewer uses the global Mapspace.DEBUG property to set if debug mode must be used. The initial value could later be change through this property.

Parameters:
Name Type Description
debugmode boolean

The debug mode.

Inherited From:
Source:
mapspace/viewer.js

setDepthMapVisible(status)

Sets if the depth map must be visible or not.

Parameters:
Name Type Description
status boolean

The depth map status.

Source:
mapspace-street/streetviewer.js

setFOV(fov)

Sets the current FOV of the viewer in decimal degrees. FOV or Field of View is the angle of the Street image that is currently visible in the viewer, the camera frustum vertical field of view, from bottom to top of view, in degrees. It depends on the size of the viewer and the angular resolution of the current zoom level. Changing this value causes the same effect of changing zoom level but this value gives more grain control. Value range is [0,180].

Parameters:
Name Type Description
fov number

The viewer vertical FOV.

Source:
mapspace-street/streetviewer.js

setImageID(imageid, callback)

Sets the image ID of the Mapspace street image to be shown.

Parameters:
Name Type Description
imageid string

The image ID.

callback function | undefined

An optional function to call when the load of the image ends.

Source:
mapspace-street/streetviewer.js

setInteracted(interacted)

Sets if the viewer is being interacted. This function must be called from controls and interaction objects in order to make synchronization work fine.

Parameters:
Name Type Description
interacted boolean
Inherited From:
Source:
mapspace/viewer.js

setInteractiveTool(tool [, opt_control])

Sets the current interactive tool that is active. If it is null then the basic pan & zoom interactions are active. If it is a valid Mapspace.InteractiveToolNames then the tool is activated in the control that contains that tool and the appropiate interactions are activated.

Parameters:
Name Type Argument Description
tool Mapspace.InteractiveToolNames <nullable>

The tool.

opt_control Mapspace.control.Control <optional>

An optional control that has activated the interactive tool. This param is important in cases where several controls contains the exactly same interactive tool.

Inherited From:
Source:
mapspace/viewer.js

setIsActive(isActive)

Sets if the viewer is active.

Parameters:
Name Type Description
isActive boolean

True or false

Inherited From:
Source:
mapspace/viewer.js

setLayer(layerGroup)

Sets the layer of the viewer. The layer property is a filter for sets of images when requesting for panoramas.

Parameters:
Name Type Description
layerGroup string

A layer for the viewer.

Source:
mapspace-street/streetviewer.js

setLayerGroup(layerGroup)

Sets the layergroup of the viewer. The viewer can alter this object adding extra layers needed by the viewer if that layers are not found.

Parameters:
Name Type Description
layerGroup ol.layer.Group

A layer group containing the layers for the viewer.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

setMaxDistance(maxDistance)

Sets the current maximum distance value of the viewer. Value range in [10,100] in meters. Vector objects that are far from this distance are not requested and shown.

Parameters:
Name Type Description
maxDistance number

The maximum distance.

Source:
mapspace-street/streetviewer.js

setName(name)

Sets the current name of the viewer.

Parameters:
Name Type Description
name string

The name.

Inherited From:
Source:
mapspace/viewer.js

setOutputProjection(outputProjection)

Sets the viewer output projection.

Parameters:
Name Type Description
outputProjection string | undefined

The 'EPSG:code' string with the projection to use in any control linked to this viewer when showing coordinates.

Inherited From:
Source:
mapspace/viewer.js

setOverlaysSyncingHandlers(handler)

Sets the listeners to the events of the viewer that will cause overlays in synced viewers to be updated.

Parameters:
Name Type Description
handler function

The handler that will manage the events.

Inherited From:
Overrides:
Source:
mapspace/viewer.js
Returns:

Array of key listeners for later easy disposal.

Type
Array.<ol.EventsKey>

setPitch(pitch)

Sets the current pitch value of the viewer in decimal degrees. Valid range is [-90, 90] for normal displays and [-180,180] for VR/AR displays. When pitch value is 0 the viewer is aligned with horizon, -90 value is the highest angle we can target of the image and 90 is the lowest.

Parameters:
Name Type Description
pitch number

The pitch value.

Source:
mapspace-street/streetviewer.js

setRedefinitionFeature(feature, layer)

Sets the redefinition feature. This feature is shown with a different style with labels in the vertices. There can only be one redefinition feature at a time. To unset it pass a null value. The feature is rest to null whenever the image of the viewer changes.

Parameters:
Name Type Argument Description
feature ol.Feature <nullable>

Feature.

layer Mapspace.layer.Vector <nullable>

Layer that contains the feature.

Source:
mapspace-street/streetviewer.js

setResizeListening(listen)

Adds or remove resize events listening for the viewer.

Parameters:
Name Type Description
listen boolean

If true listening of resize events is activated; if false deactivated.

Inherited From:
Source:
mapspace/viewer.js

setRoll()

Sets the current roll value of the viewer in decimal degrees. Valid range is [-180, 180]. This value has no sense in normal displays, where always be zero, but has some of sense in VR/AR displays where head can roll even to 180 degrees (very unsual but possible). When roll value is 0 the viewer is aligned with horizon, -180/180 is upside down.

Source:
mapspace-street/streetviewer.js
Returns:

The roll value.

Type
number

setRotation(rotation)

Sets the rotation of the viewer. When it is zero the viewer has the north in the upward direction. This rotation rotates the viewer clockwise, so 90.0 means rotate 90.0 degrees clockwise so west is upward, and so on. The valid range is [0, 360).

Parameters:
Name Type Description
rotation number

The rotation of the viewer in decimal degrees.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

setRotatorType(rotatorType)

Sets the rotator type.

Parameters:
Name Type Description
rotatorType Mapspace.control.RotatorType

Rotator type,

Inherited From:
Source:
mapspace/viewer.js

setSize(size)

Set the size of this viewer.

Parameters:
Name Type Description
size Mapspace.Size | undefined

The size in pixels of the viewer in the DOM.

Inherited From:
Source:
mapspace/viewer.js

setSnapshotOptions(options)

Sets the current snapshot options of the viewer.

Parameters:
Name Type Argument Description
options Array.<string> <nullable>

The snapshot options.

Inherited From:
Source:
mapspace/viewer.js

setState(state)

Sets the state of the viewer.

Parameters:
Name Type Description
state Mapspace.ViewerState

The new state for the viewer.

Inherited From:
Source:
mapspace/viewer.js

setTarget(target)

Set the target element to render this viewer into.

Parameters:
Name Type Description
target Element | string | undefined

The Element or id of the Element that the viewer is rendered in.

Inherited From:
Source:
mapspace/viewer.js

setTime(time)

Sets the current time filter of the viewer. Valid time values are any string like *, YYYYMMDD, YYYYMMDD-* or YYYYMMDD-YYYYMMDD. Asterisk means that that maximum date is the maximum possible date (the latest date of current year). YYYYMMDD filters images before the date, and the other patterns filter images between the dates. In the YYYYMMDD pattern both MM and DD can be omitted. If only one date is provided YYYYMM means the last day of given month and YYYY means last day of year. If two dates are provided the fisrt one means the first day of month or year and the second the last day. For example:

    • = 20231231 (if current year is 2023), 20241231 (if is 2024) and so on
  • 2016 = 20161231
  • 201611 = 20161130
  • 2016-* = 20160101-20231231 (if current year is 2023) and so on
  • 2016-2017 = 20160101-20171231
  • 201605-2017 = 20160501-20171231
Parameters:
Name Type Description
time string

The time string.

Inherited From:
Source:
mapspace/viewer.js

setUnits(units)

Sets the viewer units.

Parameters:
Name Type Description
units ol.proj.Units | undefined

The units to use in any control linked to this viewer when showing measurements but not coordinates.

Inherited From:
Source:
mapspace/viewer.js

setUsePanoramas(use)

Sets if this viewer must use panoramas. If true a vector layer rendering panoramas will be shown on top and interactions with the layer will trigger a search for near panoramas.

Parameters:
Name Type Description
use boolean

The value of the property.

Inherited From:
Source:
mapspace/viewer.js

setUserLayer(userLayer)

Sets the user layer for the Mapspace street image.

Parameters:
Name Type Description
userLayer Mapspace.UserLayer

The user layer definition.

Source:
mapspace-street/streetviewer.js

setYaw(yaw)

Sets the current yaw value of the viewer in decimal degrees. Valid range is [-180, 180] When yaw value is 0 the viewer is aligned with the vehicle direction. Yaw and rotation are related by the directionYaw value that all panorama images has as metadata. directionYaw is the angle between north and vehicle direction.

Parameters:
Name Type Description
yaw number

The viewer yaw.

Source:
mapspace-street/streetviewer.js

setZoom(zoom)

Sets the zoom of the viewer.

Parameters:
Name Type Description
zoom number

Zoom

Source:
mapspace-street/streetviewer.js

setZoomTo(objToZoom, options)

Sets the zoom and center of the viewer to cover the given object (a layer, an array of features, or an extent). If it is an array of features them must be in Mercator projection. If is is an extent it must be in Mercator projection.

Parameters:
Name Type Description
objToZoom Mapspace.layer.Vector | Array.<ol.Feature> | Mapspace.Extent

The object to zoom to.

options olx.view.FitOptions | undefined

Optional options.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

showPinsAndLabels()

Shows the pins and labels (if set in the options).

Inherited From:
Overrides:
Source:
mapspace/viewer.js

<abstract> stopInteractions()

Stops the interactions saving its status for a later restart use.

Inherited From:
Source:
mapspace/viewer.js

syncWithViewer(viewer, syncProperties)

Synchronizes this viewer with another one knowing its sync options.

Parameters:
Name Type Description
viewer Mapspace.Viewer

The viewer to sync with.

syncProperties Mapspace.SyncProperties

The syncing properties.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

transformCenter()

Returns a Promise that transform the current coordinates of the viewer center.

Inherited From:
Overrides:
Source:
mapspace/viewer.js
Returns:

A Promise that returns a Mapspace.Coordinate in WGS84 LonLat or null for the resolve function and never rejects.

Type
Promise

transformSingleClick(evt, options)

Returns a Promise that transforms the given values from a single click.

Parameters:
Name Type Argument Description
evt Mapspace.ViewerClickEvent

Event object emitted by a single click event.

options Object <nullable>

An optional options.

Inherited From:
Overrides:
Source:
mapspace/viewer.js
Returns:

A Promise that returns a Mapspace.Coordinate in WGS84 LonLat or null for the resolve function and never rejects.

Type
Promise

<protected> unlistenAllLayers()

Removes listeners to all layers.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

<protected> unlistenLayer(layer)

Removes listeners for a given layer.

Parameters:
Name Type Description
layer ol.layer.Base

The layer.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

updateAnimations()

Update all animations.

Inherited From:
Source:
mapspace/viewer.js

updateFeature(layer, feature)

Updates special geometries of the feature in some viewers.

Parameters:
Name Type Description
layer Mapspace.layer.Vector

The layer.

feature ol.Feature

The feature.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

updateFeatureStyleOnSelection(feature, layer, selected)

Updates the feature style to reflect changes in selection.

Parameters:
Name Type Description
feature ol.Feature

Feature.

layer Mapspace.layer.Vector

The layer the feature belongs to.

selected boolean

If feature must be styled as selected or deselected.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

updateSize()

Force a recalculation of the viewer viewport size. This should be called when third-party code changes the size of the viewer viewport.

Inherited From:
Source:
mapspace/viewer.js

updateVectorLayer(layer, forceWFSLoad)

Updates the features of the given vector layer loading features if is a server layer and updating features in some viewers. For layers with source type Mapspace.source.WFS the property autoLoadFeaturesInWFS controls if that layers loads features as part of the update or not. This behaviour can be ignored if forceWFSLoad is true.

Parameters:
Name Type Argument Description
layer Mapspace.layer.Vector

The layer to update.

forceWFSLoad boolean <nullable>

Optional value. By default is false. If true then the autoLoadFeaturesInWFS property is ignored when loading features.

Inherited From:
Overrides:
Source:
mapspace/viewer.js

updateVectorLayers(forceUpdate)

Updates the features of all vector layers transforming geometries that are inside the extent of the street image to local street coordinates.

Parameters:
Name Type Argument Description
forceUpdate boolean <nullable>

Forces an update of all features even if the street image has not changed. By default is false.

Overrides:
Source:
mapspace-street/streetviewer.js