Class: Viewer

Viewer

This is a 3D viewer that uses internally a Cesium.Viewer class from Cesium to show 2D and 3D imagery and vector data on top of a Earth globe. Note that with Mapspace.profile3d.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.profile3d.ViewerOptions <optional>

Viewer options.

Source:
mapspace-profile3d/profile3dviewer.js
Fires:
  • ol.events.Event#change:center
  • ol.events.Event#change:pitch
  • ol.events.Event#change:roll
  • ol.events.Event#change:fov
  • ol.events.Event#change:rotation
  • ol.events.Event#change:layergroup
  • ol.events.Event#change:outputprojection
  • 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:changed
  • 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:interactiveTool
  • ol.Object.Event#event:change:name
  • ol.Object.Event#event:change:pitch
  • ol.Object.Event#event:change:projectsExtentVisible
  • 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:terrainOcclusion
  • ol.Object.Event#event:change:terrainVisible
  • ol.Object.Event#event:change:threedDetail
  • 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


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

viewType :Mapspace.ViewType

Overrides:
Source:
mapspace-profile3d/profile3dviewer.js

Methods


addAnnotationLabel(feature)

Adds the annotation label for the given feature.

Parameters:
Name Type Description
feature ol.Feature

The feature.

Inherited From:
Source:
mapspace/viewer3d.js

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.

Inherited From:
Source:
mapspace/viewer3d.js

addLabel(groupName, label)

Adds a label to a label group.

Parameters:
Name Type Description
groupName string

The unique name for the label group. If the name doesn't exist the label is not added.

label Cesium.Entity

The label entity for Cesium viewer.

Inherited From:
Source:
mapspace/viewer3d.js

addLabelGroup(name)

Adds a label group. A label group is a collection of related labels, for example, the labels associated with a layer.

Parameters:
Name Type Description
name string

A unique name for the label group. If the name already exists the label group won't be created.

Inherited From:
Source:
mapspace/viewer3d.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

addMeasurementLabel(feature)

Adds the measurement label for the given feature.

Parameters:
Name Type Description
feature ol.Feature

The feature.

Inherited From:
Source:
mapspace/viewer3d.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:
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.

Inherited From:
Source:
mapspace/viewer3d.js

cancelAnimations()

Cancel any ongoing animations.

Inherited From:
Source:
mapspace/viewer.js

changeLabelGroupVisibility(name, visible)

Changes visibility of a label group. A label group is a collection of related labels, for example, the labels associated with a layer.

Parameters:
Name Type Description
name string

A unique name for the label group. If the name doesn't exist nothing is changed.

visible boolean

If set the label group as visible or not.

Inherited From:
Source:
mapspace/viewer3d.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:
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

drawExtent(id, extent, target, color, outlineColor)

Draws a extent in the viewer and stores it in the given target.

Parameters:
Name Type Argument Description
id string

ID.

extent Mapspace.Extent

Extent in WGS84 LonLat.

target Cesium.CustomDataSource

Custom data source.

color ol.color | ol.ColorLike <nullable>

Color.

outlineColor ol.color | ol.ColorLike <nullable>

Outline color.

Inherited From:
Source:
mapspace/viewer3d.js
Returns:
Type
Cesium.Entity

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:
Source:
mapspace/viewer.js

existsLiDARProject(name)

Returns true if any layer exists containing the given LiDAR project.

Parameters:
Name Type Description
name string

The LiDAR project name.

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

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:
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

fromHeadingToRotation(heading)

Converts a Cesium heading to rotation used by this viewer. Cesium computes heading as the angle between north and viewing direction, in radians, so 0 is looking north, PI/2 is looking east and so on.

Parameters:
Name Type Description
heading number

The heading in radians.

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

The rotation in decimal degrees.

Type
number

fromRotationToHeading(rotation)

Converts a rotation used by this viewer to a Cesium heading. Cesium computes heading as the angle between north and viewing direction, in radians, so 0 is looking north, PI/2 is looking east and so on.

