@cognite/reveal 2.0.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/core/cad.d.ts +4 -0
- package/core/index.d.ts +7 -0
- package/{datamodels → core/src/datamodels}/base/SupportedModelTypes.d.ts +0 -0
- package/{datamodels → core/src/datamodels}/base/index.d.ts +1 -1
- package/{datamodels → core/src/datamodels}/base/types.d.ts +1 -0
- package/{datamodels → core/src/datamodels}/cad/CadManager.d.ts +8 -11
- package/{datamodels → core/src/datamodels}/cad/CadModelFactory.d.ts +2 -3
- package/{datamodels → core/src/datamodels}/cad/CadModelSectorLoadStatistics.d.ts +0 -0
- package/core/src/datamodels/cad/createCadManager.d.ts +9 -0
- package/{datamodels → core/src/datamodels}/cad/picking.d.ts +1 -1
- package/{datamodels → core/src/datamodels}/cad/rendering/RenderAlreadyLoadedGeometryProvider.d.ts +2 -2
- package/{datamodels → core/src/datamodels}/cad/sector/CadModelClipper.d.ts +1 -1
- package/{datamodels → core/src/datamodels}/cad/styling/AssetNodeCollection.d.ts +3 -4
- package/{datamodels → core/src/datamodels}/cad/styling/InvertedNodeCollection.d.ts +3 -3
- package/{datamodels → core/src/datamodels}/cad/styling/NodeCollectionDeserializer.d.ts +1 -1
- package/{datamodels → core/src/datamodels}/cad/styling/PopulateIndexSetFromPagedResponseHelper.d.ts +1 -2
- package/{datamodels → core/src/datamodels}/cad/styling/PropertyFilterNodeCollection.d.ts +3 -10
- package/{datamodels → core/src/datamodels}/cad/styling/SinglePropertyFilterNodeCollection.d.ts +4 -14
- package/{datamodels → core/src/datamodels}/cad/styling/index.d.ts +2 -7
- package/{datamodels → core/src/datamodels}/pointcloud/PointCloudFactory.d.ts +1 -1
- package/{datamodels → core/src/datamodels}/pointcloud/PointCloudManager.d.ts +9 -5
- package/{datamodels → core/src/datamodels}/pointcloud/PointCloudMetadata.d.ts +1 -1
- package/core/src/datamodels/pointcloud/PointCloudMetadataRepository.d.ts +13 -0
- package/{datamodels → core/src/datamodels}/pointcloud/PointCloudNode.d.ts +2 -1
- package/{datamodels → core/src/datamodels}/pointcloud/PotreeGroupWrapper.d.ts +7 -1
- package/{datamodels → core/src/datamodels}/pointcloud/PotreeNodeWrapper.d.ts +0 -0
- package/core/src/datamodels/pointcloud/createPointCloudManager.d.ts +6 -0
- package/{datamodels → core/src/datamodels}/pointcloud/index.d.ts +0 -0
- package/{datamodels → core/src/datamodels}/pointcloud/picking.d.ts +0 -0
- package/{datamodels → core/src/datamodels}/pointcloud/types.d.ts +0 -0
- package/core/src/index.d.ts +19 -0
- package/core/src/internals.d.ts +15 -0
- package/{migration.d.ts → core/src/migration.d.ts} +0 -0
- package/{public → core/src/public}/RevealManager.d.ts +16 -12
- package/{public → core/src/public}/createRevealManager.d.ts +3 -4
- package/{public → core/src/public}/migration/Cognite3DModel.d.ts +35 -6
- package/{public → core/src/public}/migration/Cognite3DViewer.d.ts +47 -16
- package/{public → core/src/public}/migration/CogniteModelBase.d.ts +0 -0
- package/{public → core/src/public}/migration/CognitePointCloudModel.d.ts +2 -8
- package/{public → core/src/public}/migration/NodeIdAndTreeIndexMaps.d.ts +0 -0
- package/{public → core/src/public}/migration/NotSupportedInMigrationWrapperError.d.ts +0 -0
- package/{public → core/src/public}/migration/RenderController.d.ts +0 -0
- package/{public → core/src/public}/migration/types.d.ts +47 -3
- package/core/src/public/types.d.ts +46 -0
- package/core/src/storage/RevealManagerHelper.d.ts +58 -0
- package/{utilities → core/src/utilities}/BoundingBoxClipper.d.ts +0 -0
- package/{utilities → core/src/utilities}/Spinner.d.ts +4 -5
- package/{utilities → core/src/utilities}/ViewStateHelper.d.ts +5 -5
- package/{utilities → core/src/utilities}/callActionWithIndicesAsync.d.ts +0 -0
- package/core/src/utilities/index.d.ts +8 -0
- package/{utilities → core/src/utilities}/reflection.d.ts +0 -6
- package/{utilities → core/src/utilities}/worldToViewport.d.ts +1 -2
- package/{utilities/events/clickOrTouchEventOffset.d.ts → core/utilities.d.ts} +1 -1
- package/extensions/datasource.d.ts +9 -0
- package/extensions/datasource.js +33 -0
- package/extensions/datasource.map +1 -0
- package/index.d.ts +2 -14
- package/index.js +182 -122
- package/index.map +1 -1
- package/package.json +47 -120
- package/packages/cad-geometry-loaders/index.d.ts +14 -0
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/CadLoadingHints.d.ts +0 -0
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/CadModelSectorBudget.d.ts +6 -1
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/CadModelUpdateHandler.d.ts +3 -3
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/CachedRepository.d.ts +3 -4
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/ModelStateHandler.d.ts +1 -1
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/Repository.d.ts +1 -1
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/SectorLoader.d.ts +1 -1
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/SimpleAndDetailedToSector3D.d.ts +4 -4
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/culling/ByVisibilityGpuSectorCuller.d.ts +1 -1
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/culling/OccludingGeometryProvider.d.ts +0 -0
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/culling/OrderSectorsByVisibilityCoverage.d.ts +1 -2
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/culling/SectorCuller.d.ts +1 -1
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/culling/TakenSectorTree.d.ts +2 -2
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/culling/types.d.ts +7 -3
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/rxSectorUtilities.d.ts +1 -1
- package/{datamodels/cad → packages/cad-geometry-loaders/src}/sector/sectorUtilities.d.ts +6 -6
- package/{utilities → packages/cad-geometry-loaders/src/utilities}/PromiseUtils.d.ts +0 -0
- package/{utilities → packages/cad-geometry-loaders/src/utilities}/arrays.d.ts +0 -0
- package/{datamodels/cad/sector → packages/cad-geometry-loaders/src/utilities}/groupMeshesByNumber.d.ts +0 -0
- package/packages/cad-geometry-loaders/src/utilities/rxOperations.d.ts +6 -0
- package/packages/cad-geometry-loaders/src/utilities/types.d.ts +25 -0
- package/packages/cad-parsers/index.d.ts +21 -0
- package/{datamodels/cad/sector → packages/cad-parsers/src/cad}/CadSectorParser.d.ts +2 -3
- package/{datamodels/cad/sector → packages/cad-parsers/src/cad}/LevelOfDetail.d.ts +0 -0
- package/{datamodels/cad/rendering → packages/cad-parsers/src/cad}/filterInstanceMesh.d.ts +0 -0
- package/{datamodels/cad/rendering → packages/cad-parsers/src/cad}/filterPrimitives.d.ts +0 -0
- package/{datamodels/cad/rendering → packages/cad-parsers/src/cad}/primitiveGeometries.d.ts +0 -0
- package/{datamodels/cad/rendering → packages/cad-parsers/src/cad}/triangleMeshes.d.ts +1 -1
- package/packages/cad-parsers/src/cad/types.d.ts +56 -0
- package/{datamodels/cad/parsers → packages/cad-parsers/src/metadata}/CadMetadataParser.d.ts +1 -1
- package/{datamodels/cad → packages/cad-parsers/src/metadata}/CadModelMetadata.d.ts +2 -2
- package/packages/cad-parsers/src/metadata/CadModelMetadataRepository.d.ts +16 -0
- package/packages/cad-parsers/src/metadata/MetadataRepository.d.ts +7 -0
- package/{datamodels/cad → packages/cad-parsers/src/metadata}/parsers/CadMetadataParserV8.d.ts +2 -1
- package/packages/cad-parsers/src/metadata/types.d.ts +41 -0
- package/{datamodels/cad → packages/cad-parsers/src}/sector/RootSectorNode.d.ts +1 -1
- package/{datamodels/cad → packages/cad-parsers/src}/sector/SectorNode.d.ts +3 -2
- package/{datamodels/cad/sector → packages/cad-parsers/src/utilities}/SectorScene.d.ts +2 -2
- package/packages/cad-parsers/src/utilities/SectorSceneFactory.d.ts +9 -0
- package/{datamodels/cad/rendering → packages/cad-parsers/src/utilities}/computeBoundingBoxFromAttributes.d.ts +0 -0
- package/{datamodels/cad/rendering → packages/cad-parsers/src/utilities}/float32BufferToMatrix.d.ts +0 -0
- package/packages/cad-parsers/src/utilities/types.d.ts +48 -0
- package/packages/cad-styling/index.d.ts +9 -0
- package/{datamodels/cad/styling → packages/cad-styling/src}/CombineNodeCollectionBase.d.ts +2 -2
- package/{datamodels/cad/styling → packages/cad-styling/src}/IntersectionNodeCollection.d.ts +1 -1
- package/{datamodels/cad → packages/cad-styling/src}/NodeAppearance.d.ts +1 -7
- package/{datamodels/cad/styling → packages/cad-styling/src}/NodeAppearanceProvider.d.ts +6 -2
- package/{datamodels/cad/styling → packages/cad-styling/src}/NodeCollectionBase.d.ts +1 -1
- package/{datamodels/cad/styling → packages/cad-styling/src}/TreeIndexNodeCollection.d.ts +1 -2
- package/{datamodels/cad/styling → packages/cad-styling/src}/UnionNodeCollection.d.ts +1 -1
- package/packages/camera-manager/index.d.ts +4 -0
- package/{combo-camera-controls → packages/camera-manager/src}/ComboControls.d.ts +35 -34
- package/packages/camera-manager/src/Keyboard.d.ts +17 -0
- package/packages/data-source/index.d.ts +6 -0
- package/packages/data-source/src/CdfDataSource.d.ts +19 -0
- package/packages/data-source/src/DataSource.d.ts +26 -0
- package/packages/data-source/src/LocalDataSource.d.ts +15 -0
- package/packages/logger/index.d.ts +5 -0
- package/packages/logger/src/Log.d.ts +5 -0
- package/packages/metrics/index.d.ts +5 -0
- package/packages/metrics/src/MetricsLogger.d.ts +21 -0
- package/packages/metrics/src/types.d.ts +7 -0
- package/packages/modeldata-api/index.d.ts +13 -0
- package/packages/modeldata-api/src/CdfModelDataProvider.d.ts +15 -0
- package/packages/modeldata-api/src/CdfModelIdentifier.d.ts +17 -0
- package/packages/modeldata-api/src/CdfModelMetadataProvider.d.ts +19 -0
- package/packages/modeldata-api/src/CdfModelOutputsProvider.d.ts +15 -0
- package/packages/modeldata-api/src/LocalModelDataProvider.d.ts +10 -0
- package/packages/modeldata-api/src/LocalModelIdentifier.d.ts +14 -0
- package/packages/modeldata-api/src/LocalModelMetadataProvider.d.ts +14 -0
- package/{utilities/networking → packages/modeldata-api/src}/Model3DOutputList.d.ts +1 -2
- package/packages/modeldata-api/src/ModelIdentifier.d.ts +12 -0
- package/packages/modeldata-api/src/ModelMetadataProvider.d.ts +17 -0
- package/{utilities/networking → packages/modeldata-api/src}/applyDefaultModelTransformation.d.ts +1 -1
- package/packages/modeldata-api/src/types.d.ts +41 -0
- package/packages/modeldata-api/src/utilities.d.ts +7 -0
- package/packages/nodes-api/index.d.ts +6 -0
- package/packages/nodes-api/src/NodesApiClient.d.ts +52 -0
- package/packages/nodes-api/src/NodesCdfClient.d.ts +24 -0
- package/packages/nodes-api/src/NodesLocalClient.d.ts +30 -0
- package/packages/nodes-api/src/types.d.ts +10 -0
- package/packages/rendering/index.d.ts +17 -0
- package/{datamodels/cad → packages/rendering/src}/CadMaterialManager.d.ts +3 -4
- package/{datamodels/cad → packages/rendering/src}/InstancedMeshManager.d.ts +1 -1
- package/{datamodels/cad → packages/rendering/src}/cameraconfig.d.ts +1 -1
- package/{datamodels/cad → packages/rendering/src}/rendering/EffectRenderManager.d.ts +29 -13
- package/{datamodels/cad/styling → packages/rendering/src/rendering}/NodeAppearanceTextureBuilder.d.ts +8 -8
- package/{datamodels/cad → packages/rendering/src}/rendering/RenderMode.d.ts +0 -0
- package/{datamodels/cad → packages/rendering/src}/rendering/createSimpleGeometryMesh.d.ts +0 -0
- package/{datamodels/cad → packages/rendering/src}/rendering/matCapTextureData.d.ts +0 -0
- package/{datamodels/cad → packages/rendering/src}/rendering/materials.d.ts +0 -0
- package/{datamodels/cad → packages/rendering/src}/rendering/primitives.d.ts +3 -3
- package/{datamodels/cad → packages/rendering/src}/rendering/shaders.d.ts +1 -1
- package/packages/rendering/src/rendering/types.d.ts +76 -0
- package/{datamodels/cad → packages/rendering/src/sector}/CadNode.d.ts +7 -10
- package/{datamodels/cad/styling → packages/rendering/src/transform}/NodeTransformProvider.d.ts +0 -0
- package/{datamodels/cad/styling → packages/rendering/src/transform}/NodeTransformTextureBuilder.d.ts +1 -1
- package/{datamodels/cad/styling → packages/rendering/src/transform}/TransformOverrideBuffer.d.ts +3 -3
- package/packages/rendering/src/utilities/types.d.ts +26 -0
- package/packages/tools/index.d.ts +15 -0
- package/{tools → packages/tools/src}/AxisView/AxisViewTool.d.ts +2 -2
- package/{tools → packages/tools/src}/AxisView/types.d.ts +0 -0
- package/{tools → packages/tools/src}/Cognite3DViewerToolBase.d.ts +0 -0
- package/{tools → packages/tools/src}/DebugCameraTool.d.ts +1 -1
- package/{tools → packages/tools/src}/DebugLoadedSectorsTool.d.ts +4 -3
- package/{tools → packages/tools/src}/ExplodedViewTool.d.ts +1 -1
- package/packages/tools/src/Geomap/Geomap.d.ts +17 -0
- package/packages/tools/src/Geomap/GeomapTool.d.ts +24 -0
- package/packages/tools/src/Geomap/MapConfig.d.ts +195 -0
- package/packages/tools/src/HtmlOverlay/BucketGrid2D.d.ts +28 -0
- package/packages/tools/src/HtmlOverlay/HtmlOverlayTool.d.ts +159 -0
- package/packages/tools/src/Timeline/Keyframe.d.ts +38 -0
- package/packages/tools/src/Timeline/TimelineTool.d.ts +79 -0
- package/packages/tools/src/Timeline/types.d.ts +13 -0
- package/packages/tools/src/types.d.ts +4 -0
- package/packages/utilities/index.d.ts +24 -0
- package/packages/utilities/src/CameraConfiguration.d.ts +10 -0
- package/{utilities → packages/utilities/src}/IndexSet.d.ts +0 -0
- package/{utilities → packages/utilities/src}/NumericRange.d.ts +1 -1
- package/packages/utilities/src/RandomColors.d.ts +34 -0
- package/{utilities → packages/utilities/src}/WebGLRendererStateHelper.d.ts +0 -0
- package/{utilities → packages/utilities/src}/assertNever.d.ts +0 -0
- package/{utilities → packages/utilities/src}/cache/MemoryRequestCache.d.ts +0 -0
- package/{utilities → packages/utilities/src/cache}/MostFrequentlyUsedCache.d.ts +0 -0
- package/{utilities → packages/utilities/src}/cache/RequestCache.d.ts +0 -0
- package/{utilities → packages/utilities/src}/datastructures/DynamicDefragmentedBuffer.d.ts +2 -2
- package/{utilities → packages/utilities/src}/determinePowerOfTwoDimensions.d.ts +0 -0
- package/{utilities → packages/utilities/src}/disposeAttributeArrayOnUpload.d.ts +0 -0
- package/{utilities → packages/utilities/src}/events/EventTrigger.d.ts +0 -0
- package/packages/utilities/src/events/clickOrTouchEventOffset.d.ts +13 -0
- package/{utilities → packages/utilities/src}/events/index.d.ts +0 -0
- package/{utilities → packages/utilities/src}/indexset/IndexSet.d.ts +0 -0
- package/{utilities → packages/utilities/src}/indexset/IntermediateIndexNode.d.ts +0 -0
- package/{utilities → packages/utilities/src}/indexset/LeafIndexNode.d.ts +0 -0
- package/{utilities → packages/utilities/src}/isMobileOrTablet.d.ts +0 -0
- package/{utilities → packages/utilities/src}/networking/isTheSameDomain.d.ts +0 -0
- package/{utilities → packages/utilities/src}/objectTraversal.d.ts +0 -0
- package/{utilities → packages/utilities/src}/packFloat.d.ts +0 -0
- package/{revealEnv.d.ts → packages/utilities/src/revealEnv.d.ts} +0 -0
- package/{utilities → packages/utilities/src}/three/AutoDisposeGroup.d.ts +0 -0
- package/{utilities → packages/utilities/src}/three/BoundingBoxLOD.d.ts +0 -0
- package/{utilities → packages/utilities/src}/three/getBox3CornerPoints.d.ts +0 -0
- package/{utilities → packages/utilities/src}/transformCameraConfiguration.d.ts +1 -1
- package/packages/utilities/src/types.d.ts +10 -0
- package/{utilities → packages/utilities/src}/workers/WorkerPool.d.ts +0 -0
- package/tools.d.ts +1 -7
- package/tools.js +199 -12
- package/tools.map +1 -1
- package/combo-camera-controls/Keyboard.d.ts +0 -14
- package/combo-camera-controls/index.d.ts +0 -4
- package/datamodels/base/MetadataRepository.d.ts +0 -6
- package/datamodels/cad/CadModelMetadataRepository.d.ts +0 -15
- package/datamodels/cad/createCadManager.d.ts +0 -13
- package/datamodels/cad/index.d.ts +0 -8
- package/datamodels/cad/rendering/types.d.ts +0 -25
- package/datamodels/cad/sector/types.d.ts +0 -114
- package/datamodels/pointcloud/PointCloudMetadataRepository.d.ts +0 -12
- package/datamodels/pointcloud/createPointCloudManager.d.ts +0 -10
- package/internals.d.ts +0 -27
- package/public/types.d.ts +0 -121
- package/tools/HtmlOverlayTool.d.ts +0 -88
- package/utilities/index.d.ts +0 -13
- package/utilities/metrics.d.ts +0 -15
- package/utilities/networking/CdfModelDataClient.d.ts +0 -45
- package/utilities/networking/CogniteClientNodeIdAndTreeIndexMapper.d.ts +0 -14
- package/utilities/networking/HttpHeadersProvider.d.ts +0 -7
- package/utilities/networking/LocalModelDataClient.d.ts +0 -23
- package/utilities/networking/types.d.ts +0 -37
- package/utilities/networking/utilities.d.ts +0 -13
- package/utilities/rxOperations.d.ts +0 -7
- package/utilities/three/dumpRendererToImage.d.ts +0 -5
- package/utilities/three/index.d.ts +0 -7
- package/utilities/types.d.ts +0 -67
|
@@ -5,10 +5,10 @@ import * as THREE from 'three';
|
|
|
5
5
|
import { CogniteInternalId } from '@cognite/sdk';
|
|
6
6
|
import { CameraConfiguration } from './types';
|
|
7
7
|
import { CogniteModelBase } from './CogniteModelBase';
|
|
8
|
-
import { NumericRange } from '../../utilities';
|
|
9
8
|
import { SupportedModelTypes } from '../types';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { WellKnownUnit } from './types';
|
|
10
|
+
import { NumericRange } from '../../../../packages/utilities';
|
|
11
|
+
import { NodeCollectionBase, NodeAppearance } from '../../../../packages/cad-styling';
|
|
12
12
|
/**
|
|
13
13
|
* Represents a single 3D CAD model loaded from CDF.
|
|
14
14
|
* @noInheritDoc
|
|
@@ -16,6 +16,19 @@ import { NodeAppearance } from '../../datamodels/cad';
|
|
|
16
16
|
*/
|
|
17
17
|
export declare class Cognite3DModel extends THREE.Object3D implements CogniteModelBase {
|
|
18
18
|
readonly type: SupportedModelTypes;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the unit the coordinates for the model is stored. Returns an empty string
|
|
21
|
+
* if no unit has been stored.
|
|
22
|
+
* Note that coordinates in Reveal always are converted to meters using {@see modelUnitToMetersFactor}.
|
|
23
|
+
* @version New since 2.1
|
|
24
|
+
*/
|
|
25
|
+
get modelUnit(): WellKnownUnit | '';
|
|
26
|
+
/**
|
|
27
|
+
* Returns the conversion factor that converts from model coordinates to meters. Note that this can
|
|
28
|
+
* return undefined if the model has been stored in an unsupported unit.
|
|
29
|
+
* @version New since 2.1
|
|
30
|
+
*/
|
|
31
|
+
get modelUnitToMetersFactor(): number | undefined;
|
|
19
32
|
/**
|
|
20
33
|
* The CDF model ID of the model.
|
|
21
34
|
*/
|
|
@@ -25,7 +38,7 @@ export declare class Cognite3DModel extends THREE.Object3D implements CogniteMod
|
|
|
25
38
|
*/
|
|
26
39
|
readonly revisionId: number;
|
|
27
40
|
private readonly cadModel;
|
|
28
|
-
private readonly
|
|
41
|
+
private readonly nodesApiClient;
|
|
29
42
|
private readonly nodeIdAndTreeIndexMaps;
|
|
30
43
|
private readonly _styledNodeCollections;
|
|
31
44
|
/**
|
|
@@ -41,6 +54,13 @@ export declare class Cognite3DModel extends THREE.Object3D implements CogniteMod
|
|
|
41
54
|
* {@link assignStyledNodeCollection}.
|
|
42
55
|
*/
|
|
43
56
|
getDefaultNodeAppearance(): NodeAppearance;
|
|
57
|
+
/**
|
|
58
|
+
* Returns all currently registered node collections and associated appearance.
|
|
59
|
+
*/
|
|
60
|
+
get styledNodeCollections(): {
|
|
61
|
+
nodeCollection: NodeCollectionBase;
|
|
62
|
+
appearance: NodeAppearance;
|
|
63
|
+
}[];
|
|
44
64
|
/**
|
|
45
65
|
* Customizes rendering style for a set of nodes, e.g. to highlight, hide
|
|
46
66
|
* or color code a set of 3D objects. This allows for custom look and feel
|
|
@@ -67,12 +87,21 @@ export declare class Cognite3DModel extends THREE.Object3D implements CogniteMod
|
|
|
67
87
|
* const visibleNodes = new TreeIndexNodeCollection(someTreeIndices);
|
|
68
88
|
* model.assignStyledNodeCollection(visibleSet, { rendererGhosted: false });
|
|
69
89
|
* ```
|
|
90
|
+
* @throws Error if node collection already has been assigned to the model.
|
|
70
91
|
*/
|
|
71
92
|
assignStyledNodeCollection(nodeCollection: NodeCollectionBase, appearance: NodeAppearance): void;
|
|
93
|
+
/**
|
|
94
|
+
* Updates styled node collections with a new appearance.
|
|
95
|
+
* @param nodeCollection A node collection previously assigned using {@link assignStyledNodeCollection}.
|
|
96
|
+
* @param newAppearance New appearance for the nodes in the collection.
|
|
97
|
+
* @throws Error if node collection hasn't previously been assigned using {@link assignStyledNodeCollection}.
|
|
98
|
+
*/
|
|
99
|
+
updateStyledNodeCollection(nodeCollection: NodeCollectionBase, newAppearance: NodeAppearance): void;
|
|
72
100
|
/**
|
|
73
101
|
* Removes styling for previously added styled collection, resetting the style to the default (or
|
|
74
102
|
* the style imposed by other styled collections).
|
|
75
103
|
* @param nodeCollection Node collection previously added using {@link assignStyledNodeCollection}.
|
|
104
|
+
* @throws Error if node collection isn't assigned to the model.
|
|
76
105
|
*/
|
|
77
106
|
unassignStyledNodeCollection(nodeCollection: NodeCollectionBase): void;
|
|
78
107
|
/**
|
|
@@ -142,8 +171,8 @@ export declare class Cognite3DModel extends THREE.Object3D implements CogniteMod
|
|
|
142
171
|
* 1 means parent, 2 means grandparent etc. If the node doesn't have as many
|
|
143
172
|
* ancestors, the root of the model is returned. This can be determined by checking
|
|
144
173
|
* that the range returned includes 0.
|
|
145
|
-
* @returns
|
|
146
|
-
*
|
|
174
|
+
* @returns Tree index range of the subtree spanned by the ancestor at the
|
|
175
|
+
* "generation" specified, or the root.
|
|
147
176
|
*/
|
|
148
177
|
getAncestorTreeIndices(treeIndex: number, generation: number): Promise<NumericRange>;
|
|
149
178
|
/**
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { AddModelOptions, Cognite3DViewerOptions, Intersection, CameraChangeDelegate, PointerEventDelegate, CadModelBudget } from './types';
|
|
5
|
+
import { AddModelOptions, Cognite3DViewerOptions, Intersection, CameraChangeDelegate, PointerEventDelegate, CadModelBudget, PointCloudBudget } from './types';
|
|
6
6
|
import { CogniteModelBase } from './CogniteModelBase';
|
|
7
7
|
import { Cognite3DModel } from './Cognite3DModel';
|
|
8
8
|
import { CognitePointCloudModel } from './CognitePointCloudModel';
|
|
9
9
|
import { DisposedDelegate, SceneRenderedDelegate } from '../types';
|
|
10
10
|
import { SupportedModelTypes } from '../../datamodels/base';
|
|
11
11
|
import { IntersectionFromPixelOptions } from '../..';
|
|
12
|
-
import ComboControls from '../../combo-camera-controls';
|
|
13
12
|
import { ViewerState } from '../../utilities/ViewStateHelper';
|
|
13
|
+
import ComboControls from '../../../../packages/camera-manager';
|
|
14
14
|
/**
|
|
15
15
|
* @example
|
|
16
16
|
* ```js
|
|
@@ -22,7 +22,6 @@ import { ViewerState } from '../../utilities/ViewStateHelper';
|
|
|
22
22
|
* @module @cognite/reveal
|
|
23
23
|
*/
|
|
24
24
|
export declare class Cognite3DViewer {
|
|
25
|
-
private readonly _viewStateHelper;
|
|
26
25
|
private get canvas();
|
|
27
26
|
/**
|
|
28
27
|
* For now it just always returns true.
|
|
@@ -40,12 +39,13 @@ export declare class Cognite3DViewer {
|
|
|
40
39
|
* Returns the renderer used to produce images from 3D geometry.
|
|
41
40
|
*/
|
|
42
41
|
get renderer(): THREE.WebGLRenderer;
|
|
42
|
+
private readonly _cdfSdkClient;
|
|
43
|
+
private readonly _dataSource;
|
|
43
44
|
private readonly camera;
|
|
44
45
|
private readonly scene;
|
|
45
46
|
private readonly controls;
|
|
46
|
-
private readonly sdkClient;
|
|
47
47
|
private readonly _subscription;
|
|
48
|
-
private readonly
|
|
48
|
+
private readonly _revealManagerHelper;
|
|
49
49
|
private readonly _domElement;
|
|
50
50
|
private readonly _renderer;
|
|
51
51
|
private readonly _boundAnimate;
|
|
@@ -58,8 +58,9 @@ export declare class Cognite3DViewer {
|
|
|
58
58
|
private readonly renderController;
|
|
59
59
|
private latestRequestId;
|
|
60
60
|
private readonly clock;
|
|
61
|
-
private
|
|
61
|
+
private _clippingNeedsUpdate;
|
|
62
62
|
private readonly spinner;
|
|
63
|
+
private get revealManager();
|
|
63
64
|
/**
|
|
64
65
|
* Reusable buffers used by functions in Cognite3dViewer to avoid allocations.
|
|
65
66
|
*/
|
|
@@ -74,6 +75,16 @@ export declare class Cognite3DViewer {
|
|
|
74
75
|
* budget is shared between all added CAD models and not a per-model budget.
|
|
75
76
|
*/
|
|
76
77
|
set cadBudget(budget: CadModelBudget);
|
|
78
|
+
/**
|
|
79
|
+
* Returns the point cloud budget. The budget is shared between all loaded
|
|
80
|
+
* point cloud models.
|
|
81
|
+
*/
|
|
82
|
+
get pointCloudBudget(): PointCloudBudget;
|
|
83
|
+
/**
|
|
84
|
+
* Sets the point cloud budget. The budget is shared between all loaded
|
|
85
|
+
* point cloud models.
|
|
86
|
+
*/
|
|
87
|
+
set pointCloudBudget(budget: PointCloudBudget);
|
|
77
88
|
/**
|
|
78
89
|
* Gets a list of models currently added to the viewer.
|
|
79
90
|
*/
|
|
@@ -83,6 +94,12 @@ export declare class Cognite3DViewer {
|
|
|
83
94
|
* Returns reveal version installed.
|
|
84
95
|
*/
|
|
85
96
|
getVersion(): string;
|
|
97
|
+
/**
|
|
98
|
+
* Sets the log level. Used for debugging.
|
|
99
|
+
* Defaults to 'none' (which is identical to 'silent').
|
|
100
|
+
* @param level
|
|
101
|
+
*/
|
|
102
|
+
setLogLevel(level: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent' | 'none'): void;
|
|
86
103
|
/**
|
|
87
104
|
* Dispose of WebGL resources. Can be used to free up memory when the viewer is no longer in use.
|
|
88
105
|
* @see {@link https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects}
|
|
@@ -140,7 +157,7 @@ export declare class Cognite3DViewer {
|
|
|
140
157
|
* node collections and applies the `state` object.
|
|
141
158
|
* @param state Viewer state retrieved from {@link Cognite3DViewer.getViewState}.
|
|
142
159
|
*/
|
|
143
|
-
setViewState(state: ViewerState): void
|
|
160
|
+
setViewState(state: ViewerState): Promise<void>;
|
|
144
161
|
/**
|
|
145
162
|
* Add a new model to the viewer.
|
|
146
163
|
* Call {@link Cognite3DViewer.fitCameraToModel} to see the model after the model has loaded.
|
|
@@ -263,36 +280,46 @@ export declare class Cognite3DViewer {
|
|
|
263
280
|
*/
|
|
264
281
|
setBackgroundColor(color: THREE.Color): void;
|
|
265
282
|
/**
|
|
266
|
-
* Sets per-pixel
|
|
267
|
-
* @param
|
|
283
|
+
* Sets per-pixel clipping planes. Pixels behind any of the planes will be sliced away.
|
|
284
|
+
* @param clippingPlanes The planes to use for clipping.
|
|
268
285
|
* @example
|
|
269
286
|
* ```js
|
|
270
287
|
* // Hide pixels with values less than 0 in the x direction
|
|
271
288
|
* const plane = new THREE.Plane(new THREE.Vector3(1, 0, 0), 0);
|
|
272
|
-
* viewer.
|
|
289
|
+
* viewer.setClippingPlanes([plane]);
|
|
273
290
|
* ```
|
|
274
291
|
* ```js
|
|
275
292
|
* // Hide pixels with values greater than 20 in the x direction
|
|
276
293
|
* const plane = new THREE.Plane(new THREE.Vector3(-1, 0, 0), 20);
|
|
277
|
-
* viewer.
|
|
294
|
+
* viewer.setClippingPlanes([plane]);
|
|
278
295
|
* ```
|
|
279
296
|
* ```js
|
|
280
297
|
* // Hide pixels with values less than 0 in the x direction or greater than 0 in the y direction
|
|
281
298
|
* const xPlane = new THREE.Plane(new THREE.Vector3(1, 0, 0), 0);
|
|
282
299
|
* const yPlane = new THREE.Plane(new THREE.Vector3(0, -1, 0), 0);
|
|
283
|
-
* viewer.
|
|
300
|
+
* viewer.setClippingPlanes([xPlane, yPlane]);
|
|
284
301
|
* ```
|
|
285
302
|
* ```js
|
|
286
303
|
* // Hide pixels behind an arbitrary, non axis-aligned plane
|
|
287
304
|
* const plane = new THREE.Plane(new THREE.Vector3(1.5, 20, -19), 20);
|
|
288
|
-
* viewer.
|
|
305
|
+
* viewer.setClippingPlanes([plane]);
|
|
289
306
|
* ```
|
|
290
307
|
* ```js
|
|
291
|
-
* // Disable
|
|
292
|
-
* viewer.
|
|
308
|
+
* // Disable clipping planes
|
|
309
|
+
* viewer.setClippingPlanes([]);
|
|
293
310
|
* ```
|
|
294
311
|
*/
|
|
312
|
+
setClippingPlanes(clippingPlanes: THREE.Plane[]): void;
|
|
313
|
+
/**
|
|
314
|
+
* @param slicingPlanes
|
|
315
|
+
* @deprecated Since version 2.1, will be removed in version 3.0. Use {@link setClippingPlanes}.
|
|
316
|
+
*/
|
|
295
317
|
setSlicingPlanes(slicingPlanes: THREE.Plane[]): void;
|
|
318
|
+
/**
|
|
319
|
+
* Returns the current active clipping planes.
|
|
320
|
+
* @version New in 2.1
|
|
321
|
+
*/
|
|
322
|
+
getClippingPlanes(): THREE.Plane[];
|
|
296
323
|
/**
|
|
297
324
|
* @obvious
|
|
298
325
|
* @returns The THREE.Camera used for rendering.
|
|
@@ -514,11 +541,15 @@ export declare class Cognite3DViewer {
|
|
|
514
541
|
private getModels;
|
|
515
542
|
/** @private */
|
|
516
543
|
private moveCameraTo;
|
|
544
|
+
/**
|
|
545
|
+
* Creates a helper for managing viewer state.
|
|
546
|
+
*/
|
|
547
|
+
private createViewStateHelper;
|
|
517
548
|
/** @private */
|
|
518
549
|
private animate;
|
|
519
550
|
/** @private */
|
|
520
551
|
private updateCameraNearAndFar;
|
|
521
552
|
/** @private */
|
|
522
553
|
private resizeIfNecessary;
|
|
523
|
-
private startPointerEventListeners;
|
|
554
|
+
private readonly startPointerEventListeners;
|
|
524
555
|
}
|
|
File without changes
|
|
@@ -82,15 +82,9 @@ export declare class CognitePointCloudModel extends THREE.Object3D implements Co
|
|
|
82
82
|
*/
|
|
83
83
|
getClasses(): Array<number | WellKnownAsprsPointClassCodes>;
|
|
84
84
|
/**
|
|
85
|
-
* Returns the current
|
|
85
|
+
* Returns the current number of visible/loaded points.
|
|
86
86
|
*/
|
|
87
|
-
get
|
|
88
|
-
/**
|
|
89
|
-
* The point budget limits the number of points loaded and rendered at any given time,
|
|
90
|
-
* which helps to adapt performance requirements to the capabilities of different hardware.
|
|
91
|
-
* Recommended values are between 500.000 and 10.000.000.
|
|
92
|
-
*/
|
|
93
|
-
set pointBudget(count: number);
|
|
87
|
+
get visiblePointCount(): number;
|
|
94
88
|
/**
|
|
95
89
|
* Determines how points currently are colored.
|
|
96
90
|
*/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -12,6 +12,10 @@ export declare type Color = {
|
|
|
12
12
|
g: number;
|
|
13
13
|
b: number;
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Units supported by {@link Cognite3DModel}.
|
|
17
|
+
*/
|
|
18
|
+
export declare type WellKnownUnit = 'Meters' | 'Centimeters' | 'Millimeters' | 'Micrometers' | 'Kilometers' | 'Feet' | 'Inches' | 'Yards' | 'Miles' | 'Mils' | 'Microinches';
|
|
15
19
|
/**
|
|
16
20
|
* Callback to monitor loaded requests and progress.
|
|
17
21
|
* Use OnLoadingCallback instead of onProgress/onComplete.
|
|
@@ -39,6 +43,20 @@ export interface Cognite3DViewerOptions {
|
|
|
39
43
|
target: THREE.WebGLRenderTarget;
|
|
40
44
|
autoSetSize?: boolean;
|
|
41
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Style the loading indicator.
|
|
48
|
+
*/
|
|
49
|
+
loadingIndicatorStyle?: {
|
|
50
|
+
/**
|
|
51
|
+
* What corner the spinner should be placed in. Defaults top topLeft.
|
|
52
|
+
*/
|
|
53
|
+
placement: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
54
|
+
/**
|
|
55
|
+
* Opacity of the spinner in fractions. Valid values are between
|
|
56
|
+
* 0.2 and 1.0. Defaults to 1.0.
|
|
57
|
+
*/
|
|
58
|
+
opacity: number;
|
|
59
|
+
};
|
|
42
60
|
/**
|
|
43
61
|
* When false, camera near and far planes will not be updated automatically (defaults to true).
|
|
44
62
|
* This can be useful when you have custom content in the 3D view and need to better
|
|
@@ -92,8 +110,20 @@ export interface Cognite3DViewerOptions {
|
|
|
92
110
|
enableEdges?: boolean;
|
|
93
111
|
/** Callback to download stream progress. */
|
|
94
112
|
onLoading?: OnLoadingCallback;
|
|
113
|
+
/**
|
|
114
|
+
* Allows providing a custom data source that Reveal will
|
|
115
|
+
* use to load model data. Note that some features might not
|
|
116
|
+
* work when implementing a custom data source. Please refer
|
|
117
|
+
* to the Reveal documentation for details.
|
|
118
|
+
*
|
|
119
|
+
* Note that the data source must support {@link CdfModelIdentifier}.
|
|
120
|
+
*
|
|
121
|
+
* This cannot be used together with {@link _localModels}.
|
|
122
|
+
*/
|
|
123
|
+
customDataSource?: DataSource;
|
|
95
124
|
}
|
|
96
125
|
import { GeometryFilter } from '../../public/types';
|
|
126
|
+
import { DataSource } from '../../../../packages/data-source';
|
|
97
127
|
export { GeometryFilter };
|
|
98
128
|
/**
|
|
99
129
|
* @module @cognite/reveal
|
|
@@ -103,8 +133,6 @@ export interface AddModelOptions {
|
|
|
103
133
|
revisionId: number;
|
|
104
134
|
localPath?: string;
|
|
105
135
|
geometryFilter?: GeometryFilter;
|
|
106
|
-
orthographicCamera?: boolean;
|
|
107
|
-
onComplete?: () => void;
|
|
108
136
|
}
|
|
109
137
|
export declare type CadIntersection = {
|
|
110
138
|
/**
|
|
@@ -158,7 +186,7 @@ export declare type Intersection = CadIntersection | PointCloudIntersection;
|
|
|
158
186
|
/**
|
|
159
187
|
* @module @cognite/reveal
|
|
160
188
|
*/
|
|
161
|
-
export { CameraConfiguration } from '
|
|
189
|
+
export { CameraConfiguration } from '../../../../packages/utilities';
|
|
162
190
|
/**
|
|
163
191
|
* Delegate for pointer events.
|
|
164
192
|
* @module @cognite/reveal
|
|
@@ -208,6 +236,22 @@ export declare type CadModelBudget = {
|
|
|
208
236
|
* are very important for the framerate.
|
|
209
237
|
*/
|
|
210
238
|
readonly maximumNumberOfDrawCalls: number;
|
|
239
|
+
/**
|
|
240
|
+
* Maximum render cost. This number can be thought of as triangle count, although the number
|
|
241
|
+
* doesn't match this directly.
|
|
242
|
+
*/
|
|
243
|
+
readonly maximumRenderCost: number;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Represents a budget of how many point from point clouds can be
|
|
247
|
+
* loaded at the same time.
|
|
248
|
+
*/
|
|
249
|
+
export declare type PointCloudBudget = {
|
|
250
|
+
/**
|
|
251
|
+
* Total number of points that can be loaded for all point clouds models
|
|
252
|
+
* accumulated.
|
|
253
|
+
*/
|
|
254
|
+
readonly numberOfPoints: number;
|
|
211
255
|
};
|
|
212
256
|
/**
|
|
213
257
|
* Options to control how {@link Cognite3DViewer.getIntersectionFromPixel} behaves.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { LoadingState, SectorCuller } from '../../../packages/cad-geometry-loaders';
|
|
5
|
+
import { SectorQuads, RenderOptions } from '../../../packages/rendering';
|
|
6
|
+
import { SectorGeometry } from '../../../packages/cad-parsers';
|
|
7
|
+
/**
|
|
8
|
+
* @property logMetrics Might be used to disable usage statistics.
|
|
9
|
+
* @property nodeAppearanceProvider Style node by tree-index.
|
|
10
|
+
* @property internal Internals are for internal usage only (like unit-testing).
|
|
11
|
+
*/
|
|
12
|
+
export declare type RevealOptions = {
|
|
13
|
+
logMetrics?: boolean;
|
|
14
|
+
renderOptions?: RenderOptions;
|
|
15
|
+
internal?: {
|
|
16
|
+
parseCallback?: (parsed: {
|
|
17
|
+
lod: string;
|
|
18
|
+
data: SectorGeometry | SectorQuads;
|
|
19
|
+
}) => void;
|
|
20
|
+
sectorCuller?: SectorCuller;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export interface GeometryFilter {
|
|
24
|
+
/**
|
|
25
|
+
* The bounds to load geometry within. By default this box is in CDF coordinate space which
|
|
26
|
+
* will be transformed into coordinates relative to the model using the the model transformation
|
|
27
|
+
* which can be specified using {@link https://docs.cognite.com/api/v1/#operation/update3DRevisions |the CDF API},
|
|
28
|
+
* or set in {@link https://fusion.cognite.com/ |Cognite Fusion}.
|
|
29
|
+
* @see {@link isBoundingBoxInModelCoordinates}.
|
|
30
|
+
*/
|
|
31
|
+
boundingBox?: THREE.Box3;
|
|
32
|
+
/**
|
|
33
|
+
* When set, the geometry filter {@link boundingBox} will be considered to be in "Reveal/ThreeJS space".
|
|
34
|
+
* Rather than CDF space which is the default. When using Reveal space, the model transformation
|
|
35
|
+
* which can be specified using {@link https://docs.cognite.com/api/v1/#operation/update3DRevisions |the CDF API},
|
|
36
|
+
* or set in {@link https://fusion.cognite.com/ |Cognite Fusion}.
|
|
37
|
+
*/
|
|
38
|
+
isBoundingBoxInModelCoordinates?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Handler for events about data being loaded.
|
|
42
|
+
*/
|
|
43
|
+
export declare type LoadingStateChangeListener = (loadingState: LoadingState) => any;
|
|
44
|
+
export * from '../datamodels/pointcloud/types';
|
|
45
|
+
export * from './migration/types';
|
|
46
|
+
export { SupportedModelTypes } from '../datamodels/base';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { AddModelOptions } from '../public/migration/types';
|
|
6
|
+
import { RevealOptions } from '../public/types';
|
|
7
|
+
import { PointCloudNode, RevealManager } from '../internals';
|
|
8
|
+
import { DataSource } from '../../../packages/data-source';
|
|
9
|
+
import { CadNode } from '../../../packages/rendering';
|
|
10
|
+
import { CogniteClient } from '@cognite/sdk';
|
|
11
|
+
/**
|
|
12
|
+
* Helper for {@link RevealManager} for creating a uniform interface for
|
|
13
|
+
* working with instances that fetch models from CDF or instances that fetch
|
|
14
|
+
* models from local storage (i.e. in development/debugging).
|
|
15
|
+
*/
|
|
16
|
+
export declare class RevealManagerHelper {
|
|
17
|
+
private readonly _revealManager;
|
|
18
|
+
addCadModel: (model: AddModelOptions) => Promise<CadNode>;
|
|
19
|
+
addPointCloudModel: (model: AddModelOptions) => Promise<PointCloudNode>;
|
|
20
|
+
private constructor();
|
|
21
|
+
private constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Create helper for RevealManager that loads models from local storage. This is only
|
|
24
|
+
* meant for use in debugging and development.
|
|
25
|
+
* @param renderer
|
|
26
|
+
* @param scene
|
|
27
|
+
* @param revealOptions
|
|
28
|
+
*/
|
|
29
|
+
static createLocalHelper(renderer: THREE.WebGLRenderer, scene: THREE.Scene, revealOptions: RevealOptions): RevealManagerHelper;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a helper for RevealManager that loads models from CDF.
|
|
32
|
+
* @param renderer
|
|
33
|
+
* @param scene
|
|
34
|
+
* @param revealOptions
|
|
35
|
+
* @param sdkClient
|
|
36
|
+
*/
|
|
37
|
+
static createCdfHelper(renderer: THREE.WebGLRenderer, scene: THREE.Scene, revealOptions: RevealOptions, sdkClient: CogniteClient): RevealManagerHelper;
|
|
38
|
+
static createCustomDataSourceHelper(renderer: THREE.WebGLRenderer, scene: THREE.Scene, revealOptions: RevealOptions, dataSource: DataSource): RevealManagerHelper;
|
|
39
|
+
get revealManager(): RevealManager;
|
|
40
|
+
/**
|
|
41
|
+
* Adds a local CAD model.
|
|
42
|
+
* @param model
|
|
43
|
+
* @param revealManager
|
|
44
|
+
*/
|
|
45
|
+
private static addLocalCadModel;
|
|
46
|
+
/**
|
|
47
|
+
* Adds a CDF hosted CAD model.
|
|
48
|
+
* @param model
|
|
49
|
+
* @param revealManager
|
|
50
|
+
*/
|
|
51
|
+
private static addCdfCadModel;
|
|
52
|
+
/**
|
|
53
|
+
* Add a CDF hosted point cloud model.
|
|
54
|
+
* @param model
|
|
55
|
+
* @param revealManager
|
|
56
|
+
*/
|
|
57
|
+
private static addCdfPointCloudModel;
|
|
58
|
+
}
|
|
File without changes
|
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
+
export declare type Corner = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
5
6
|
export declare class Spinner {
|
|
6
7
|
private static readonly stylesId;
|
|
7
|
-
static classnames
|
|
8
|
-
base: string;
|
|
9
|
-
loading: string;
|
|
10
|
-
dark: string;
|
|
11
|
-
};
|
|
8
|
+
private static readonly classnames;
|
|
12
9
|
private static readonly titles;
|
|
13
10
|
private _loading;
|
|
14
11
|
private static loadStyles;
|
|
15
12
|
private readonly el;
|
|
16
13
|
constructor(parent: HTMLElement);
|
|
14
|
+
set placement(placement: Corner);
|
|
15
|
+
set opacity(fractionOpacity: number);
|
|
17
16
|
get loading(): boolean;
|
|
18
17
|
set loading(loadingState: boolean);
|
|
19
18
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import * as THREE from 'three';
|
|
5
5
|
import { Cognite3DViewer } from '../public/migration/Cognite3DViewer';
|
|
6
|
+
import { NodeAppearance } from '../../../packages/cad-styling';
|
|
6
7
|
import { CogniteClient } from '@cognite/sdk';
|
|
7
|
-
import * as THREE from 'three';
|
|
8
8
|
export declare type ViewerState = {
|
|
9
9
|
camera: {
|
|
10
10
|
position: THREE.Vector3;
|
|
@@ -26,8 +26,8 @@ export declare type ModelState = {
|
|
|
26
26
|
export declare class ViewStateHelper {
|
|
27
27
|
private readonly _cameraControls;
|
|
28
28
|
private readonly _viewer;
|
|
29
|
-
private
|
|
30
|
-
constructor(viewer: Cognite3DViewer,
|
|
29
|
+
private readonly _cdfClient;
|
|
30
|
+
constructor(viewer: Cognite3DViewer, cdfClient: CogniteClient);
|
|
31
31
|
getCurrentState(): ViewerState;
|
|
32
|
-
setState(viewerState: ViewerState): void
|
|
32
|
+
setState(viewerState: ViewerState): Promise<void>;
|
|
33
33
|
}
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
export { worldToViewportCoordinates, worldToNormalizedViewportCoordinates } from './worldToViewport';
|
|
5
|
+
export { BoundingBoxClipper } from './BoundingBoxClipper';
|
|
6
|
+
export { assertNever, EventTrigger } from '../../../packages/utilities';
|
|
7
|
+
export { LoadingState } from '../../../packages/cad-geometry-loaders';
|
|
8
|
+
export { LocalModelIdentifier, CdfModelIdentifier } from '../../../packages/modeldata-api';
|
|
@@ -5,9 +5,3 @@
|
|
|
5
5
|
* Retrieves the property type of a single property of a type.
|
|
6
6
|
*/
|
|
7
7
|
export declare type PropType<TObj, TProp extends keyof TObj> = TObj[TProp];
|
|
8
|
-
/**
|
|
9
|
-
* Removes the readonly modifier for a property.
|
|
10
|
-
*/
|
|
11
|
-
export declare type Mutable<T> = {
|
|
12
|
-
-readonly [P in keyof T]: T[P];
|
|
13
|
-
};
|
|
@@ -7,14 +7,13 @@ import * as THREE from 'three';
|
|
|
7
7
|
* relative to the canvas being rendered to. X and Y will
|
|
8
8
|
* be in range [0, 1]. Z is in range [-1, 1] if the coordinate
|
|
9
9
|
* is inside the camera near and far planes.
|
|
10
|
-
* @param renderer Renderer used to render the "world"
|
|
11
10
|
* @param camera Camera used to project point from 3D to NDC coordinates
|
|
12
11
|
* @param position3D World position in 3D
|
|
13
12
|
* @param out Optionally pre-allocated THREE.Vector3
|
|
14
13
|
* @returns Relative screen coordinates in X, Y and Z in range [-1, 1] if point
|
|
15
14
|
* is within near/far of camera.
|
|
16
15
|
*/
|
|
17
|
-
export declare function worldToNormalizedViewportCoordinates(
|
|
16
|
+
export declare function worldToNormalizedViewportCoordinates(camera: THREE.PerspectiveCamera, position3D: THREE.Vector3, out?: THREE.Vector3): THREE.Vector3;
|
|
18
17
|
/**
|
|
19
18
|
* Maps from 3D world coordinates to screen coordinates
|
|
20
19
|
* relative to the canvas. X and Y will be in absolute
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @module @cognite/reveal/extensions/datasource
|
|
6
|
+
*/
|
|
7
|
+
export { DataSource } from '../packages/data-source';
|
|
8
|
+
export { NodesApiClient } from '../packages/nodes-api';
|
|
9
|
+
export { ModelIdentifier, CdfModelIdentifier, ModelMetadataProvider, ModelDataProvider } from '../packages/modeldata-api';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var o in r)("object"==typeof exports?exports:t)[o]=r[o]}}("undefined"!=typeof self?self:this,(function(){return function(t){var e={};function r(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,o){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(o,n,function(e){return t[e]}.bind(null,n));return o},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="https://apps-cdn.cogniteapp.com/@cognite/reveal-parser-worker/1.2.0/",r(r.s=63)}({0:function(t,e){t.exports=require("three")},16:function(t,e){t.exports=require("@cognite/sdk-core")},6:function(t,e,r){"use strict";r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return n})),r.d(e,"c",(function(){return l})),r.d(e,"d",(function(){return d})),r.d(e,"f",(function(){return m})),r.d(e,"g",(function(){return h})),r.d(e,"h",(function(){return v})),r.d(e,"e",(function(){return i}));class o{constructor(t){this.client=t}get headers(){return this.client.getDefaultRequestHeaders()}async getBinaryFile(t,e){const r=`${t}/${e}`,o={...this.client.getDefaultRequestHeaders(),Accept:"*/*"};return(await async function(t,e,r=3){let o;for(let n=0;n<r;n++)try{return await fetch(t,e)}catch(t){void 0!==o&&(o=t)}throw o}(r,{headers:o,method:"GET"})).arrayBuffer()}async getJsonFile(t,e){return(await this.client.get(`${t}/${e}`)).data}}class n{constructor(t,e,r){this.revealInternalId=Symbol(`${t}/${e}[${r}]`),this.modelId=t,this.revisionId=e,this.modelFormat=r}toString(){return`${n.name} (${String(this.revealInternalId)} - ${this.modelFormat})`}}var i,s=r(0);
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright 2021 Cognite AS
|
|
4
|
+
*/!function(t){t.EptPointCloud="ept-pointcloud",t.RevealCadModel="reveal-directory",t.AnyFormat="all-outputs"}(i||(i={}));
|
|
5
|
+
/*!
|
|
6
|
+
* Copyright 2021 Cognite AS
|
|
7
|
+
*/
|
|
8
|
+
const a=(new s.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1);function u(t,e){switch(e){case i.RevealCadModel:t.premultiply(a);break;case i.EptPointCloud:break;default:throw new Error("Unknown model format '"+e)}}
|
|
9
|
+
/*!
|
|
10
|
+
* Copyright 2021 Cognite AS
|
|
11
|
+
*/class c{constructor(t,e,r){this.modelId=t,this.revisionId=e,this.outputs=r}findMostRecentOutput(t,e){const r=this.outputs.filter(r=>r.format===t&&(!e||-1!==e.indexOf(r.version)));return r.length>0?r.reduce((t,e)=>e.version>t.version?e:t):void 0}}
|
|
12
|
+
/*!
|
|
13
|
+
* Copyright 2021 Cognite AS
|
|
14
|
+
*/class l{constructor(t){this._client=t}async getModelMatrix(t){if(!(t instanceof n))throw new Error(`Model must be a ${n.name}, but got ${t.toString()}`);const{modelId:e,revisionId:r,modelFormat:o}=t,i=await this._client.revisions3D.retrieve(e,r),a=new s.Matrix4;return i.rotation&&a.makeRotationFromEuler(new s.Euler(...i.rotation)),u(a,o),a}async getModelCamera(t){if(!(t instanceof n))throw new Error(`Model must be a ${n.name}, but got ${t.toString()}`);const{modelId:e,revisionId:r}=t,o=await this._client.revisions3D.retrieve(e,r);if(o.camera&&o.camera.position&&o.camera.target){const{position:t,target:e}=o.camera;return{position:new s.Vector3(t[0],t[1],t[2]),target:new s.Vector3(e[0],e[1],e[2])}}}async getModelUri(t){if(!(t instanceof n))throw new Error(`Model must be a ${n.name}, but got ${t.toString()}`);const{modelId:e,revisionId:r,modelFormat:o}=t,i=(await this.getOutputs(t)).findMostRecentOutput(o);if(!i)throw new Error(`Model '${e}/${r}' is not compatible with this version of Reveal, because no outputs for format '(${o})' was found. If this model works with a previous version of Reveal it must be reprocessed to support this version.`);const s=i.blobId;return`${this._client.getBaseUrl()}${this.getRequestPath(s)}`}async getOutputs(t){const{modelId:e,revisionId:r,modelFormat:o}=t,n=`/api/v1/projects/${this._client.project}/3d/models/${e}/revisions/${r}/outputs`,i=void 0!==o?{params:{format:o}}:void 0,s=await this._client.get(n,i);if(200===s.status)return new c(e,r,s.data.items);throw new Error(`Unexpected response ${s.status} (payload: '${s.data})`)}getRequestPath(t){return`/api/v1/projects/${this._client.project}/3d/files/${t}`}}
|
|
15
|
+
/*!
|
|
16
|
+
* Copyright 2021 Cognite AS
|
|
17
|
+
*/class d{constructor(t){this._client=t}async getOutputs(t){const{modelId:e,revisionId:r,modelFormat:o}=t,n=`/api/v1/projects/${this._client.project}/3d/models/${e}/revisions/${r}/outputs`,i=void 0!==o?{params:{format:o}}:void 0,s=await this._client.get(n,i);if(200===s.status)return new c(e,r,s.data.items);throw new Error(`Unexpected response ${s.status} (payload: '${s.data})`)}}var f=r(16);
|
|
18
|
+
/*!
|
|
19
|
+
* Copyright 2021 Cognite AS
|
|
20
|
+
*/async function p(t){const e=await fetch(t);if(!e.ok){const t={};throw e.headers.forEach((e,r)=>{t[e]=r}),new f.HttpError(e.status,e.body,t)}return e}
|
|
21
|
+
/*!
|
|
22
|
+
* Copyright 2021 Cognite AS
|
|
23
|
+
*/class m{get headers(){return{}}async getBinaryFile(t,e){return(await p(`${t}/${e}`)).arrayBuffer()}async getJsonFile(t,e){return(await p(`${t}/${e}`)).json()}}
|
|
24
|
+
/*!
|
|
25
|
+
* Copyright 2021 Cognite AS
|
|
26
|
+
*/class h{constructor(t){this.revealInternalId=Symbol(t),this.localPath=t}toString(){return`${h.name} (${this.localPath})`}}
|
|
27
|
+
/*!
|
|
28
|
+
* Copyright 2021 Cognite AS
|
|
29
|
+
*/class v{getModelUri(t){if(!(t instanceof h))throw new Error(`Model must be a ${h.name}, but got ${t.toString()}`);return Promise.resolve(`${location.origin}/${t.localPath}`)}async getModelMatrix(t){if(!(t instanceof h))throw new Error(`Model must be a ${h.name}, but got ${t.toString()}`);const e=new s.Matrix4;return u(e,i.RevealCadModel),e}getModelCamera(t){if(!(t instanceof h))throw new Error(`Model must be a ${h.name}, but got ${t.toString()}`);return Promise.resolve(void 0)}}
|
|
30
|
+
/*!
|
|
31
|
+
* Copyright 2021 Cognite AS
|
|
32
|
+
*/},63:function(t,e,r){"use strict";r.r(e);var o=r(6);r.d(e,"CdfModelIdentifier",(function(){return o.b}))}})}));
|
|
33
|
+
//# sourceMappingURL=datasource.map
|