Class: Viewer

bu.threed. Viewer

Constructor for bu.threed.Viewer class This is an abstract class for viewers that show 3D objects. It is used for creating subclasses and not instantiated in apps. Note that with bu.threed.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 Description
options bu.threed.ViewerOptions

Viewer options.

Source:
bu-threed/threedviewer.js
Fires:
  • ol.Object.Event#event:change:debugGrid
  • ol.Object.Event#event:change:debugMode
  • ol.Object.Event#event:change:fOV
  • ol.Object.Event#event:change:liDARPointSize
  • ol.Object.Event#event:change:pitch
  • ol.Object.Event#event:change:size
  • ol.Object.Event#event:change:target
  • ol.Object.Event#event:change:tilt
  • ol.Object.Event#event:change:time
  • ol.Object.Event#event:change:yaw

Extends

Members


state :bu.ViewerState

Type:
Inherited From:
Source:
bu/viewer.js

viewType :bu.ViewType|undefined

Type:
Overrides:
Source:
bu-threed/threedviewer.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.

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

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

The viewer cloned.

Type
bu.Viewer

<abstract> getAttributions()

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

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

Attributions.

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

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.

Source:
bu-threed/threedviewer.js
Returns:

The camera looking point.

Type
bu.Coordinate

getCameraOrientation()

Return the current orientation of the camera. Returns null if the viewer is not initialized.

Source:
bu-threed/threedviewer.js
Returns:

The camera orientation.

Type
bu.CameraOrientation

getCenter()

Return the current center of the viewer. Coordinates are always in WGS84 latlon, first value in the coordinate is longitude, second latitude and third value is height in meters. The center of this viewer is where the camera is set, not where the camera is looking at. To get that point use bu.threed.Viewer#getCameraLookingPoint or bu.threed.Viewer#getCameraOrientation. Returns null if the viewer is not initialized.

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

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

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.

Source:
bu-threed/threedviewer.js
Returns:

The viewer FOV.

Type
number

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>

getLiDARPointSize()

Return the current LiDAR point size for LiDAR projects loaded.

Source:
bu-threed/threedviewer.js
Returns:

The LiDAR point size.

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

getPitch()

Returns current pitch value of the viewer and [-90, 90] is the expected values range.

Source:
bu-threed/threedviewer.js
Returns:
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.

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

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

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

The element that the viewer is rendered in.

Type
Element

getTilt()

Return the current tilt of the viewer in decimal degrees with values in [-180,180].

Source:
bu-threed/threedviewer.js
Returns:

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

Type
number

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>

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

getYaw()

Return the current yaw of the viewer in decimal degrees with north equal zero and values increasing towards east. Value range is [0,360).

Source:
bu-threed/threedviewer.js
Returns:

The yaw value of the viewer. Range is [0, 360].

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

<abstract> render()

Renders the viewer.

Inherited From:
Source:
bu/viewer.js

setCameraLookingPoint(point)

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.

Parameters:
Name Type Description
point bu.Coordinate

Point ot look at.

Source:
bu-threed/threedviewer.js

setCameraOrientation(orientation)

Set the camera orientation.

Parameters:
Name Type Description
orientation bu.CameraOrientation

The orientation.

Source:
bu-threed/threedviewer.js

setCenter(center)

Set the current center of the viewer. Coordinates are always in WGS84 latlon, first value in the coordinate is longitude, second latitude and third value is height in meters. The center of this viewer is where the camera is set, not where the camera is looking at. To set that point use bu.threed.Viewer#setCameraLookingPoint or bu.threed.Viewer#setCameraOrientation.

Parameters:
Name Type Description
center bu.Coordinate

The viewer center.

Source:
bu-threed/threedviewer.js

setCrosshairVisibility(visible)

Sets the crosshair visibility.

Parameters:
Name Type Description
visible boolean

If visible or not.

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

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

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.

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

setLiDARPointSize(pointsize)

Set the current LiDAR point size for LiDAR projects loaded.

Parameters:
Name Type Description
pointsize number

The LiDAR point size.

Source:
bu-threed/threedviewer.js

setPitch(pitch)

Set the current PITCH value of the viewer in radians. Valid range is [-90, 90]. When yaw value is 0 the viewer is aligned with horizont, -90 value is the highest angle we can look at and 90 is the lower.

Parameters:
Name Type Description
pitch number

The pitch value.

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

setTilt(tilt)

Set the current tilt of the viewer in decimal degrees with values in [-180,180].

Parameters:
Name Type Description
tilt number

The viewer tilt.

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

setYaw(yaw)

Set the current yaw of the viewer in decimal degrees with north equal zero and values increasing towards east. Value range is [0,360).

Parameters:
Name Type Description
yaw number

The viewer yaw.

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

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