Parameters:
Name Type Description
rotation number

The rotation in decimal degrees.

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

The heading in radians.

Type
number

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

getAproximateResolution()

Returns an aproximation to current resolution if camera would be heading downwars to Earth.

Overrides:
Source:
mapspace-profile3d/profile3dviewer.js
Returns:
Type
number

getAproximateZoom()

Returns an aproximation to current zoom level. Due to nature of 3D viewers, it is not possible to return an exact zoom level for them. Layers with tiles load different zoom levels at different distances from camera location. Close to the camera high-level tiles are shown, and far away from it low-level ones are loaded in the background. This method aproximates a solution sniffing at the current tile provider for the globe surface, and returning the highest-level tile zoom.

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

The aproximate zoom level or null if no number can be returned.

Type
number

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:
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

getBackColor()

Get the html color of the background.

Source:
mapspace-profile3d/profile3dviewer.js
Returns:
Type
String

getCameraLookingPoint()

Return the current point in the ground that the camera is looking at. Coordinates are always in WGS84 latlon, first value in the coordinate is longitude, second latitude and third value is height in meters. Returns null if the camera is not looking to the ground.

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

The camera looking point.

Type
Mapspace.Coordinate

getCameraProjection()

Returns the current camera projection.

Inherited From:
Source:
mapspace/viewer3d.js
Returns:
Type
Mapspace.CameraProjection

getCenter()

Returns the current Mapspace.Coordinate center of the viewer. This center is the point where the 360 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. The center of this viewer is where the camera is set, not where the camera is looking at. To get that point use Mapspace.Viewer3D#getCameraLookingPoint.

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

The viewer center or null.

Type
Mapspace.Coordinate

getCenteredExtent(width)

Returns a extent centered where screen center hits ellipsoid. Returns undefined if ellipsoid is not hit. The extent is returned in Mercator Spheric coordinates.

Parameters:
Name Type Argument Description
width number <nullable>

Width of the extent in meters. Defaults to 2000m.

Inherited From:
Source:
mapspace/viewer3d.js
Returns:
Type
Mapspace.Extent

getChanged()

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

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

getCoordinateAtPlane(pixel)

Gets the coordinate in lonlat WGS84 of the point that intersects the plane of current profile delimiter. Returns null if no point is found.

Parameters:
Name Type Description
pixel ol.Pixel

Coordinate with origin in top-left corner.

Source:
mapspace-profile3d/profile3dviewer.js
Returns:
Type
Mapspace.Coordinate

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

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

getElevationForTilesets(point)

Returns an elevation in meters for current loaded tilesets that are near the given point. Returns null if not profile is set or there are not any tilesets loaded.

Parameters:
Name Type Description
point Mapspace.Coordinate

Coordinate in Mercator Spheric. Elevation is ignored.

Source:
mapspace-profile3d/profile3dviewer.js
Returns:
Type
number

getFeaturesInPickedObjects(objs, layerFilter)

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

Parameters:
Name Type Description
objs Array.<Object>

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.

Inherited From:
Source:
mapspace/viewer3d.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()

Return the current FOV of the viewer in decimal degrees. FOV or Field of View is the angle that is currently visible in the viewer. Value range is [0,360) though values up 180 aren't logical ones in a 2D screen. The projection in a 2D screen is limited to values far under 180. Values above 180 have sense, on the contrary, for VR screens.

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

The viewer 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>

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.

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

The interaction found or null.

Type
Mapspace.interaction.Interaction

getInteractions()

Returns the array of interactions.

Inherited From:
Source:
mapspace/viewer3d.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>

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 when camera is pointing outside the Earth. The extent is returned in Mercator Spheric coordinates. The extent is obtained checking two extents: one is the extent that is centered in the point on Earth intersected by the center of the screen, buffered with the maxSize param; other is the viewed extent of the Earth. If both exists then the smaller width or height is returned in the final extent.

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

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

Inherited From:
Source:
mapspace/viewer3d.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:
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>

