Class: Viewer

bu. Viewer

This is an abstract class for all types of viewers. Each viewer should be focused en one type of geographical data, as ortho or 2D imagery and vector, oblique images, street 360 images, or 3D data.


new Viewer(options)

Parameters:
Name Type Description
options bu.ViewerOptions

Viewer options.

Source:
bu/viewer.js
Fires:
  • ol.Object.Event#event:change:debugGrid
  • ol.Object.Event#event:change:debugMode
  • ol.Object.Event#event:change:size
  • ol.Object.Event#event:change:target
  • ol.Object.Event#event:change:time

Extends

  • ol.Object

Members


state :bu.ViewerState

Type:
Source:
bu/viewer.js

viewType :bu.ViewType|undefined

Type:
Source:
bu/viewer.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 on ol.Collection.

Parameters:
Name Type Description
layer ol.layer.Base

Layer.

Source:
bu/viewer.js

<abstract> clone()

Clones this viewer reinitializing the new one with main values of current one. This is an abstract method that must be implemented in derived classes.

Source:
bu/viewer.js
Returns:

The viewer cloned.

Type
bu.Viewer

<abstract> getAttributions()

Returns the list of ol.Attribution currently visible in the viewer.

Source:
bu/viewer.js
Returns:

Attributions.

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

getCrosshair()

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

Source:
bu/viewer.js
Returns:

The viewer overlay that shows the crosshair.

Type
Element

getDebugGrid()

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

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.

Source:
bu/viewer.js
Returns:

The debug mode.

Type
boolean

<abstract> getLayerGroup()

Get the layergroup associated with this viewer.

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.

Source:
bu/viewer.js
Returns:

Layers.

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

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:
bu/viewer.js
Returns:

The viewer's overlay container that stops events.

Type
Element

getSize()

Get the size of this viewer.

Source:
bu/viewer.js
Returns:

The size in pixels of the viewer in the DOM.

Type
bu.Size | undefined

getState()

Return the viewer state.

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

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 an Element, or null if the viewer has no target.

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.

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.

Source:
bu/viewer.js
Returns:

The time as a pair of values.

Type
Array.<number>

getViewport()

Return the viewport of the viewer.

Source:
bu/viewer.js
Returns:

The viewport.

Type
Element

getViewType()

Return the type of the viewer.

Source:
bu/viewer.js
Returns:

The viewer type.

Type
bu.ViewType

removeLayer(layer)

Removes the given layer from this viewer.

Parameters:
Name Type Description
layer ol.layer.Base

Layer.

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

setCrosshairVisibility(visible)

Sets the crosshair visibility.

Parameters:
Name Type Description
visible boolean

If visible or not.

Source:
bu/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.

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.

Source:
bu/viewer.js

<abstract> 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.

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

Source:
bu/viewer.js

<abstract> 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.

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.

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.

Source:
bu/viewer.js

<abstract> 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.

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