Class: View

PD. View

Store data for defining the view of a 3D model within a scene.

This class stores the complete representation of a model view state. Instances of this class are are stored in each BIM.DrawingView so that views can be accurately replicated when the user selects them.

It is also used in the PD.GlobalView static class to store the current view state, and by PD.GlobalUndo classes to restore the previous view state.


new View( [config])

Creates a new view definition,

Parameters:
Name Type Argument Description
config object <optional>

An optional configuration object.

Author:
  • drajmarsh

Extends

Members


:number

altitude

The altitude angle of the camera relative to the view target, in degrees (-90 to 90).

The altitude angle is measure vertically above the horizontal plane.

Type
  • number
Inherited From:
Overrides:

:number

ambientOcclusionMax

The maximum threshold of the screen-space ambient occlusion shader (0 to 1).

Type
  • number

:number

ambientOcclusionMin

The minimum threshold of the screen-space ambient occlusion shader (0 to 1).

Type
  • number

:number

ambientOcclusionRadius

The kernel radius of the screen-space ambient occlusion shader (0.1 to 5).

Type
  • number

:number

azimuth

The azimuth angle of the camera relative to the view target, in degrees (-180 to 180).

The azimuth angle is measured in an anti-clockwise direction from the positive X axis.

Type
  • number
Inherited From:
Overrides:

:THREE.Vector3

cameraPos

The position of the camera in model space.

Type
  • THREE.Vector3
Inherited From:
Overrides:

:number

dataOutlineDarkness

The lightness/darkness of data grid outlines within the model (0 to 1).

Type
  • number

:number

dataOutlineOpacity

The opacity of data grid outlines within the model (0 to 1).

Type
  • number

:number

dataSurfaceOpacity

The opacity of data grid surfaces within the model (0 to 1).

Type
  • number

:number

diffuseSkylight

The relative brightness of the diffuse sky (0 to 1).

Type
  • number

:number

directSunlight

The relative brightness of the direct sun (0 to 1).

Type
  • number

:number

explodedView

What type of exploded project view to display.

An exploded view simply multiples the spacing between levels in each structure such that there is visual separation between the top of each level and the bottom of the one immediately above.

Type
  • number

:number

explodedViewFraction

The fractional progress of exploded view level displacement.

This value is used to modify the spacing between multiple levels in a view. Any value greater than 1 will result in an exploded project view in which there is visual separation between each level.

Type
  • number

:number

explodedViewScale

The scale modifier to apply to level heights in exploded view.

This value is used to modify the spacing between multiple levels in a view. Any value greater than 1 will result in an exploded project view in which there is visual separation between the top of each level and the bottom of the one immediately above.

When PD.GlobalView.show3D is true, any value less than 1 is ignored. When false, the plan sections of each level can be flattened to 0.1 of their height.

Type
  • number

:number

floorGridOpacity

The opacity of the background grid lines (0 to 1).

Type
  • number

:number

fov

The field of view angle of the camera, in degrees (0.1 to 160).

Type
  • number
Inherited From:
Overrides:

:boolean

isView <readonly>

A flag identifying this object as a view definition.

Type
  • boolean

:boolean

isViewAngles <readonly>

A flag identifying this object as a view angles instance.

Type
  • boolean
Inherited From:
Overrides:

:PD.ALIGN

levelIndicatorAxis

Where to show the base level indicators.

Type

:number

levelIndicatorSize

The relative size of the base level indicators.

Type
  • number

:boolean

lockCamera

Maintain relative camera/target vector when moving the target position.

Type
  • boolean
Inherited From:
Overrides:

:PD.ALIGN

northArrowAlign

Where to show the base north arrow.

Type

:number

northArrowBounds

What extents to position the north arrow relative to.

This value selects between the bounds of the floor grid (0), the current structure (1) or the current level (2).

Type
  • number

:THREE.Vector3

northArrowPosX

The relative position of the north arrow in model space X-axis.

Type
  • THREE.Vector3

:THREE.Vector3

northArrowPosY

The relative position of the north arrow in model space Y-axis.

Type
  • THREE.Vector3

:number

northArrowSize

The relative size of the north arrow.

Type
  • number

:number

outlineDarkness

The lightness/darkness of 3D outlines within the model (0 to 1).

Type
  • number

:number

outlineOpacity

The opacity of 3D outlines within the model (0 to 1).

Type
  • number

:number

sectionOpacity

The opacity of plan-section view elements (0 to 1).

Type
  • number

:boolean

showAmbientOcclusion

Whether or not to apply screen-space ambient occlusion.

Type
  • boolean

:boolean

showFloorGrid

Whether or not to show the background floor grid.

Type
  • boolean

:boolean

showLevelIndicators

Whether or not to show the base north arrow.

Type
  • boolean

:boolean

showNorthArrow

Whether or not to show the base north arrow.

Type
  • boolean

:boolean

showShadowPlane

Whether or not to show a plane to receive shadows at ground level.

Type
  • boolean

:boolean

showShadows

Whether or not to display shadows.

Type
  • boolean

:boolean

showSkyDome

Whether or not to display a sky hemisphere in model view.

Type
  • boolean

:boolean

showSunPath

Whether or not to display a Sun-path diagram.

Type
  • boolean

:number

skyCloudBrightness

Current cloud diffusivity factor.

Type
  • number

:number

skyCloudCirrus

Current likelihood of cloudCirrus clouds within the upper atmosphere.