getLiDARProjects()

Returns an array with current LiDAR projects in the viewer.

Inherited From:
Source:
mapspace/viewer3d.js
Returns:
Type
Array.<Mapspace.LiDARProjectMetadata>

getName()

Returns the current name of the viewer.

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

The name.

Type
string

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 usually is [-90, 90] although [-180, 180] are possible. When pitch value is 0 the viewer is aligned with horizon, -90 is looking down and 90 is looking up.

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

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

Type
number

getPixelLookingPoint(x, y)

Return the current point in the ground that a ray passing through the camera position and through the pixel coordinate collisions at. Coordinates are always in WGS84 latlon, first value in the coordinate is longitude, second latitude and third value is height in meters. Returns null if the ray is not looking to the ground.

Parameters:
Name Type Description
x number

Pixel coordinate in viewport coords increasing from left to right.

y number

Pixel coordinate in viewport coords increasing from top to bottom.

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

The looking point.

Type
Mapspace.Coordinate

getProfile3d()

Gets the profile for the viewer. The profile is one feature that contains these required observable properties:

  • name: with the name of the profile.
  • guid: unique identifier for the profile.
  • geometry: the geometry of the profile.
  • projects: the array of LiDAR project names that must be loaded with the profile.
Source:
mapspace-profile3d/profile3dviewer.js
Returns:
Type
ol.Feature

getProjectedGeometry(feature)

Returns the geometry of the given feature, but projected to plane if needed.

Parameters:
Name Type Description
feature ol.Feature

Feature.

Inherited From:
Overrides:
Source:
mapspace/viewer3d.js
Returns:
Type
ol.geom.Geometry | undefined | null

getProjectsExtentVisible()

Return if the project`s extent must be visible or not.

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

If project`s extent is visible or not.

Type
boolean

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.

Inherited From:
Source:
mapspace/viewer3d.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:
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.

Inherited From:
Source:
mapspace/viewer3d.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.

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

getShiftedExtent(width, asMercator)

Returns the extent below the current camera location but shifted away in the direction of the camera so the boundary of the extent is at the ground camera

Parameters:
Name Type Argument Description
width number <nullable>

Optional width. Default is a calculated one.

asMercator boolean <nullable>

If true returns Mercator coordinates. Default is false.

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

The extent.

Type
Mapspace.Extent

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

getTerrainOcclusion()

Return if the terrain must occlude primitives or not. By default is false.

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

If terrain must occlude primitives or not.

Type
boolean

getTerrainVisible()

Return if the terrain must be visible or not.

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

If terrain is visible or not.

Type
boolean

getThreedDetail()

Return the current 3D detail level.

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

The 3D detail level.

Type
number

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

getUnderneathExtent(width, asMercator)

Returns the extent below the current camera location. The extent is returned as longitudes and latitudes in decimal degrees (WGS84).

Parameters:
Name Type Argument Description
width number <nullable>

Optional width. Default is a calculated one.

asMercator boolean <nullable>

If true returns Mercator coordinates. Default is false.

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

The extent.

Type
Mapspace.Extent

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:
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>

getViewingExtent()

Returns the extent of the current camera frustum at ground. The extent is returned as longitudes and latitudes in decimal degrees (WGS84). If current camera frustum do not intersect the ground and projects to sky then a default extent is returned that expand 10km from current camera location at ground.

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

The extent.

Type
Mapspace.Extent

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

getVisibleExtent()

Returns the visible extent. Returns undefined if the ellipsoid is not visible. The extent is returned in Mercator Spheric coordinates.

Inherited From:
Source:
mapspace/viewer3d.js
Returns:
Type
Mapspace.Extent

<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:
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

isFeatureAllowed(layer, feature)

Returns if the feature is allowed to be rendered depending on the current Profile3D is use.

Parameters:
Name Type Description
layer Mapspace.layer.Vector

Layer.

feature ol.Feature

Feature.

