@cognite/reveal / Modules
@cognite/reveal
has three modules:
- @cognite/reveal is the main module and has the main entry point of Reveal,
Cognite3DViewer
. CAD models are represented byCognite3DModel
and points clouds byCognitePointCloudModel
. - @congite/reveal/tools contains a set of tools, e.g.
AxisViewTool
,GeomapTool
,TimelineTool
,ExplodedViewTool
andHtmlOverlayTool
that works withCognite3DViewer
. - @cognite/reveal/extensions/datasource allows providing custom data sources for geometry and model metadata.
Classes
@cognite/reveal / Modules / @cognite/reveal / AssetNodeCollection
Class: AssetNodeCollection
@cognite/reveal.AssetNodeCollection
Represents a set of nodes associated with an asset in Cognite Fusion linked to the 3D model using asset mappings. A node is considered to be part of an asset if it has a direct asset mapping or if one of its ancestors has an asset mapping to the asset.
Hierarchy
-
↳ AssetNodeCollection
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new AssetNodeCollection(client
, model
)
Parameters
Name | Type |
---|---|
client | default |
model | Cognite3DModel |
Overrides
NodeCollectionBase.constructor
Defined in
viewer/core/src/datamodels/cad/styling/AssetNodeCollection.ts:30
Properties
classToken
▪ Static
Readonly
classToken: "AssetNodeCollection"
Defined in
viewer/core/src/datamodels/cad/styling/AssetNodeCollection.ts:24
Accessors
classToken
• get
classToken(): string
Returns
string
Defined in
viewer/packages/cad-styling/src/NodeCollectionBase.ts:25
isLoading
• get
isLoading(): boolean
Returns true when the set currently is running an operation for loading the full set of nodes contained by the set.
Returns
boolean
Defined in
viewer/core/src/datamodels/cad/styling/AssetNodeCollection.ts:39
Methods
clear
▸ clear(): void
Returns
void
Overrides
Defined in
viewer/core/src/datamodels/cad/styling/AssetNodeCollection.ts:93
executeFilter
▸ executeFilter(filter
): Promise
<void>
Updates the node collection to hold nodes associated with the asset given, or assets within the bounding box or all assets associated with the 3D model.
Parameters
Name | Type | Description |
---|---|---|
filter | Object | |
filter.assetId? | number | ID of a single asset (optional) |
filter.boundingBox? | Box3 | When provided, only assets within the provided bounds will be included in the filter. |
Returns
Promise
<void>
Defined in
viewer/core/src/datamodels/cad/styling/AssetNodeCollection.ts:50
getIndexSet
▸ getIndexSet(): IndexSet
Returns
Overrides
NodeCollectionBase.getIndexSet
Defined in
viewer/core/src/datamodels/cad/styling/AssetNodeCollection.ts:100
off
▸ off(event
, listener
): void
Unsubscribe a listener to events about the set changing, i.e. when nodes are added or removed to the set.
Parameters
Name | Type |
---|---|
event | "changed" |
listener | () => void |
Returns
void
Inherited from
Defined in
viewer/packages/cad-styling/src/NodeCollectionBase.ts:42
on
▸ on(event
, listener
): void
Subscribe a listener to events about the set changing, i.e. when nodes are added or removed to the set.
Parameters
Name | Type |
---|---|
event | "changed" |
listener | () => void |
Returns
void
Inherited from
Defined in
viewer/packages/cad-styling/src/NodeCollectionBase.ts:33
serialize
▸ serialize(): SerializedNodeCollection
Returns
Overrides
Defined in
viewer/core/src/datamodels/cad/styling/AssetNodeCollection.ts:104
@cognite/reveal / Modules / @cognite/reveal / BoundingBoxClipper
Class: BoundingBoxClipper
@cognite/reveal.BoundingBoxClipper
Table of contents
Constructors
Accessors
Constructors
constructor
• new BoundingBoxClipper(box?
)
Parameters
Name | Type |
---|---|
box? | Box3 |
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:16
Accessors
clippingPlanes
• get
clippingPlanes(): Plane
[]
Returns
Plane
[]
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:104
maxX
• get
maxX(): number
Returns
number
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:55
• set
maxX(x
): void
Parameters
Name | Type |
---|---|
x | number |
Returns
void
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:50
maxY
• get
maxY(): number
Returns
number
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:64
• set
maxY(y
): void
Parameters
Name | Type |
---|---|
y | number |
Returns
void
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:59
maxZ
• get
maxZ(): number
Returns
number
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:73
• set
maxZ(z
): void
Parameters
Name | Type |
---|---|
z | number |
Returns
void
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:68
minX
• get
minX(): number
Returns
number
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:28
• set
minX(x
): void
Parameters
Name | Type |
---|---|
x | number |
Returns
void
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:23
minY
• get
minY(): number
Returns
number
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:37
• set
minY(y
): void
Parameters
Name | Type |
---|---|
y | number |
Returns
void
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:32
minZ
• get
minZ(): number
Returns
number
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:46
• set
minZ(z
): void
Parameters
Name | Type |
---|---|
z | number |
Returns
void
Defined in
viewer/core/src/utilities/BoundingBoxClipper.ts:41
@cognite/reveal / Modules / @cognite/reveal / Cognite3DModel
Class: Cognite3DModel
@cognite/reveal.Cognite3DModel
Hierarchy
-
Object3D
↳ Cognite3DModel
Implements
Table of contents
Properties
Accessors
Methods
- assignStyledNodeCollection
- dispose
- getAncestorTreeIndices
- getBoundingBoxByNodeId
- getBoundingBoxByTreeIndex
- getCameraConfiguration
- getDefaultNodeAppearance
- getModelBoundingBox
- getModelTransformation
- getSubtreeTreeIndices
- iterateNodesByTreeIndex
- iterateSubtreeByTreeIndex
- mapBoxFromModelToCdfCoordinates
- mapFromCdfToModelCoordinates
- mapNodeIdToTreeIndex
- mapNodeIdsToTreeIndices
- mapPositionFromModelToCdfCoordinates
- mapTreeIndexToNodeId
- mapTreeIndicesToNodeIds
- removeAllStyledNodeCollections
- resetNodeTransform
- resetNodeTransformByTreeIndex
- setDefaultNodeAppearance
- setModelTransformation
- setNodeTransform
- setNodeTransformByTreeIndex
- unassignStyledNodeCollection
- updateStyledNodeCollection
Properties
modelId
• Readonly
modelId: number
The CDF model ID of the model.
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:61
revisionId
• Readonly
revisionId: number
The CDF revision ID of the model.
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:65
type
• Readonly
type: SupportedModelTypes = 'cad'
Implementation of
Overrides
THREE.Object3D.type
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:28
Accessors
modelUnit
• get
modelUnit(): ""
| WellKnownUnit
Returns the unit the coordinates for the model is stored. Returns an empty string if no unit has been stored. Note that coordinates in Reveal always are converted to meters using @see {@link modelUnitToMetersFactor}.
version
New since 2.1
Returns
""
| WellKnownUnit
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:43
modelUnitToMetersFactor
• get
modelUnitToMetersFactor(): number
Returns the conversion factor that converts from model coordinates to meters. Note that this can return undefined if the model has been stored in an unsupported unit.
version
New since 2.1
Returns
number
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:54
nodeCount
• get
nodeCount(): number
Returns the number of nodes in the model.
Returns
number
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:453
styledNodeCollections
• get
styledNodeCollections(): { appearance
: NodeAppearance ; nodeCollection
: NodeCollectionBase }[]
Returns all currently registered node collections and associated appearance.
Returns
{ appearance
: NodeAppearance ; nodeCollection
: NodeCollectionBase }[]
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:127
Methods
assignStyledNodeCollection
▸ assignStyledNodeCollection(nodeCollection
, appearance
): void
Customizes rendering style for a set of nodes, e.g. to highlight, hide or color code a set of 3D objects. This allows for custom look and feel of the 3D model which is useful to highlight certain parts or to color code the 3D model based on information (e.g. coloring the 3D model by construction status).
The NodeCollectionBase can be updated dynamically and the rendered nodes will be updated automatically as the styling changes. The appearance of the style nodes cannot be changed.
When nodes are in several styled sets, the style is combined in the order the sets were added, i.e. styled sets added late can overwrite styled sets added early.
If the nodeCollection
provided already has an assigned style, this style will
be replaced with style provided.
example
model.setDefaultNodeAppearance({ rendererGhosted: true });
const visibleNodes = new TreeIndexNodeCollection(someTreeIndices);
model.assignStyledNodeCollection(visibleSet, { rendererGhosted: false });
throws
Error if node collection already has been assigned to the model.
Parameters
Name | Type | Description |
---|---|---|
nodeCollection | NodeCollectionBase | Dynamic set of nodes to apply the provided appearance to. |
appearance | NodeAppearance | Appearance to style the provided set with. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:159
dispose
▸ dispose(): void
Cleans up used resources.
Returns
void
Implementation of
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:291
getAncestorTreeIndices
▸ getAncestorTreeIndices(treeIndex
, generation
): Promise
<NumericRange>
Determines the tree index range of a subtree of an ancestor of the provided node defined by a tree index.
Parameters
Name | Type | Description |
---|---|---|
treeIndex | number | Tree index of node to find ancestor tree index range for. |
generation | number | What "generation" to find. 0 is the node itself, 1 means parent, 2 means grandparent etc. If the node doesn't have as many ancestors, the root of the model is returned. This can be determined by checking that the range returned includes 0. |
Returns
Promise
<NumericRange>
Tree index range of the subtree spanned by the ancestor at the "generation" specified, or the root.
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:315
getBoundingBoxByNodeId
▸ getBoundingBoxByNodeId(nodeId
, box?
): Promise
<Box3>
Fetches a bounding box from the CDF by the nodeId.
example
const box = new THREE.Box3()
const nodeId = 100500;
await model.getBoundingBoxByNodeId(nodeId, box);
// box now has the bounding box
// the following code does the same
const box = await model.getBoundingBoxByNodeId(nodeId);
Parameters
Name | Type | Description |
---|---|---|
nodeId | number | |
box? | Box3 | Optional. Used to write result to. |
Returns
Promise
<Box3>
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:398
getBoundingBoxByTreeIndex
▸ getBoundingBoxByTreeIndex(treeIndex
, box?
): Promise
<Box3>
Determine the bounding box of the node identified by the tree index provided. Note that this function uses the CDF API to look up the bounding box.
example
const box = new THREE.Box3()
const treeIndex = 42;
await model.getBoundingBoxByTreeIndex(treeIndex, box);
// box now has the bounding box
// the following code does the same
const box = await model.getBoundingBoxByTreeIndex(treeIndex);
Parameters
Name | Type | Description |
---|---|---|
treeIndex | number | Tree index of the node to find bounding box for. |
box? | Box3 | Optional preallocated container to hold the bounding box. |
Returns
Promise
<Box3>
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:429
getCameraConfiguration
▸ getCameraConfiguration(): CameraConfiguration
Retrieves the camera position and target stored for the model. Typically this
is used to store a good starting position for a model. Returns undefined
if there
isn't any stored camera configuration for the model.
Returns
Implementation of
CogniteModelBase.getCameraConfiguration
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:362
getDefaultNodeAppearance
▸ getDefaultNodeAppearance(): NodeAppearance
Gets the default appearance for nodes that are not styled using assignStyledNodeCollection.
Returns
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:120
getModelBoundingBox
▸ getModelBoundingBox(outBbox?
, restrictToMostGeometry?
): Box3
Determines the full bounding box of the model.
example
const box = new THREE.Box3()
model.getModelBoundingBox(box);
// box now has the bounding box
// the following code does the same
const box = model.getModelBoundingBox();
Parameters
Name | Type | Description |
---|---|---|
outBbox? | Box3 | Optional. Used to write result to. |
restrictToMostGeometry? | boolean | Optional. When true, returned bounds are restricted to where most of the geometry is located. This is useful for models that have junk geometry located far from the "main" model. Added in version 1.3.0. |
Returns
Box3
Model bounding box.
Implementation of
CogniteModelBase.getModelBoundingBox
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:346
getModelTransformation
▸ getModelTransformation(out?
): Matrix4
Gets transformation matrix of the model.
Parameters
Name | Type | Description |
---|---|---|
out? | Matrix4 | Preallocated THREE.Matrix4 (optional). |
Returns
Matrix4
Implementation of
CogniteModelBase.getModelTransformation
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:378
getSubtreeTreeIndices
▸ getSubtreeTreeIndices(treeIndex
): Promise
<NumericRange>
Determines the range of tree indices for a given subtree.
Parameters
Name | Type | Description |
---|---|---|
treeIndex | number | Index of the root of the subtree to get the index range for. |
Returns
Promise
<NumericRange>
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:299
iterateNodesByTreeIndex
▸ iterateNodesByTreeIndex(action
): Promise
<void>
Iterates over all nodes in the model and applies the provided action to each node (identified by tree index). The passed action is applied incrementally to avoid main thread blocking, meaning that the changes can be partially applied until promise is resolved (iteration is done).
example
const logIndex = (treeIndex) => console.log(treeIndex);
await model.iterateNodesByTreeIndex(logIndex); // 0, 1, 2, ...
Parameters
Name | Type | Description |
---|---|---|
action | (treeIndex : number ) => void | Function that will be called with a treeIndex argument. |
Returns
Promise
<void>
Promise that is resolved once the iteration is done.
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:446
iterateSubtreeByTreeIndex
▸ iterateSubtreeByTreeIndex(treeIndex
, action
): Promise
<void>
Iterates over all nodes in a subtree of the model and applies the provided action to each node (identified by tree index). The provided node is included in the visited set. The passed action is applied incrementally to avoid main thread blocking, meaning that the changes can be partially applied until promise is resolved (iteration is done).
example
// make a subtree to be gray
await model.iterateNodesByTreeIndex(treeIndex => {
model.setNodeColorByTreeIndex(treeIndex, 127, 127, 127);
});
Parameters
Name | Type | Description |
---|---|---|
treeIndex | number | Tree index of the top parent of the subtree. |
action | (treeIndex : number ) => void | Function that will be called with a treeIndex argument. |
Returns
Promise
<void>
Promise that is resolved once the iteration is done.
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:473
mapBoxFromModelToCdfCoordinates
▸ mapBoxFromModelToCdfCoordinates(box
, out?
): Box3
Maps from a 3D position in "ThreeJS model space" to coordinates in "CDF space". This is necessary because CDF has a right-handed Z-up coordinate system while ThreeJS uses a right-hand Y-up coordinate system. This function also accounts for transformation applied to the model.
Parameters
Name | Type | Description |
---|---|---|
box | Box3 | The box in ThreeJS/model coordinates. |
out? | Box3 | Optional preallocated buffer for storing the result. May be box . |
Returns
Box3
Transformed box.
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:279
mapFromCdfToModelCoordinates
▸ mapFromCdfToModelCoordinates(p
, out?
): Vector3
Maps a position retrieved from the CDF API (e.g. 3D node information) to coordinates in "ThreeJS model space". This is necessary because CDF has a right-handed Z-up coordinate system while ThreeJS uses a right-hand Y-up coordinate system.
Parameters
Name | Type | Description |
---|---|---|
p | Vector3 | The CDF coordinate to transform. |
out? | Vector3 | Optional preallocated buffer for storing the result. May be p . |
Returns
Vector3
Transformed position.
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:243
mapNodeIdToTreeIndex
▸ mapNodeIdToTreeIndex(nodeId
): Promise
<number>
Maps a single node ID to tree index. This is useful when you e.g. have a node ID from an asset mapping and want to highlight the given asset using mapNodeIdsToTreeIndices is recommended for better performance when mapping multiple IDs.
throws
If an invalid/non-existant node ID is provided the function throws an error.
Parameters
Name | Type | Description |
---|---|---|
nodeId | number | A Node ID to map to a tree index. |
Returns
Promise
<number>
TreeIndex of the provided node.
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:528
mapNodeIdsToTreeIndices
▸ mapNodeIdsToTreeIndices(nodeIds
): Promise
<number[]>
Maps a list of Node IDs to tree indices. This function is useful when you have a list of nodes, e.g. from Asset Mappings, that you want to highlight, hide, color etc in the viewer.
throws
If an invalid/non-existant node ID is provided the function throws an error.
Parameters
Name | Type | Description |
---|---|---|
nodeIds | number [] | List of node IDs to map to tree indices. |
Returns
Promise
<number[]>
A list of tree indices corresponing to the elements in the input.
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:514
mapPositionFromModelToCdfCoordinates
▸ mapPositionFromModelToCdfCoordinates(p
, out?
): Vector3
Maps from a 3D position in "ThreeJS model space" (e.g. a ray intersection coordinate) to coordinates in "CDF space". This is necessary because CDF has a right-handed Z-up coordinate system while ThreeJS uses a right-hand Y-up coordinate system. This function also accounts for transformation applied to the model.
Parameters
Name | Type | Description |
---|---|---|
p | Vector3 | The ThreeJS coordinate to transform. |
out? | Vector3 | Optional preallocated buffer for storing the result. May be p . |
Returns
Vector3
Transformed position.
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:261
mapTreeIndexToNodeId
▸ mapTreeIndexToNodeId(treeIndex
): Promise
<number>
Maps a single tree index to node ID for use with the API. If you have multiple tree indices to map, mapNodeIdsToTreeIndices is recommended for better performance.
throws
If an invalid/non-existent node ID is provided the function throws an error.
Parameters
Name | Type | Description |
---|---|---|
treeIndex | number | A tree index to map to a Node ID. |
Returns
Promise
<number>
TreeIndex of the provided node.
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:554
mapTreeIndicesToNodeIds
▸ mapTreeIndicesToNodeIds(treeIndices
): Promise
<number[]>
Maps a list of tree indices to node IDs for use with the Cognite SDK. This function is useful if you have a list of tree indices, e.g. from Cognite3DModel.iterateSubtreeByTreeIndex, and want to perform some operations on these nodes using the SDK.
throws
If an invalid tree index is provided the function throws an error.
Parameters
Name | Type | Description |
---|---|---|
treeIndices | number [] | Tree indices to map to node IDs. |
Returns
Promise
<number[]>
A list of node IDs corresponding to the elements of the input.
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:542
removeAllStyledNodeCollections
▸ removeAllStyledNodeCollections(): void
Removes all styled collections, resetting the appearance of all nodes to the default appearance.
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:209
resetNodeTransform
▸ resetNodeTransform(treeIndices
): void
Resets the transformation for the nodes given.
Parameters
Name | Type | Description |
---|---|---|
treeIndices | NumericRange | Tree indices of the nodes to reset transforms for. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:231
resetNodeTransformByTreeIndex
▸ resetNodeTransformByTreeIndex(treeIndex
, applyToChildren?
): Promise
<number>
Remove override transform of the node by tree index.
Parameters
Name | Type | Default value |
---|---|---|
treeIndex | number | undefined |
applyToChildren | boolean | true |
Returns
Promise
<number>
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:499
setDefaultNodeAppearance
▸ setDefaultNodeAppearance(appearance
): void
Sets the default appearance for nodes that are not styled using assignStyledNodeCollection. Updating the default style can be an expensive operation, so use with care.
Parameters
Name | Type | Description |
---|---|---|
appearance | NodeAppearance | Default node appearance. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:112
setModelTransformation
▸ setModelTransformation(matrix
): void
Sets transformation matrix of the model. This overrides the current transformation.
Parameters
Name | Type | Description |
---|---|---|
matrix | Matrix4 | Transformation matrix. |
Returns
void
Implementation of
CogniteModelBase.setModelTransformation
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:370
setNodeTransform
▸ setNodeTransform(treeIndices
, transformMatrix
): void
Apply a transformation matrix to the tree indices given, changing rotation, scale and/or position.
Note that setting multiple transformations for the same node isn't supported and might lead to undefined results.
Parameters
Name | Type | Description |
---|---|---|
treeIndices | NumericRange | Tree indices of nodes to apply the transformation to. |
transformMatrix | Matrix4 | Transformation to apply. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:223
setNodeTransformByTreeIndex
▸ setNodeTransformByTreeIndex(treeIndex
, transform
, applyToChildren?
): Promise
<number>
Set override transform of the node by tree index.
Parameters
Name | Type | Default value |
---|---|---|
treeIndex | number | undefined |
transform | Matrix4 | undefined |
applyToChildren | boolean | true |
Returns
Promise
<number>
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:484
unassignStyledNodeCollection
▸ unassignStyledNodeCollection(nodeCollection
): void
Removes styling for previously added styled collection, resetting the style to the default (or the style imposed by other styled collections).
throws
Error if node collection isn't assigned to the model.
Parameters
Name | Type | Description |
---|---|---|
nodeCollection | NodeCollectionBase | Node collection previously added using assignStyledNodeCollection. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:195
updateStyledNodeCollection
▸ updateStyledNodeCollection(nodeCollection
, newAppearance
): void
Updates styled node collections with a new appearance.
throws
Error if node collection hasn't previously been assigned using assignStyledNodeCollection.
Parameters
Name | Type | Description |
---|---|---|
nodeCollection | NodeCollectionBase | A node collection previously assigned using assignStyledNodeCollection. |
newAppearance | NodeAppearance | New appearance for the nodes in the collection. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DModel.ts:179
@cognite/reveal / Modules / @cognite/reveal / Cognite3DViewer
Class: Cognite3DViewer
@cognite/reveal.Cognite3DViewer
Table of contents
Constructors
Accessors
Methods
- addCadModel
- addModel
- addObject3D
- addPointCloudModel
- addUiObject
- determineModelType
- disableKeyboardNavigation
- dispose
- enableKeyboardNavigation
- fitCameraToBoundingBox
- fitCameraToModel
- getCamera
- getCameraControlsOptions
- getCameraPosition
- getCameraTarget
- getClippingPlanes
- getIntersectionFromPixel
- getScene
- getScreenshot
- getVersion
- getViewState
- loadCameraFromModel
- off
- on
- removeModel
- removeObject3D
- removeUiObject
- requestRedraw
- setBackgroundColor
- setCameraControlsOptions
- setCameraPosition
- setCameraTarget
- setClippingPlanes
- setLogLevel
- setSlicingPlanes
- setViewState
- worldToScreen
- isBrowserSupported
Constructors
constructor
• new Cognite3DViewer(options
)
Parameters
Name | Type |
---|---|
options | Cognite3DViewerOptions |
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:193
Accessors
cadBudget
• get
cadBudget(): CadModelBudget
Gets the current budget for downloading geometry for CAD models. Note that this budget is shared between all added CAD models and not a per-model budget.
Returns
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:149
• set
cadBudget(budget
): void
Sets the current budget for downloading geometry for CAD models. Note that this budget is shared between all added CAD models and not a per-model budget.
Parameters
Name | Type |
---|---|
budget | CadModelBudget |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:159
cameraControls
• get
cameraControls(): ComboControls
Gets the camera controller. See https://www.npmjs.com/package/@cognite/three-combo-controls
for documentation. Note that by default the minDistance
setting of the controls will
be automatic. This can be disabled using Cognite3DViewerOptions.automaticControlsSensitivity.
Returns
ComboControls
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:898
cameraControlsEnabled
• get
cameraControlsEnabled(): boolean
Gets whether camera controls through mouse, touch and keyboard are enabled.
Returns
boolean
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:905
• set
cameraControlsEnabled(enabled
): void
Sets whether camera controls through mouse, touch and keyboard are enabled. This can be useful to e.g. temporarily disable navigation when manipulating other objects in the scene or when implementing a "cinematic" viewer.
Parameters
Name | Type |
---|---|
enabled | boolean |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:914
domElement
• get
domElement(): HTMLElement
The DOM element the viewer will insert its rendering canvas into. The DOM element can be specified in the options when the viewer is created. If not specified, the DOM element will be created automatically. The DOM element cannot be changed after the viewer has been created.
Returns
HTMLElement
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:86
models
• get
models(): CogniteModelBase[]
Gets a list of models currently added to the viewer.
Returns
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:184
pointCloudBudget
• get
pointCloudBudget(): PointCloudBudget
Returns the point cloud budget. The budget is shared between all loaded point cloud models.
Returns
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:169
• set
pointCloudBudget(budget
): void
Sets the point cloud budget. The budget is shared between all loaded point cloud models.
Parameters
Name | Type |
---|---|
budget | PointCloudBudget |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:177
renderer
• get
renderer(): WebGLRenderer
Returns the renderer used to produce images from 3D geometry.
Returns
WebGLRenderer
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:93
Methods
addCadModel
▸ addCadModel(options
): Promise
<Cognite3DModel>
Add a new CAD 3D model to the viewer. Call Cognite3DViewer.fitCameraToModel to see the model after the model has loaded.
example
const options = {
modelId: 'COGNITE_3D_MODEL_ID',
revisionId: 'COGNITE_3D_REVISION_ID',
};
viewer.addCadModel(options).then(model => {
viewer.fitCameraToModel(model, 0);
});
Parameters
Name | Type |
---|---|
options | AddModelOptions |
Returns
Promise
<Cognite3DModel>
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:561
addModel
▸ addModel(options
): Promise
<Cognite3DModel | CognitePointCloudModel>
Add a new model to the viewer. Call Cognite3DViewer.fitCameraToModel to see the model after the model has loaded.
example
const options = {
modelId: 'COGNITE_3D_MODEL_ID',
revisionId: 'COGNITE_3D_REVISION_ID',
};
viewer.addModel(options).then(model => {
viewer.fitCameraToModel(model, 0);
});
Parameters
Name | Type |
---|---|
options | AddModelOptions |
Returns
Promise
<Cognite3DModel | CognitePointCloudModel>
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:528
addObject3D
▸ addObject3D(object
): void
Add a THREE.Object3D to the viewer.
example
const sphere = new THREE.Mesh(
new THREE.SphereBufferGeometry(),
new THREE.MeshBasicMaterial()
);
viewer.addObject3D(sphere);
Parameters
Name | Type |
---|---|
object | Object3D <Event> |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:692
addPointCloudModel
▸ addPointCloudModel(options
): Promise
<CognitePointCloudModel>
Add a new pointcloud 3D model to the viewer. Call Cognite3DViewer.fitCameraToModel to see the model after the model has loaded.
example
const options = {
modelId: 'COGNITE_3D_MODEL_ID',
revisionId: 'COGNITE_3D_REVISION_ID',
};
viewer.addPointCloudModel(options).then(model => {
viewer.fitCameraToModel(model, 0);
});
Parameters
Name | Type |
---|---|
options | AddModelOptions |
Returns
Promise
<CognitePointCloudModel>
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:589
addUiObject
▸ addUiObject(object
, screenPos
, size
): void
Add an object that will be considered a UI object. It will be rendered in the last stage and with orthographic projection.
Parameters
Name | Type | Description |
---|---|---|
object | Object3D <Event> | |
screenPos | Vector2 | Screen space position of object (in pixels). |
size | Vector2 | Pixel width and height of the object. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:732
determineModelType
▸ determineModelType(modelId
, revisionId
): Promise
<""
| SupportedModelTypes>
Use to determine of which type the model is.
example
const viewer = new Cognite3DViewer(...);
const type = await viewer.determineModelType(options.modelId, options.revisionId)
let model: Cognite3DModel | CognitePointCloudModel
switch (type) {
case 'cad':
model = await viewer.addCadModel(options);
break;
case 'pointcloud':
model = await viewer.addPointCloudModel(options);
break;
default:
throw new Error('Model is not supported');
}
viewer.fitCameraToModel(model);
Parameters
Name | Type | Description |
---|---|---|
modelId | number | The model's id. |
revisionId | number | The model's revision id. |
Returns
Promise
<""
| SupportedModelTypes>
Empty string if type is not supported.
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:663
disableKeyboardNavigation
▸ disableKeyboardNavigation(): void
Disables camera movement by pressing WASD or arrows keys.
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:1001
dispose
▸ dispose(): void
Dispose of WebGL resources. Can be used to free up memory when the viewer is no longer in use.
see
https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects
// Viewer is no longer in use, free up memory
viewer.dispose();
```.
##### Returns
`void`
##### Defined in
[viewer/core/src/public/migration/Cognite3DViewer.ts:337](https://github.com/cognitedata/reveal/blob/d2769861/viewer/core/src/public/migration/Cognite3DViewer.ts#L337)
___
#### enableKeyboardNavigation
▸ **enableKeyboardNavigation**(): `void`
Allows to move camera with WASD or arrows keys.
##### Returns
`void`
##### Defined in
[viewer/core/src/public/migration/Cognite3DViewer.ts:994](https://github.com/cognitedata/reveal/blob/d2769861/viewer/core/src/public/migration/Cognite3DViewer.ts#L994)
___
#### fitCameraToBoundingBox
▸ **fitCameraToBoundingBox**(`box`, `duration?`, `radiusFactor?`): `void`
Move camera to a place where the content of a bounding box is visible to the camera.
**`example`**
```js
// Fit camera to bounding box over 500 milliseconds
viewer.fitCameraToBoundingBox(boundingBox, 500);
// Fit camera to bounding box instantaneously
viewer.fitCameraToBoundingBox(boundingBox, 0);
// Place the camera closer to the bounding box
viewer.fitCameraToBoundingBox(boundingBox, 500, 2);
Parameters
Name | Type | Default value | Description |
---|---|---|---|
box | Box3 | undefined | The bounding box in world space. |
duration? | number | undefined | The duration of the animation moving the camera. Set this to 0 (zero) to disable animation. |
radiusFactor | number | 2 | The ratio of the distance from camera to center of box and radius of the box. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:980
fitCameraToModel
▸ fitCameraToModel(model
, duration?
): void
Move camera to a place where the 3D model is visible. It uses the bounding box of the 3D model and calls Cognite3DViewer.fitCameraToBoundingBox.
example
// Fit camera to model
viewer.fitCameraToModel(model);
// Fit camera to model over 500 milliseconds
viewer.fitCameraToModel(model, 500);
// Fit camera to model instantly
viewer.fitCameraToModel(model, 0);
Parameters
Name | Type | Description |
---|---|---|
model | CogniteModelBase | The 3D model. |
duration? | number | The duration of the animation moving the camera. Set this to 0 (zero) to disable animation. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:956
getCamera
▸ getCamera(): PerspectiveCamera
obvious
Returns
PerspectiveCamera
The THREE.Camera used for rendering.
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:816
getCameraControlsOptions
▸ getCameraControlsOptions(): CameraControlsOptions
Gets camera controls mode.
Returns
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:484
getCameraPosition
▸ getCameraPosition(): Vector3
obvious
Returns
Vector3
Camera's position in world space.
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:832
getCameraTarget
▸ getCameraTarget(): Vector3
obvious
Returns
Vector3
Camera's target in world space.
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:843
getClippingPlanes
▸ getClippingPlanes(): Plane
[]
Returns the current active clipping planes.
version
New in 2.1
Returns
Plane
[]
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:808
getIntersectionFromPixel
▸ getIntersectionFromPixel(offsetX
, offsetY
, options?
): Promise
<Intersection>
Raycasting model(s) for finding where the ray intersects with the model.
see
https://en.wikipedia.org/wiki/Ray_casting.
example
For CAD model
const offsetX = 50 // pixels from the left
const offsetY = 100 // pixels from the top
const intersection = await viewer.getIntersectionFromPixel(offsetX, offsetY);
if (intersection) // it was a hit
console.log(
'You hit model ', intersection.model,
' at the node with tree index ', intersection.treeIndex,
' at this exact point ', intersection.point
);
example
For point cloud
const offsetX = 50 // pixels from the left
const offsetY = 100 // pixels from the top
const intersection = await viewer.getIntersectionFromPixel(offsetX, offsetY);
if (intersection) // it was a hit
console.log(
'You hit model ', intersection.model,
' at the point index ', intersection.pointIndex,
' at this exact point ', intersection.point
);
Parameters
Name | Type | Description |
---|---|---|
offsetX | number | X coordinate in pixels (relative to the domElement). |
offsetY | number | Y coordinate in pixels (relative to the domElement). |
options? | IntersectionFromPixelOptions | Options to control the behavior of the intersection operation. Optional (new in 1.3.0). |
Returns
Promise
<Intersection>
A promise that if there was an intersection then return the intersection object - otherwise it
returns null
if there were no intersections.
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:1139
getScene
▸ getScene(): Scene
obvious
Returns
Scene
The THREE.Scene used for rendering.
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:824
getScreenshot
▸ getScreenshot(width?
, height?
): Promise
<string>
Take screenshot from the current camera position.
example
// Take a screenshot with custom resolution
const url = await viewer.getScreenshot(1920, 1080);
// Add a screenshot with resolution of the canvas to the page
const url = await viewer.getScreenshot();
const image = document.createElement('img');
image.src = url;
document.body.appendChild(url);
Parameters
Name | Type | Description |
---|---|---|
width | number | Width of the final image. Default is current canvas size. |
height | number | Height of the final image. Default is current canvas size. |
Returns
Promise
<string>
A Data URL of the image ('image/png').
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:1081
getVersion
▸ getVersion(): string
Returns reveal version installed.
Returns
string
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:310
getViewState
▸ getViewState(): ViewerState
Gets the current viewer state which includes the camera pose as well as applied styling.
Returns
JSON object containing viewer state.
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:492
loadCameraFromModel
▸ loadCameraFromModel(model
): void
Attempts to load the camera settings from the settings stored for the provided model. See https://docs.cognite.com/api/v1/#operation/get3DRevision and https://docs.cognite.com/api/v1/#operation/update3DRevisions for information on how this setting is retrieved and stored. This setting can also be changed through the 3D models management interface in Cognite Fusion. If no camera configuration is stored in CDF, Cognite3DViewer.fitCameraToModel is used as a fallback.
Parameters
Name | Type | Description |
---|---|---|
model | CogniteModelBase | The model to load camera settings from. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:928
off
▸ off(event
, callback
): void
example
viewer.off('click', onClick);
Parameters
Name | Type |
---|---|
event | "click" | "hover" |
callback | PointerEventDelegate |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:435
▸ off(event
, callback
): void
Parameters
Name | Type |
---|---|
event | "cameraChange" |
callback | CameraChangeDelegate |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:436
▸ off(event
, callback
): void
Parameters
Name | Type |
---|---|
event | "sceneRendered" |
callback | SceneRenderedDelegate |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:437
▸ off(event
, callback
): void
Parameters
Name | Type |
---|---|
event | "disposed" |
callback | DisposedDelegate |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:438
on
▸ on(event
, callback
): void
Triggered when the viewer is disposed. Listeners should clean up any resources held and remove the reference to the viewer.
Parameters
Name | Type |
---|---|
event | "disposed" |
callback | DisposedDelegate |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:368
▸ on(event
, callback
): void
example
const onClick = (event) => { console.log(event.offsetX, event.offsetY) };
viewer.on('click', onClick);
Parameters
Name | Type |
---|---|
event | "click" | "hover" |
callback | PointerEventDelegate |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:377
▸ on(event
, callback
): void
example
viewer.on('cameraChange', (position, target) => {
console.log('Camera changed: ', position, target);
});
Parameters
Name | Type |
---|---|
event | "cameraChange" |
callback | CameraChangeDelegate |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:386
▸ on(event
, callback
): void
Event that is triggered immediatly after the scene has been rendered.
Parameters
Name | Type | Description |
---|---|---|
event | "sceneRendered" | Metadata about the rendering frame. |
callback | SceneRenderedDelegate | Callback to trigger when the event occurs. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:392
removeModel
▸ removeModel(model
): void
Removes a model that was previously added using Cognite3DViewer.addModel, Cognite3DViewer.addCadModel or Cognite3DViewer.addPointCloudModel .
Parameters
Name | Type |
---|---|
model | CogniteModelBase |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:611
removeObject3D
▸ removeObject3D(object
): void
Remove a THREE.Object3D from the viewer.
example
const sphere = new THREE.Mesh(new THREE.SphereBufferGeometry(), new THREE.MeshBasicMaterial());
viewer.addObject3D(sphere);
viewer.removeObject3D(sphere);
Parameters
Name | Type |
---|---|
object | Object3D <Event> |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:713
removeUiObject
▸ removeUiObject(object
): void
Removes the UI object from the viewer.
Parameters
Name | Type |
---|---|
object | Object3D <Event> |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:741
requestRedraw
▸ requestRedraw(): void
Typically used when you perform some changes and can't see them unless you move camera.
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:987
setBackgroundColor
▸ setBackgroundColor(color
): void
Sets the color used as the clear color of the renderer.
Parameters
Name | Type |
---|---|
color | Color |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:751
setCameraControlsOptions
▸ setCameraControlsOptions(controlsOptions
): void
Sets camera control options. See CameraControlsOptions.
Parameters
Name | Type | Description |
---|---|---|
controlsOptions | CameraControlsOptions | JSON object with camera controls options. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:477
setCameraPosition
▸ setCameraPosition(position
): void
obvious
example
// store position, target
const position = viewer.getCameraPosition();
const target = viewer.getCameraTarget();
// restore position, target
viewer.setCameraPosition(position);
viewer.setCameraTarget(target);
Parameters
Name | Type | Description |
---|---|---|
position | Vector3 | Position in world space. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:863
setCameraTarget
▸ setCameraTarget(target
, animated?
): void
Set camera's target.
example
// store position, target
const position = viewer.getCameraPosition();
const target = viewer.getCameraTarget();
// restore position, target
viewer.setCameraPosition(position);
viewer.setCameraTarget(target);
Parameters
Name | Type | Default value | Description |
---|---|---|---|
target | Vector3 | undefined | Target in world space. |
animated | boolean | false | Whether change of target should be animated or not (default is false). |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:885
setClippingPlanes
▸ setClippingPlanes(clippingPlanes
): void
Sets per-pixel clipping planes. Pixels behind any of the planes will be sliced away.
example
// Hide pixels with values less than 0 in the x direction
const plane = new THREE.Plane(new THREE.Vector3(1, 0, 0), 0);
viewer.setClippingPlanes([plane]);
// Hide pixels with values greater than 20 in the x direction
const plane = new THREE.Plane(new THREE.Vector3(-1, 0, 0), 20);
viewer.setClippingPlanes([plane]);
// Hide pixels with values less than 0 in the x direction or greater than 0 in the y direction
const xPlane = new THREE.Plane(new THREE.Vector3(1, 0, 0), 0);
const yPlane = new THREE.Plane(new THREE.Vector3(0, -1, 0), 0);
viewer.setClippingPlanes([xPlane, yPlane]);
// Hide pixels behind an arbitrary, non axis-aligned plane
const plane = new THREE.Plane(new THREE.Vector3(1.5, 20, -19), 20);
viewer.setClippingPlanes([plane]);
// Disable clipping planes
viewer.setClippingPlanes([]);
Parameters
Name | Type | Description |
---|---|---|
clippingPlanes | Plane [] | The planes to use for clipping. |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:791
setLogLevel
▸ setLogLevel(level
): void
Sets the log level. Used for debugging. Defaults to 'none' (which is identical to 'silent').
Parameters
Name | Type |
---|---|
level | "trace" | "debug" | "info" | "warn" | "error" | "silent" | "none" |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:319
setSlicingPlanes
▸ setSlicingPlanes(slicingPlanes
): void
deprecated
Since version 2.1, will be removed in version 3.0. Use setClippingPlanes.
Parameters
Name | Type |
---|---|
slicingPlanes | Plane [] |
Returns
void
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:800
setViewState
▸ setViewState(state
): Promise
<void>
Restores camera settings from the state provided, and clears all current styled
node collections and applies the state
object.
Parameters
Name | Type | Description |
---|---|---|
state | ViewerState | Viewer state retrieved from Cognite3DViewer.getViewState. |
Returns
Promise
<void>
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:502
worldToScreen
▸ worldToScreen(point
, normalize?
): Vector2
Convert a point in world space to its coordinates in the canvas. This can be used to place HTML objects near 3D objects on top of the 3D viewer.
see
https://www.w3schools.com/graphics/canvas_coordinates.asp.
example
const boundingBoxCenter = new THREE.Vector3();
// Find center of bounding box in world space
model.getBoundingBox(nodeId).getCenter(boundingBoxCenter);
// Screen coordinates of that point
const screenCoordinates = viewer.worldToScreen(boundingBoxCenter);
const boundingBoxCenter = new THREE.Vector3();
// Find center of bounding box in world space
model.getBoundingBox(nodeId).getCenter(boundingBoxCenter);
// Screen coordinates of that point normalized in the range [0,1]
const screenCoordinates = viewer.worldToScreen(boundingBoxCenter, true);
const boundingBoxCenter = new THREE.Vector3();
// Find center of bounding box in world space
model.getBoundingBox(nodeId).getCenter(boundingBoxCenter);
// Screen coordinates of that point
const screenCoordinates = viewer.worldToScreen(boundingBoxCenter);
if (screenCoordinates == null) {
// Object not visible on screen
} else {
// Object is visible on screen
}
Parameters
Name | Type | Description |
---|---|---|
point | Vector3 | World space coordinate. |
normalize? | boolean | Optional. If true, coordinates are normalized into [0,1]. If false, the values are in the range [0, <canvas_size>). |
Returns
Vector2
Returns 2D coordinates if the point is visible on screen, or null
if object is outside screen.
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:1039
isBrowserSupported
▸ Static
isBrowserSupported(): true
For now it just always returns true.
see
Https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext#Browser_compatibility.
Returns
true
Defined in
viewer/core/src/public/migration/Cognite3DViewer.ts:76
@cognite/reveal / Modules / @cognite/reveal / CognitePointCloudModel
Class: CognitePointCloudModel
@cognite/reveal.CognitePointCloudModel
Hierarchy
-
Object3D
↳ CognitePointCloudModel
Implements
Table of contents
Properties
Accessors
Methods
- dispose
- getCameraConfiguration
- getClasses
- getModelBoundingBox
- getModelTransformation
- hasClass
- isClassVisible
- setClassVisible
- setModelTransformation
Properties
modelId
• Readonly
modelId: number
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:19
revisionId
• Readonly
revisionId: number
The modelId of the point cloud model in Cognite Data Fusion.
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:23
type
• Readonly
type: SupportedModelTypes = 'pointcloud'
Implementation of
Overrides
THREE.Object3D.type
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:18
Accessors
pointColorType
• get
pointColorType(): PotreePointColorType
Determines how points currently are colored.
Returns
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:146
• set
pointColorType(type
): void
Specifies how points are colored.
default
PotreePointColorType.Rgb
example
model.pointColorType = PotreePointColorType.Rgb
Parameters
Name | Type |
---|---|
type | PotreePointColorType |
Returns
void
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:158
pointShape
• get
pointShape(): PotreePointShape
Sets the point shape of each rendered point in the point cloud.
default
PotreePointShape.Circle
see
PotreePointShape.
Returns
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:182
• set
pointShape(shape
): void
Gets the point shape of each rendered point in the point cloud.
see
PotreePointShape.
Parameters
Name | Type |
---|---|
shape | PotreePointShape |
Returns
void
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:190
pointSize
• get
pointSize(): number
Returns the size of each rendered point in the point cloud.
Returns
number
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:165
• set
pointSize(size
): void
Sets the size of each rendered point in the point cloud.
default
1
Parameters
Name | Type |
---|---|
size | number |
Returns
void
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:173
visiblePointCount
• get
visiblePointCount(): number
Returns the current number of visible/loaded points.
Returns
number
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:139
Methods
dispose
▸ dispose(): void
Used to clean up memory.
Returns
void
Implementation of
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:48
getCameraConfiguration
▸ getCameraConfiguration(): CameraConfiguration
Retrieves the camera position and target stored for the model. Typically this
is used to store a good starting position for a model. Returns undefined
if there
isn't any stored camera configuration for the model.
Returns
Implementation of
CogniteModelBase.getCameraConfiguration
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:76
getClasses
▸ getClasses(): number
[]
Returns a list of sorted classification codes present in the model.
Returns
number
[]
A sorted list of classification codes from the model.
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:132
getModelBoundingBox
▸ getModelBoundingBox(outBbox?
): Box3
example
const box = new THREE.Box3()
model.getModelBoundingBox(box);
// box now has the bounding box
// the following code does the same
const box = model.getModelBoundingBox();
Parameters
Name | Type | Description |
---|---|---|
outBbox? | Box3 | Optional. Used to write result to. |
Returns
Box3
Model's bounding box.
Implementation of
CogniteModelBase.getModelBoundingBox
Defined in
viewer/core/src/public/migration/CognitePointCloudModel.ts:67
getModelTransformation
▸ getModelTransformation(out?
): Matrix4
Gets transformation matrix of the model.
Parameters
Name | Type | Description |
---|---|---|
out? | Matrix4 | Preallocated THREE.Matrix4 (optional). |
Returns
Matrix4