new Viewer(options)
Parameters:
Name | Type | Description |
---|---|---|
options |
bu.ortho.ViewerOptions | Viewer options. |
- Source:
- bu-ortho/orthoviewer.js
Fires:
- ol.events.Event#event:baselayerchanged
- ol.events.Event#change:rotation
- ol.Object.Event#event:change:debugGrid
- ol.events.Event#change:zoom
- ol.events.Event#change:center
- ol.events.Event#change:zoomfactor
- ol.events.Event#change:extent
- ol.events.Event#change:layergroup
- ol.events.Event#change:minresolution
- bu.PanoramaEvent#event:panoramaclicked
- ol.events.Event#change:minzoom
- ol.events.Event#change:enablerotation
- ol.events.Event#change:resolution
- ol.events.Event#change:constrainrotation
- ol.Object.Event#event:change:debugMode
- ol.Object.Event#event:change:size
- ol.Object.Event#event:change:target
- ol.Object.Event#event:change:time
- ol.events.Event#change:maxresolution
- ol.events.Event#change:resolutions
- ol.events.Event#change:projection
- ol.events.Event#change:maxzoom
Extends
Members
-
map :ol.Map
-
Type:
- ol.Map
- Source:
- bu-ortho/orthoviewer.js
-
state :bu.ViewerState
-
Type:
- Inherited From:
- Source:
- bu/viewer.js
-
useAnimations :boolean
-
Type:
- boolean
- Source:
- bu-ortho/orthoviewer.js
-
viewType :bu.ViewType|undefined
-
Type:
- bu.ViewType | undefined
- Overrides:
- Source:
- bu-ortho/orthoviewer.js
Methods
-
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 layer
ol.layer.Base Layer.
- Inherited From:
- Source:
- bu/viewer.js
-
animate(var_args)
-
Animate the viewer. The viewer's center, zoom (or resolution), and rotation can be animated for smooth transitions between viewer states. For example, to animate the viewer to a new zoom level:
viewer.animate({zoom: viewer.getZoom() + 1});
By default, the animation lasts one second and uses in-and-out easing. You can customize this behavior by including
duration
(in milliseconds) andeasing
options (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]});
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 orfalse
if it was cancelled.Animations are cancelled by user interactions (e.g. dragging the map) or by calling
viewer.setCenter()
,viewer.setResolution()
, orviewer.setRotation()
(or another method that calls one of these).Coordinates for the center animations must always be WGS84 lonlat, with fisrt value the longitude and second value the latitude following the same restrictions that setCenter method has.
Rotations for the rotation animations must always be in decimal degrees with values [0, 360) following the same restrictions that setRotation method has.
Parameters:
Name Type Argument Description var_args
olx.AnimationOptions | 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:
- bu-ortho/orthoviewer.js
-
clone()
-
Clones this viewer reinitializing the new one with main values of current one.
- Overrides:
- Source:
- bu-ortho/orthoviewer.js
Returns:
The viewer cloned.
- Type
- bu.ortho.Viewer
-
constrainResolution(resolution [, opt_delta] [, opt_direction])
-
Get the constrained resolution of this viewer.
Parameters:
Name Type Argument Description resolution
number | undefined Resolution.
opt_delta
number <optional>
Delta. Default is
0
.opt_direction
number <optional>
Direction. Default is
0
.- Source:
- bu-ortho/orthoviewer.js
Returns:
Constrained resolution.
- Type
- number | undefined
-
fromCurrentProjection(coordinate [, projection])
-
Converts a given coordinate in the current projection of the viewer to a given projection.
Parameters:
Name Type Argument Description coordinate
bu.Coordinate The coordinate to convert.
projection
string <optional>
The projection of coordinate. Projection must be a valid EPSG code, a string like 'EPSG:4326' or '4326'. If a projection is not given then it is asumed that the projection is the same as map and the same coordinate as input is returned.
- Source:
- bu-ortho/orthoviewer.js
Returns:
The coordinate converted or null if conversion could not be done.
- Type
- bu.Coordinate
-
getAttributions()
-
Returns the list of
ol.Attribution
currently visible in the viewer.- Inherited From:
- Overrides:
- Source:
- bu/viewer.js
Returns:
Attributions.
- Type
- Array.<Object.<string, ol.Attribution>>
-
getCenter()
-
Returns the current
center
of the viewer. Coordinates are always in WGS84 latlon, first value in the coordinate is longitude and second latitude.- Source:
- bu-ortho/orthoviewer.js
Returns:
The viewer center.
- Type
- bu.Coordinate
-
getCrosshair()
-
Get the element that serves as a mid crosshair in the viewer, useful for debugging purposes.
- Inherited From:
- Source:
- bu/viewer.js
Returns:
The viewer overlay that shows the crosshair.
- Type
- Element
-
getCurrentPanoramaID(viewIndex)
-
Gets the current panorama ID for a given
bu.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.
- Source:
- bu-ortho/orthoviewer.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:
- bu/viewer.js
Returns:
If visible or not.
- Type
- boolean
-
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 bu.DEBUG property to set if debug mode must be used. The initial value could later be change through this property.
- Inherited From:
- Source:
- bu/viewer.js
Returns:
The debug mode.
- Type
- boolean
-
getLayerGroup()
-
Get the layergroup associated with this viewer.
- Inherited From:
- Overrides:
- Source:
- bu/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:
- bu/viewer.js
Returns:
Layers.
- Type
- ol.Collection.<ol.layer.Base>
-
getMaxResolution()
-
Returns the maximum resolution of the viewer.
- Source:
- bu-ortho/orthoviewer.js
Returns:
The maximum resolution of the viewer.
- Type
- number
-
getMaxZoom()
-
Returns the maximum zoom of the viewer.
- Source:
- bu-ortho/orthoviewer.js
Returns:
The maximum zoom of the viewer.
- Type
- number
-
getMinResolution()
-
Returns the minimum resolution of the viewer.
- Source:
- bu-ortho/orthoviewer.js
Returns:
The minimum resolution of the viewer.
- Type
- number
-
getMinZoom()
-
Returns the minimum zoom of the viewer.
- Source:
- bu-ortho/orthoviewer.js
Returns:
The minimum zoom of the viewer.
- Type
- number
-
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:
- bu/viewer.js
Returns:
The viewer's overlay container that stops events.
- Type
- Element
-
getProjection()
-
//TODO: Can projection be changed or always be Mercator. If so then there //is no need for this and for toCurrentProjection etc. Returns the projection of the viewer.
- Source:
- bu-ortho/orthoviewer.js
Returns:
The projection of the viewer.
- Type
- string
-
getResolution()
-
Returns the resolution of the viewer.
- Source:
- bu-ortho/orthoviewer.js
Returns:
The resolution of the viewer.
- Type
- number
-
getResolutions()
-
Returns the resolutions of the viewer.
- Source:
- bu-ortho/orthoviewer.js
Returns:
The resolutions of the viewer.
- Type
- Array.<number>
-
getRotation()
-
Returns the rotation of the viewer.
- Source:
- bu-ortho/orthoviewer.js
Returns:
The rotation of the viewer in decimal degrees.
- Type
- number
-
getSize()
-
Get the size of this viewer.
- Inherited From:
- Source:
- bu/viewer.js
Returns:
The size in pixels of the viewer in the DOM.
- Type
- bu.Size | undefined
-
getState()
-
Return the viewer state.
- Overrides:
- Source:
- bu-ortho/orthoviewer.js
Returns:
- Type
- bu.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:
- bu/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 anElement
, ornull
if the viewer has no target.- Inherited From:
- Source:
- bu/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 with pattern YYYYMMDD or with pattern YYYYMMDD-YYYYMMDD. First filters images before the date, and second filters images between the dates.
- Inherited From:
- Source:
- bu/viewer.js
Returns:
The time string.
- Type
- string
-
getTimeValues()
-
Returns the current time value as a pair of values [minDate,maxDate]. If time value has pattern YYYYMMDD then minDate = -Infinity and maxDate a number with 8 digits following YYYYMMDD pattern. If time value has pattern YYYYMMDD-YYYYMMDD then minDate and maxDate are numbers with 8 digits following YYYYMMDD pattern. If time value is not valid pattern then null is returned.
- Inherited From:
- Source:
- bu/viewer.js
Returns:
The time as a pair of values.
- Type
- Array.<number>
-
getUsePanoramas()
-
Returns if ortho 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:
- bu-ortho/orthoviewer.js
Returns:
The value of the property.
- Type
- boolean
-
getViewport()
-
Return the viewport of the viewer.
- Inherited From:
- Source:
- bu/viewer.js
Returns:
The viewport.
- Type
- Element
-
getViewType()
-
Return the type of the viewer.
- Inherited From:
- Source:
- bu/viewer.js
Returns:
The viewer type.
- Type
- bu.ViewType
-
getZoom()
-
Returns the zoom of the viewer.
- Source:
- bu-ortho/orthoviewer.js
Returns:
The zoom of the viewer.
- Type
- number
-
removeLayer(layer)
-
Removes the given layer from this viewer.
Parameters:
Name Type Description layer
ol.layer.Base Layer.
- Inherited From:
- Source:
- bu/viewer.js
Returns:
The removed layer (or undefined if the layer was not found).
- Type
- ol.layer.Base | undefined
-
render()
-
Renders the viewer.
- Inherited From:
- Overrides:
- Source:
- bu/viewer.js
-
setCenter(center)
-
Sets the current
center
of the viewer. Coordinates are always in WGS84 latlon, first value in the coordinate is longitude and second latitude.Parameters:
Name Type Description center
bu.Coordinate The viewer center.
- Source:
- bu-ortho/orthoviewer.js
-
setCrosshairVisibility(visible)
-
Sets the crosshair visibility.
Parameters:
Name Type Description visible
boolean If visible or not.
- Inherited From:
- Source:
- bu/viewer.js
-
setCurrentPanoramaID(viewIndex, id)
-
Sets the current panorama ID for a given
bu.street.Viewer
identified by its viewIndex inside the workspace layout. When this value is set if abu.layer.Panoramas
is used inside the viewer it will show the current panorama in a highlighted color.Parameters:
Name Type Description viewIndex
number The index inside of the workpace layout that identifies the street viewer for which the ID is set.
id
string The ID of the panorama.
- Source:
- bu-ortho/orthoviewer.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:
- bu/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 bu.DEBUG property so 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:
- bu/viewer.js
-
setLayerGroup(layerGroup)
-
Sets the layergroup of the viewer.
Parameters:
Name Type Description layerGroup
ol.layer.Group A layer group containing the layers in the viewer.
- Inherited From:
- Overrides:
- Source:
- bu/viewer.js
-
setMaxZoom(maxzoom)
-
Set the maximum zoom of the viewer.
Parameters:
Name Type Description maxzoom
number The maximum zoom of the viewer.
- Source:
- bu-ortho/orthoviewer.js
-
setMinZoom(minzoom)
-
Set the minimum zoom of the viewer.
Parameters:
Name Type Description minzoom
number The minimum zoom of the viewer.
- Source:
- bu-ortho/orthoviewer.js
-
setResolution(resolution)
-
Set the resolution of the viewer.
Parameters:
Name Type Description resolution
number The resolution of the viewer.
- Source:
- bu-ortho/orthoviewer.js
-
setRotation(rotation)
-
Set the rotation of the viewer.
Parameters:
Name Type Description rotation
number The rotation of the viewer in decimal degrees.
- Source:
- bu-ortho/orthoviewer.js
-
setSize(size)
-
Set the size of this viewer.
Parameters:
Name Type Description size
bu.Size | undefined The size in pixels of the viewer in the DOM.
- Inherited From:
- Source:
- bu/viewer.js
-
setSyncingHandlers(handler)
-
Sets the listeners to the events of the viewer that will cause other synced viewers to be updated. This is an abstract method. It must be overriden in derived classes.
Parameters:
Name Type Description handler
function The handler that will manage the events.
- Inherited From:
- Overrides:
- Source:
- bu/viewer.js
Returns:
Array of key listeners for later easy disposal.
- Type
- Array.<ol.EventsKey>
-
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:
- bu/viewer.js
-
setTime(time)
-
Sets the current time filter of the viewer. Valid time values are any string with pattern YYYYMMDD or with pattern YYYYMMDD-YYYYMMDD. First filters images before the date, and second filters images between the dates.
Parameters:
Name Type Description time
string The time string.
- Inherited From:
- Source:
- bu/viewer.js
-
setUsePanoramas(use)
-
Set if ortho 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.
- Source:
- bu-ortho/orthoviewer.js
-
setZoom(zoom)
-
Set the zoom of the viewer.
Parameters:
Name Type Description zoom
number The zoom of the viewer.
- Source:
- bu-ortho/orthoviewer.js
-
setZoomToExtent(layer)
-
Set the zoom and center of the viewer to cover the extent of a given layer.
Parameters:
Name Type Description layer
ol.layer.Vector The layer to zoom at. The layer can be anyone, it is not needed to be a layer current added in the viewer.
- Source:
- bu-ortho/orthoviewer.js
-
syncWithViewer(viewer, viewIndex, syncProperties, event)
-
Synchronizes this viewer with another one knowing its viewIndex and its sync options.
Parameters:
Name Type Description viewer
bu.Viewer The viewer to sync with.
viewIndex
number The index in the layout of the viewer to sync with.
syncProperties
bu.SyncProperties The syncing properties.
event
ol.events.Event The event that triggered the syncing action.
- Inherited From:
- Overrides:
- Source:
- bu/viewer.js
-
toCurrentProjection(coordinate [, projection])
-
Converts a given coordinate in a given projection to the current projection of the viewer.
Parameters:
Name Type Argument Description coordinate
bu.Coordinate The coordinate to convert.
projection
string <optional>
The projection of coordinate. Projection must be a valid EPSG code, a string like 'EPSG:4326' or '4326'. If a projection is not given then it is asumed that the projection is the same as viewer and the same coordinate as input is returned.
- Source:
- bu-ortho/orthoviewer.js
Returns:
The coordinate converted or null if conversion could not be done.
- Type
- bu.Coordinate
-
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:
- bu/viewer.js