Inherited From:
Overrides:
Source:
mapspace/viewer3d.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:
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

isLabelGroupVisible(name)

Returns true if the label group is visible.

Parameters:
Name Type Description
name string

A unique name for the label group. If the name doesn't exist return false.

Inherited From:
Source:
mapspace/viewer3d.js

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

isOrthographic()

Returns if current mode of viewer is ortographic or not.

Inherited From:
Source:
mapspace/viewer3d.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.
  2. Any ol.layer.Tile with a ol.source.WMTS or ol.source.TileWMS.
  3. Any Mapspace.layer.Cesium3DTileset.
Parameters:
Name Type Description
layer ol.layer.Base

Layer to check.

Inherited From:
Source:
mapspace/viewer3d.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

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

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:
Source:
mapspace/viewer.js

removeAllLiDARProjects()

Removes any layer from the viewer that contains a LiDAR project.

Inherited From:
Source:
mapspace/viewer3d.js

removeFromSelection(feature)

Removes a feature from selection.

Parameters:
Name Type Description
feature ol.Feature

The feature.

Inherited From:
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.

Inherited From:
Source:
mapspace/viewer3d.js

removeLabelGroup(name)

Removes a label group. A label group is a collection of related labels, for example, the labels associated with a layer.

Parameters:
Name Type Description
name string

A unique name for the label group. If the name doesn't exist nothing is removed.

Inherited From:
Source:
mapspace/viewer3d.js

removeLabels(groupName)

Removes all the labels in a label group.

Parameters:
Name Type Description
groupName string

The unique name for the label group. If the name doesn't exist label are not removed.

Inherited From:
Source:
mapspace/viewer3d.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

removeLiDARProject(name)

Removes any layer from the viewer that contains the given LiDAR project.

Parameters:
Name Type Description
name string

The LiDAR project name.

Inherited From:
Source:
mapspace/viewer3d.js

removeUnusedLiDARProjects()

Removes LiDAR projects that are not in current extent and never has been used.

Inherited From:
Source:
mapspace/viewer3d.js

render()

Renders the viewer.

Inherited From:
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:
Source:
mapspace/viewer.js

resetAnnotationLabels()

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

Inherited From:
Source:
mapspace/viewer.js

resetMeasurementLabels()

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

Inherited From:
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:
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:
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

setBackColor()

Set the html color of the background.

Source:
mapspace-profile3d/profile3dviewer.js
Returns:
Type
String

setCameraLookingPoint(point, range)

Set the current point that the camera must look at. Coordinates are always in WGS84 latlon, first value in the coordinate is longitude, second latitude and third value is height in meters. The current heading is mantained the same, and the pitch is changed when it is higher that 45 degrees.

Parameters:
Name Type Argument Description
point Mapspace.Coordinate

Point ot look at.

range number <nullable>

An optional distance to the point. If not provided the default is 200 meters.

Overrides:
Source:
mapspace-profile3d/profile3dviewer.js

setCameraProjection(cameraProj)

Sets the camera projection.

Parameters:
Name Type Description
cameraProj Mapspace.CameraProjection

Camera projection.

Source:
mapspace-profile3d/profile3dviewer.js

setCenter(center)

Sets the current Mapspace.Coordinate center of the viewer. Coordinates are always in WGS84 latlon degrees, first value in the coordinate is longitude, second latitude and third value is height over ground in meters. If the third is not present then the current height is used. The center of this viewer is where the camera is set, not where the camera is looking at. To set that point use Mapspace.Viewer3D#setCameraLookingPoint.

Parameters:
Name Type Description
center Mapspace.Coordinate

The viewer center.

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

setCenterOffset(offset)

Sets a offset in the camera center. If only two values are in offset, the current height will be unchanged. First value must be a longitude offset in degrees, second a latitude offset in degrees, and optionally a third value with height offset in meters.

Parameters:
Name Type Description
offset Array.<number>

Center offset.

Inherited From:
Overrides:
Source:
mapspace/viewer3d.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

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