Type
  • number

:number

skyCloudCumulus

Current likelihood of cumulus clouds within the lower atmosphere.

Type
  • number

:number

skyHorizonHaziness

Current atmospheric haziness at the horizon.

Type
  • number

:number

skyMieCoefficient

Current atmospheric Mie scattering coefficient.

Type
  • number

:number

skyMieDirectionalG

Current atmospheric Mie directionality factor.

Type
  • number

:number

skyMieScaleHeight

Current atmospheric zenith length for Mie scattering.

Type
  • number

:number

skyRayleighCoeff

Current atmospheric Rayleigh scattering coefficient.

Type
  • number

:number

skyRayleighScaleHeight

Current atmospheric zenith length for Rayleigh scattering.

Type
  • number

:number

skyShaderType

The type of sky shader to use (0:CIESky, 1:Accurate).

Type
  • number

:number

skySunDiameter

The relative size of the sun in the sky, defaults to 1.0.

Type
  • number

:number

skyType

The current CIE sky type (0 to 17).

Type
  • number

:number

solarDiffuseHorizontal

The diffuse horizontal solar radiation, in Watts per metre squared (W/m2).

Type
  • number

:number

solarDirectBeam

The direct beam solar radiation, in Watts per metre squared (W/m2).

Type
  • number

:number

sunPathRadius

The radius of the displayed sun-path diagram, in mm.

Type
  • number

:number

surfaceOpacity

The opacity of 3D surfaces within the model (0 to 1).

Type
  • number

:THREE.Vector3

targetPos

The position of the look-at point in model space.

Type
  • THREE.Vector3
Inherited From:
Overrides:

:number

zoom

Stores the relative view zoom as a multiplier factor.

Type
  • number
Inherited From:
Overrides:

:object

icon <static>

The icon associated with this class, primarily for use by the UI and other classes.

See PD.Base.icon for more information on this object format.

Type
  • object

Methods


checkForModelRebuild(view)

Compare properties to see if a model rebuild would be required when changing to this view.

Parameters:
Name Type Description
view PD.View

The new view to potentially change to.

Returns:

Returns true if a rebuild would be required.

Type
boolean

checkForSkyDataChange(view)

Compare sky data properties to see if a sky rebuild would be required when changing to this view.

Parameters:
Name Type Description
view PD.View

The view instance to to compare with.

Returns:

Returns true if a sky change would be required.

Type
boolean

copyViewAnglesFrom(data)

Copies data from the given instance to this instance.

Parameters:
Name Type Description
data PD.ViewAngles | object

The view state instance to copy data from.

Inherited From:
Overrides:
Returns:

Returns this view angles instance to support method chaining.

Type
PD.ViewAngles

copyViewAnglesTo(data)

Copies data from this instance to another given instance.

Parameters:
Name Type Description
data PD.ViewAngles | object

The object instance to copy data to.

Inherited From:
Overrides:
Returns:

Returns this view angles instance to support method chaining.

Type
PD.ViewAngles

fromJSON(data)

Safely copy properties from a source object.

See the PD.Base#fromJSON method for more details.

Parameters:
Name Type Description
data object

The source object containing data to copy.

Overrides:
Returns:

Returns this instance to support method chaining.

Type
PD.View

lerpBetween(from, to, t)

Linearly interpolates between two views.

Parameters:
Name Type Description
from PD.View

The view to interpolate from.

to PD.View

The view to interpolate to.

t number

The fractional interpolation value (0 to 1).

Returns:

Returns whether or not a model rebuild is required.

Type
boolean

toJSON( [data])

Converts the object instance to a simple POJO for JSON storage.

This method is used to copy, store and save the data for ths object, so the returned object must have all the properties required be able to rebuild this instance in its entirety when passed to the class constructor.

See the PD.Base#toJSON method for more details.

Parameters:
Name Type Argument Description
data object <optional>

An optional parent object to append this data to.

Inherited From:
Overrides:
Returns:

Returns a JSON object.

Type
object

getClassName() <static>

The name of this class within the PD.Registry.

See getClassName() for more details as this is required for use with the PD.Registry.

Returns:

Returns the registered name of this class.

Type
string

getDisplayName() <static>

The name to display within the user interface.

Returns:

Returns the display name.

Type
string

getDrawingType(view) <static>

Determines the most appropriate architectural drawing type from view settings.

Parameters:
Name Type Description
view PD.View

The view to determine the type from.

Returns:

Returns the architectural drawing type.

Type
PD.DRAWING_TYPE

getViewTypeName() <static>

Determines the most appropriate name for the current view.

Returns:

returns the view type name.

Type
string

hasFloorGridAnnotations(view) <static>

Checks if the given view has active annotations that are dependant on the floor grid.

Parameters:
Name Type Description
view PD.View

The view to determine the annotations from.

Returns:

Returns the architectural drawing type.

Type
boolean

lerpBetween(view, from, to, t) <static>

Linearly interpolates the given view between the from and to views.

Parameters:
Name Type Description
view PD.View

The view to receive the results.

from PD.View

The view to interpolate from.

to PD.View

The view to interpolate to.

t number

The fractional interpolation value (0 to 1).

Returns:

Returns whether or not a model rebuild is required.

Type
boolean

usePerspective(view) <static>

Initialises the given view as a 3D perspective.

This method should be called at the very start of your application to initialise the settings for a default perspective view.

Parameters:
Name Type Description
view PD.View

The view to receive the results.