new Viewer( [options])
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
options |
Mapspace.ViewerOptions |
<optional> |
Viewer options. |
- Source:
- mapspace/viewer.js
Fires:
- 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:interactiveTool
- ol.Object.Event#event:change:name
- 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
- ol.Object
Members
-
showPin :boolean
-
- Source:
- mapspace/viewer.js
-
showReverseGeocodingLabel :boolean|string
-
- Source:
- mapspace/viewer.js
-
state :Mapspace.ViewerState
-
- Source:
- mapspace/viewer.js
-
viewType :Mapspace.ViewType|undefined
-
- Source:
- mapspace/viewer.js
Methods
-
<abstract, static> getDefault(options)
-
Returns an instance of the default viewer.
Parameters:
Name Type Description optionsMapspace.ViewerLocationOptions The options for initial location.
- Source:
- mapspace/viewer.js
Returns:
The default viewer.
- Type
- Mapspace.Viewer
-
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 onol.Collection.Parameters:
Name Type Description layerol.layer.Base Layer.
- Source:
- mapspace/viewer.js
-
addToSelection(feature, layer)
-
Adds a feature to selection.
Parameters:
Name Type Description featureol.Feature The feature.
layerMapspace.layer.Vector The layer of the feature.
- 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.ViewerorMapspace.street.Viewerthe 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) andeasingoptions (seeol.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
trueif the animation series completed on its own orfalseif 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_argsMapspace.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.
- Source:
- mapspace/viewer.js
-
cancelAnimations()
-
Cancel any ongoing animations.
- Source:
- mapspace/viewer.js
-
clearSelection(opt_layer)
-
Clears the selection.
Parameters:
Name Type Description opt_layerMapspace.layer.Vector An optional layer for clearing only the selection of the layer.
- Source:
- mapspace/viewer.js
-
<abstract> clone()
-
Clones this viewer reinitializing the new one with main values of current one.
- 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 animationMapspace.ViewerAnimation The animation to execute.
progressnumber Progress of the animation from 0 to 1 once applied the easing.
- Source:
- mapspace/viewer.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
layerFilteroption in options.Parameters:
Name Type Argument Description pixelol.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.
callbackfunction Feature callback. The callback will be called with four arguments, two required and two optional. The first argument is the
featurefound at the pixel, the second is thelayerof the feature, the third argument is an optionalMapspace.Coordinateof 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.optionsolx.AtPixelOptions <optional>
Optional options.
- 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
-
getAllLoadableVectorLayers()
-
Returns the array of
vector layersthat 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 aMapspace.source.ServerVectorsource.- Source:
- mapspace/viewer.js
Returns:
- Type
- Array.<Mapspace.layer.Vector>
-
getAllowedAuxiliaryLineTools()
-
Get the array of elements as an auxiliary lines for the crosshair.
- Source:
- mapspace/viewer.js
Returns:
The viewer overlay that shows the crosshair auxiliary lines.
- Type
- boolean
-
getAnimating()
-
Determine if the viewer is being animated.
- Source:
- mapspace/viewer.js
Returns:
The viewer is being animated.
- Type
- boolean
-
<abstract> getAttributions()
-
Returns an array of two objects, the first with the
ol.Attributionof 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.- 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.
- 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.
- 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.
- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
getAutoShowFeaturePanel()
-
Returns if a
Mapspace.control.SidePanelmust be opened after a selection is done in the vector features of the viewer.- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
getAuxiliaryLines()
-
Returns if the auxiliary lines should be visible or not.
- Source:
- mapspace/viewer.js
Returns:
If visible or not.
- Type
- boolean
-
<abstract> getCenter()
-
Returns the current
Mapspace.Coordinatecenter of the viewer. Coordinates are always in WGS84 latlon, first value in the coordinate is longitude and second latitude. Some viewers that have three dimensions return a third value with the height over ground in meters. Returns null if no center has been set.- Source:
- mapspace/viewer.js
Returns:
The viewer center or null.
- Type
- Mapspace.Coordinate
-
getChanged()
-
Gets if the viewer is changed from the last time it was saved.
- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
getCrosshair()
-
Get the element that serves as a mid crosshair in the viewer, useful for debugging purposes.
- 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.
- 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#getAllLoadableVectorLayersbut taking consideration if layer has a source typeMapspace.source.WFS, the propertyautoLoadFeaturesInWFS, and if aforceWFSLoadis required.Parameters:
Name Type Description forceWFSLoadboolean If true then the
autoLoadFeaturesInWFSproperty is considered.- Source:
- mapspace/viewer.js
Returns:
- Type
- Array.<Mapspace.layer.Vector>
-
getCurrentPanoramaID(viewIndex)
-
Gets the current panorama ID for a given
Mapspace.street.Vieweridentified by its viewIndex inside the workspace layout.Parameters:
Name Type Description viewIndexnumber The index inside of the workpace layout that identifies the street viewer for which the ID is set.
- 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.
- 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
- 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.
- Source:
- mapspace/viewer.js
Returns:
The debug mode.
- Type
- boolean
-
getHints( [opt_hints])
-
Return the hints of this viewer.
Parameters:
Name Type Argument Description opt_hintsArray.<number> <optional>
Destination array.
- Source:
- mapspace/viewer.js
Returns:
Hint.
- Type
- Array.<number>
-
getInteracted()
-
Returns if the viewer is being interacted.
- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
getInteracting()
-
Determine if the user is interacting with the viewer, such as panning or zooming.
- Source:
- mapspace/viewer.js
Returns:
The viewer is being interacted with.
- Type
- boolean
-
getInteractiveTool()
-
Returns the current interactive tool that is active. If it is null then the basic pan & zoom interactions are active.
- Source:
- mapspace/viewer.js
Returns:
The tool.
-
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.
- Source:
- mapspace/viewer.js
Returns:
The control.
-
getIsActive()
-
Gets if the viewer is active.
- 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.
- Source:
- mapspace/viewer.js
Returns:
-
getLastCenterOffset()
-
Returns the center offset since the last
Mapspace.ViewerEventType.MOVESTARTevent. 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.- 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
loadFeaturesis invoked in the source. It can be null in some viewers. The extent is returned in Mercator Spheric coordinates.Parameters:
Name Type Argument Description layerMapspace.layer.Vector <nullable>
Optional layer. If not present the extent will be the same for any layer. Some viewers require a layer.
maxSizenumber <nullable>
Optional maximum size in meters. Maximum size is clamped to a maximum value of 2000 m.
- Source:
- mapspace/viewer.js
Returns:
The extent.
- Type
- Mapspace.Extent
-
getLayerForSelectedFeature(feature)
-
Returns the associated
vectorlayerof a selected feature.Parameters:
Name Type Description featureol.Feature | ol.render.Feature Feature
- Source:
- mapspace/viewer.js
Returns:
Layer or undefined if the feature is not selected.
-
<abstract> getLayerGroup()
-
Get the layergroup associated with this viewer.
- 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.
- Source:
- mapspace/viewer.js
Returns:
Layers.
- Type
- ol.Collection.<ol.layer.Base>
-
getLayersArray()
-
Get the array of layers associated with this viewer.
- Source:
- mapspace/viewer.js
Returns:
- Type
- Array.<ol.layer.Base>
-
getName()
-
Returns the current name of the viewer.
- 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.
- 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.
- Source:
- mapspace/viewer.js
Returns:
The viewer's overlay container that stops events.
- Type
- Element
-
<abstract> 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.
- Source:
- mapspace/viewer.js
Returns:
The rotation of the viewer in decimal degrees or null.
- Type
- number
-
getRotatorType()
-
Gets the rotator type.
- Source:
- mapspace/viewer.js
Returns:
-
getSelectedFeatures(opt_layer)
-
Returns the array of current selected features.
Parameters:
Name Type Argument Description opt_layerMapspace.layer.Vector <nullable>
An optional layer for returning only the selected features in that layer.
- Source:
- mapspace/viewer.js
Returns:
- Type
- Array.<ol.Feature>
-
getSize()
-
Get the size of this viewer.
- 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.
- Source:
- mapspace/viewer.js
Returns:
The options.
- Type
- Array.<string>
-
getState()
-
Return the viewer state.
- 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.
- 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
getTargetthis method always return anElement, ornullif the viewer has no target.- 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-*orYYYYMMDD-YYYYMMDD. Asterisk means that that maximum date is the maximum possible date (the latest date of current year).YYYYMMDDfilters 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
- Source:
- mapspace/viewer.js
Returns:
The time string.
- Type
- string
-
-
<abstract> getTimestamp()
-
Return an object that can be compared between frames to check idleness.
- 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.
- Source:
- mapspace/viewer.js
Returns:
- Type
- ol.proj.Units | undefined
-
getUpdatableVectorLayers()
-
Returns the array of
vector layersthat 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.- 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.
- Source:
- mapspace/viewer.js
Returns:
The value of the property.
- Type
- boolean
-
getVectorLayers()
-
Returns the array of
vector layersthat are in current viewer, including layers inside groups.- Source:
- mapspace/viewer.js
Returns:
- Type
- Array.<Mapspace.layer.Vector>
-
getViewport()
-
Return the viewport of the viewer.
- Source:
- mapspace/viewer.js
Returns:
The viewport.
- Type
- Element
-
getViewType()
-
Return the type of the viewer.
- Source:
- mapspace/viewer.js
Returns:
The viewer type.
- Type
- Mapspace.ViewType
-
<protected> handleLayerGroupChanged(evt)
-
Handles the change of the reference in the layerGroup.
Parameters:
Name Type Description evtol.Object.Event The event.
- 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 evtol.Collection.Event The event.
- Source:
- mapspace/viewer.js
-
<abstract> handleLayersChanged(evt)
-
Handles the change of the reference in the 'layers' property of the layerGroup.
Parameters:
Name Type Description evtol.Object.Event The event.
- Source:
- mapspace/viewer.js
-
<protected> handleLayersRemove(evt)
-
Handles the deletion of a layer in the layerGroup, removing listeners for it.
Parameters:
Name Type Description evtol.Collection.Event The event.
- Source:
- mapspace/viewer.js
-
handleSingleClick(evt)
-
Handles single clicks (not any pair of clicks or double clicks).
Parameters:
Name Type Description evtObject Event object. It is different object for each type of viewer.
- Source:
- mapspace/viewer.js
-
is2DViewer()
-
Return true if current viewer of the action is a 2D viewer.
- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
is3DViewer()
-
Return true if current viewer of the action is a 3D viewer.
- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isFeatureSelectable(feature, layer)
-
Returns true if the feature can be selected.
Parameters:
Name Type Description featureol.Feature The feature.
layerMapspace.layer.Vector The layer of the feature.
- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isFeatureSelected(feature, opt_layer)
-
Returns true if the feature passed is selected.
Parameters:
Name Type Argument Description featureol.Feature The feature.
opt_layerMapspace.layer.Vector <nullable>
The layer of the feature. This is optional. If provided the search of the feature is faster.
- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isGlobalViewer()
-
Return true if current viewer of the action is a
Mapspace.global.Viewer.- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isObliqueViewer()
-
Return true if current viewer of the action is a
Mapspace.oblique.Viewer.- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isObliqueViewerVisible()
-
Return true if current viewer of the action is a
Mapspace.oblique.Vieweror aMapspace.global.Viewerin Oblique mode.- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isOrthoViewer()
-
Return true if current viewer of the action is a
Mapspace.ortho.Viewer.- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isOrthoViewerVisible()
-
Return true if current viewer of the action is a
Mapspace.ortho.Vieweror aMapspace.global.Viewerin Ortho mode.- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isProfile3dViewer()
-
Return true if current viewer of the action is a
Mapspace.profile3d.Viewer.- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isRemovableLayer(layer)
-
Returns if layer is removable. This function is overrided in inherited classes to add further checks. Returns null if it is uncertain.
Removable layers include:
- Any layer with a 'removable' observable value set to true.
- Not any layer with a 'removable' observable value set to false.
- Not any layer of these types:
Mapspace.layer.LiDARProjects,Mapspace.layer.Measurements,Mapspace.layer.Annotations,Mapspace.layer.PanoramasorMapspace.layer.Mesh3DProjects. - Any layer of type
Mapspace.layer.Vectorwith aMapspace.source.Vectoror aMapspace.source.ServerVectorthat is not any of the previous. - Any layer of type
ol.layer.Group.
Parameters:
Name Type Description layerol.layer.Base Layer to check.
- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isStreetViewer()
-
Return true if current viewer of the action is a
Mapspace.street.Viewer.- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isTableViewer()
-
Return true if current viewer of the action is a
Mapspace.table.Viewer.- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isThreedViewer()
-
Return true if current viewer of the action is a
Mapspace.threed.Viewer.- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
isVisible()
-
Gets if the viewer is visible or not.
- Source:
- mapspace/viewer.js
Returns:
- Type
- boolean
-
<abstract> listenLayer(layer)
-
Adds listeners for a given layer.
Parameters:
Name Type Description layerol.layer.Base The layer.
- Source:
- mapspace/viewer.js
-
moveLayerDown(index)
-
Moves down a layer given by index so now position is index - 1.
Parameters:
Name Type Description indexnumber Index of layer to move. Layers inside a layer group cannot be moved, only the full layer group can be moved.
- 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 indexnumber Index of layer to move. Layers inside a layer group cannot be moved, only the full layer group can be moved.
- Source:
- mapspace/viewer.js
Returns:
If layer is moved or not.
- Type
- boolean
-
notifyAddressInfoRetrieved(address, copyAddress, htmlAddress, geocodingType [, coordinate])
-
Triggers a
Mapspace.AddressInfoEventevent notifying that this viewer has retrieved an address information from a geocoding search or reverse geocoding.Parameters:
Name Type Argument Description addressstring The address information.
copyAddressstring The address information formatted to be copied to clipboard.
htmlAddressstring The address information formatted as HTML content.
geocodingTypeMapspace.GecodingType Type of geocoding action.
coordinateMapspace.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
- Source:
- mapspace/viewer.js
-
notifyLayerChanged(type, opt_layer, opt_features, opt_shiftPressed)
-
Triggers a
Mapspace.ViewerLayerEventevent notifying that something in the layer has changed (in all the layer or some features).Parameters:
Name Type Argument Description typeMapspace.ViewerLayerEventType The type of change.
opt_layerMapspace.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_featuresArray.<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_shiftPressedboolean <nullable>
Indicates if shift key is pressed.
- 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'.
- Source:
- mapspace/viewer.js
-
notifyTaskEnd(id [, title] [, message] [, type])
-
Triggers a
Mapspace.TaskEventevent notifying that the long task identified by ID has ended successfully.Parameters:
Name Type Argument Description idnumber Unique number that identifies the task.
titlestring <optional>
Optional title or title globalization subkey for the control
Mapspace.control.Notifieror any other control consuming the event triggered.messagestring <optional>
Optional message or message globalization subkey for the control
Mapspace.control.Notifieror any other control consuming the event triggered.typeMapspace.NotificationType <optional>
Optional type of notification. By default is ERROR but can be changed to other type if needed.
- Source:
- mapspace/viewer.js
-
notifyTaskError(id [, title] [, message] [, type])
-
Triggers a
Mapspace.TaskEventevent notifying that the long task identified by ID has ended with an error.Parameters:
Name Type Argument Description idnumber Unique number that identifies the task.
titlestring <optional>
Optional title or title globalization subkey for the control
Mapspace.control.Notifieror any other control consuming the event triggered.messagestring <optional>
Optional message or message globalization subkey for the control
Mapspace.control.Notifieror any other control consuming the event triggered.typeMapspace.NotificationType <optional>
Optional type of notification. By default is ERROR but can be changed to other type if needed.
- Source:
- mapspace/viewer.js
-
notifyTaskProgress(id [, title] [, message] [, progress])
-
Triggers a
Mapspace.TaskEventevent notifying that a long task identified by ID has progressed.Parameters:
Name Type Argument Description idnumber Unique number that identifies the task.
titlestring <optional>
Optional title or title globalization subkey for the control
Mapspace.control.Notifieror any other control consuming the event triggered.messagestring <optional>
Optional message or message globalization subkey for the control
Mapspace.control.Notifieror any other control consuming the event triggered.progressnumber <optional>
Optional percentage progress of the task. Default is 0.
- Source:
- mapspace/viewer.js
-
notifyTaskStart(id, title, message [, progress])
-
Triggers a
Mapspace.TaskEventevent notifying that a long task has started.Parameters:
Name Type Argument Description idnumber Unique number that identifies the task.
titlestring Title or title globalization subkey for the control
Mapspace.control.Notifieror any other control consuming the event triggered.messagestring Message or message globalization subkey for the control
Mapspace.control.Notifieror any other control consuming the event triggered.progressnumber <optional>
Optional percentage progress of the task. Default is 0.
- Source:
- mapspace/viewer.js
-
notifyViewerActivated()
-
Triggers a
ol.events.Eventevent notifying that a viewer has been activated.- Source:
- mapspace/viewer.js
-
notifyViewerDeactivated()
-
Triggers a
ol.events.Eventevent notifying that a viewer has been deactivated.- Source:
- mapspace/viewer.js
-
notifyVisibleChanged()
-
Triggers a
ol.events.Eventevent notifying that visibility of the viewer has changed.- 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_NAMEorMapspace.STREET_GEOMETRY_NAMEthat 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 forMapspace.GEOMETRY_NAMEvalue that no silent mode is used to force Rtree update.Parameters:
Name Type Description layerMapspace.layer.Vector The layer.
originol.Feature The origin feature.
targetol.Feature The target feature. This feature must be contained in layer and it is not checked.
- Source:
- mapspace/viewer.js
-
removeFromSelection(feature)
-
Removes a feature from selection.
Parameters:
Name Type Description featureol.Feature The feature.
- Source:
- mapspace/viewer.js
-
removeLayer(layer)
-
Removes the given layer from this viewer.
Parameters:
Name Type Description layerol.layer.Base Layer.
- Source:
- mapspace/viewer.js
Returns:
The removed layer (or undefined if the layer was not found).
- Type
- ol.layer.Base | undefined
-
<abstract> render()
-
Renders the viewer.
- 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 layerMapspace.layer.Vector The layer.
featureol.Feature The feature.
- Source:
- mapspace/viewer.js
-
<abstract> resetAnnotationLabels()
-
Resets all annotations labels, removing them and adding them again.
- Source:
- mapspace/viewer.js
-
<abstract> resetMeasurementLabels()
-
Resets all measurement labels, removing them and adding them again.
- Source:
- mapspace/viewer.js
-
resetSyncOffset()
-
Resets the offset used to synchronize this viewer with others using center offsets instead of absolute coordinates.
- 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.
- Source:
- mapspace/viewer.js
-
selectAll(opt_layer)
-
Selects all features.
Parameters:
Name Type Description opt_layerMapspace.layer.Vector An optional layer for selecting only all the features of the layer.
- Source:
- mapspace/viewer.js
-
setAnimationValues(animation, type, target)
-
Sets tha values for a
Mapspace.ViewerAnimationobject of the given type and with the given source and target values.Parameters:
Name Type Description animationMapspace.ViewerAnimation The animation object.
typeMapspace.ViewerAnimationProperty Type of animation property.
targetMapspace.Coordinate | number The target value for the property to be animated.
- 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 autoAddboolean If true NVDB road reference is added to attributes of point features of Street images.
- 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 autoLoadboolean 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.- 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 autoSelectboolean If true point features of Street images will appear as selected when a Street image is opened.
- Source:
- mapspace/viewer.js
-
setAutoShowFeaturePanel(autoShow)
-
Sets if a
Mapspace.control.SidePanelmust be opened after a selection is done in the vector features of the viewer.Parameters:
Name Type Description autoShowboolean If true a
Mapspace.control.SidePanelmust be opened after a selection is done in the vector features of the viewer.- Source:
- mapspace/viewer.js
-
setAuxiliaryLines(visible)
-
Sets if the auxiliary lines should be visible or not.
Parameters:
Name Type Description visibleboolean If visible or not.
- Source:
- mapspace/viewer.js
-
<abstract> setCenter(center)
-
Sets the current
Mapspace.Coordinatecenter of the viewer. Coordinates are always in WGS84 latlon, first value in the coordinate is longitude and second latitude.Parameters:
Name Type Description centerMapspace.Coordinate The viewer center.
- Source:
- mapspace/viewer.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 offsetArray.<number> Center offset.
- Source:
- mapspace/viewer.js
-
setChanged(changed)
-
Sets if the viewer is changed or not.
Parameters:
Name Type Description changedboolean If the viewer has changed or not.
- Source:
- mapspace/viewer.js
-
setCrosshairAuxiliaryLinesVisibility(visible)
-
Set the crosshair auxiliary lines visibility.
Parameters:
Name Type Description visibleboolean If visible or not.
- Source:
- mapspace/viewer.js
-
setCrosshairVisibility(visible)
-
Sets the crosshair visibility.
Parameters:
Name Type Description visibleboolean If visible or not.
- Source:
- mapspace/viewer.js
-
setCurrentPanoramaID(viewIndex, id)
-
Sets the current panorama ID for a given
Mapspace.street.Vieweridentified by its viewIndex inside the workspace layout. When this value is set if aMapspace.layer.Panoramasis used inside the viewer it will show the current panorama in a highlighted color.Parameters:
Name Type Argument Description viewIndexnumber The index inside of the workpace layout that identifies the street viewer for which the ID is set.
idstring <nullable>
The ID of the panorama or null if no panorama is opened.
- 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 visibleboolean If visible or not.
- 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 colorstring The color as a CSS color.
- 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 debugmodeboolean The debug mode.
- Source:
- mapspace/viewer.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 interactedboolean - 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.InteractiveToolNamesthen the tool is activated in the control that contains that tool and the appropiate interactions are activated.Parameters:
Name Type Argument Description toolMapspace.InteractiveToolNames <nullable>
The tool.
opt_controlMapspace.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.
- Source:
- mapspace/viewer.js
-
setIsActive(isActive)
-
Sets if the viewer is active.
Parameters:
Name Type Description isActiveboolean True or false
- Source:
- mapspace/viewer.js
-
<abstract> 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 layerGroupol.layer.Group A layer group containing the layers for the viewer.
- Source:
- mapspace/viewer.js
-
setName(name)
-
Sets the current name of the viewer.
Parameters:
Name Type Description namestring The name.
- Source:
- mapspace/viewer.js
-
setOutputProjection(outputProjection)
-
Sets the viewer output projection.
Parameters:
Name Type Description outputProjectionstring | undefined The 'EPSG:code' string with the projection to use in any control linked to this viewer when showing coordinates.
- Source:
- mapspace/viewer.js
-
<abstract> 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 handlerfunction The handler that will manage the events.
- Source:
- mapspace/viewer.js
Returns:
Array of key listeners for later easy disposal.
- Type
- Array.<ol.EventsKey>
-
setResizeListening(listen)
-
Adds or remove resize events listening for the viewer.
Parameters:
Name Type Description listenboolean If true listening of resize events is activated; if false deactivated.
- Source:
- mapspace/viewer.js
-
<abstract> 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 rotationnumber The rotation of the viewer in decimal degrees.
- Source:
- mapspace/viewer.js
-
setRotatorType(rotatorType)
-
Sets the rotator type.
Parameters:
Name Type Description rotatorTypeMapspace.control.RotatorType Rotator type,
- Source:
- mapspace/viewer.js
-
setSize(size)
-
Set the size of this viewer.
Parameters:
Name Type Description sizeMapspace.Size | undefined The size in pixels of the viewer in the DOM.
- Source:
- mapspace/viewer.js
-
setSnapshotOptions(options)
-
Sets the current snapshot options of the viewer.
Parameters:
Name Type Argument Description optionsArray.<string> <nullable>
The snapshot options.
- Source:
- mapspace/viewer.js
-
setState(state)
-
Sets the state of the viewer.
Parameters:
Name Type Description stateMapspace.ViewerState The new state for the viewer.
- Source:
- mapspace/viewer.js
-
setTarget(target)
-
Set the target element to render this viewer into.
Parameters:
Name Type Description targetElement | string | undefined The Element or id of the Element that the viewer is rendered in.
- Source:
- mapspace/viewer.js
-
setTime(time)
-
Sets the current time filter of the viewer. Valid time values are any string like
*,YYYYMMDD,YYYYMMDD-*orYYYYMMDD-YYYYMMDD. Asterisk means that that maximum date is the maximum possible date (the latest date of current year).YYYYMMDDfilters 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 timestring The time string.
- Source:
- mapspace/viewer.js
-
-
setUnits(units)
-
Sets the viewer units.
Parameters:
Name Type Description unitsol.proj.Units | undefined The units to use in any control linked to this viewer when showing measurements but not coordinates.
- 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 useboolean The value of the property.
- 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 objToZoomMapspace.layer.Vector | Array.<ol.Feature> | Mapspace.Extent The object to zoom to.
optionsolx.view.FitOptions | undefined Optional options.
- Source:
- mapspace/viewer.js
-
showPinsAndLabels()
-
Shows the pins and labels (if set in the options).
- Source:
- mapspace/viewer.js
-
<abstract> stopInteractions()
-
Stops the interactions saving its status for a later restart use.
- Source:
- mapspace/viewer.js
-
<abstract> syncWithViewer(viewer, syncProperties)
-
Synchronizes this viewer with another one knowing its sync options.
Parameters:
Name Type Description viewerMapspace.Viewer The viewer to sync with.
syncPropertiesMapspace.SyncProperties The syncing properties.
- Source:
- mapspace/viewer.js
-
transformCenter()
-
Returns a Promise that transform the current coordinates of the viewer center.
- Source:
- mapspace/viewer.js
Returns:
A Promise that returns a
Mapspace.Coordinatein 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 evtMapspace.ViewerClickEvent Event object emitted by a single click event.
optionsObject <nullable>
An optional options.
- Source:
- mapspace/viewer.js
Returns:
A Promise that returns a
Mapspace.Coordinatein WGS84 LonLat or null for the resolve function and never rejects.- Type
- Promise
-
<protected> unlistenAllLayers()
-
Removes listeners to all layers.
- Source:
- mapspace/viewer.js
-
<protected> unlistenLayer(layer)
-
Removes listeners for a given layer.
Parameters:
Name Type Description layerol.layer.Base The layer.
- Source:
- mapspace/viewer.js
-
updateAnimations()
-
Update all animations.
- Source:
- mapspace/viewer.js
-
updateFeature(layer, feature)
-
Updates special geometries of the feature in some viewers.
Parameters:
Name Type Description layerMapspace.layer.Vector The layer.
featureol.Feature The feature.
- Source:
- mapspace/viewer.js
-
updateFeatureStyleOnSelection(feature, layer, selected)
-
Updates the feature style to reflect changes in selection.
Parameters:
Name Type Description featureol.Feature Feature.
layerMapspace.layer.Vector The layer the feature belongs to.
selectedboolean If feature must be styled as selected or deselected.
- 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.
- 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.WFSthe propertyautoLoadFeaturesInWFScontrols if that layers loads features as part of the update or not. This behaviour can be ignored ifforceWFSLoadis true.Parameters:
Name Type Argument Description layerMapspace.layer.Vector The layer to update.
forceWFSLoadboolean <nullable>
Optional value. By default is false. If true then the
autoLoadFeaturesInWFSproperty is ignored when loading features.- Source:
- mapspace/viewer.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 typeMapspace.source.WFSthe propertyautoLoadFeaturesInWFScontrols if that layers loads features as part of the update or not.- Source:
- mapspace/viewer.js