setFOV(fov)

Set the current FOV of the viewer in decimal degrees. FOV or Field of View is the angle that is currently visible in the viewer. Value range is [0,360) though values up 180 aren't logical ones in a 2D screen. The projection in a 2D screen is limited to values far under 180. Values above 180 have sense, on the contrary, for VR screens.

Parameters:
Name Type Description
fov number

The viewer FOV.

Inherited From:
Overrides:
Source:
mapspace/viewer3d.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

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:
Source:
mapspace/viewer.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 usually is [-90, 90] although [-180, 180] are possible. When pitch value is 0 the viewer is aligned with horizon, -90 is looking down and 90 is looking up.

Parameters:
Name Type Description
pitch number

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

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

setProfile3d(profile, force)

Sets the profile for the viewer. The profile is one feature that contains these required observable properties:

  • name: with the name of the profile.
  • guid: unique identifier for the profile.
  • geometry: the geometry of the profile.
  • projects: the array of LiDAR project names that must be loaded with the profile.
Parameters:
Name Type Argument Description
profile ol.Feature <nullable>

The profile or undefined/null to remove.

force boolean <nullable>

If force a reset of the profile or not. By default is false.

Source:
mapspace-profile3d/profile3dviewer.js

setProjectsExtentVisible(visible)

Set if the project`s extent must be visible or not.

Parameters:
Name Type Description
visible boolean

If the project`s extent must be visible or not.

Inherited From:
Source:
mapspace/viewer3d.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.

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

The roll value.

Type
number

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

setTerrainOcclusion(visible)

Set if the terrain must be occlude primitives or not. By default is false.

Parameters:
Name Type Description
visible boolean

If the terrain must occlude primitives or not.

Inherited From:
Source:
mapspace/viewer3d.js

setTerrainVisible(visible)

Set if the terrain must be visible or not.

Parameters:
Name Type Description
visible boolean

If the terrain must be visible or not.

Inherited From:
Source:
mapspace/viewer3d.js

setThreedDetail(level)

Set the current 3D detail level.

Parameters:
Name Type Description
level level

The 3D detail level.

Inherited From:
Source:
mapspace/viewer3d.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

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:
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:
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:
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:
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:
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:
Source:
mapspace/viewer.js

updateFeaturesEntities(features, layer, selected)

Updates the entities related to the given feature to reflect current styling and the selected property passed.

Parameters:
Name Type Argument Description
features ol.Feature | Array.<ol.Feature>

Features, one or several.

layer Mapspace.layer.Vector

Layer with the features.

selected boolean <nullable>

Optional. If show the feature as selected or not. If not passed then current selection status is used.

Inherited From:
Overrides:
Source:
mapspace/viewer3d.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:
Source:
mapspace/viewer.js

updateGrid()

Updates the grid in a back plane behind current data in the viewer.

Source:
mapspace-profile3d/profile3dviewer.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

updateVectorLayerFromCesium(layer)

Updates in Cesium the style of the features in the given Mapspace.layer.Vector using the last custom style available in the layer.

Parameters:
Name Type Description
layer Mapspace.layer.Vector

The layer to update.

Inherited From:
Source:
mapspace/viewer3d.js

updateVectorLayers()

Updates the features of vector layers that are suitable for an load and an update. The array of layers that can be updated is returned by Mapspace.Viewer#getUpdatableVectorLayers. For layers with source type Mapspace.source.WFS the property autoLoadFeaturesInWFS controls if that layers loads features as part of the update or not.

Inherited From:
Source:
mapspace/viewer.js

zoomByDelta(delta, delay)

Increases the zoom of the viewer by delta factor.

As this viewer has no zoom property this function aproximates it using the getAproximateZoom to obtain a zoom to increase.

Parameters:
Name Type Description
delta number

An integer with the amount of zoom to increase or decrease.

delay number

A number of milliseconds with duration of the animation. This is not currently in use.

Inherited From:
Source:
mapspace/viewer3d.js