@cognite/reveal 2.2.0 → 3.0.0-alpha.2
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/core/src/datamodels/cad/CadManager.d.ts +5 -7
- package/core/src/datamodels/cad/CadModelFactory.d.ts +9 -3
- package/core/src/datamodels/cad/styling/AssetNodeCollection.d.ts +8 -2
- package/core/src/datamodels/cad/styling/InvertedNodeCollection.d.ts +3 -2
- package/core/src/datamodels/cad/styling/PopulateIndexSetFromPagedResponseHelper.d.ts +10 -4
- package/core/src/datamodels/cad/styling/PropertyFilterNodeCollection.d.ts +5 -11
- package/core/src/datamodels/cad/styling/SinglePropertyFilterNodeCollection.d.ts +5 -14
- package/core/src/datamodels/pointcloud/PointCloudMetadata.d.ts +7 -4
- package/core/src/datamodels/pointcloud/PointCloudMetadataRepository.d.ts +1 -0
- package/core/src/public/RevealManager.d.ts +3 -3
- package/core/src/public/migration/Cognite3DModel.d.ts +11 -10
- package/core/src/public/migration/Cognite3DViewer.d.ts +17 -13
- package/core/src/public/migration/types.d.ts +10 -23
- package/core/src/public/types.d.ts +1 -0
- package/core/src/utilities/ViewStateHelper.d.ts +10 -6
- package/extensions/datasource.d.ts +1 -1
- package/extensions/datasource.js +9 -12
- package/extensions/datasource.map +1 -1
- package/index.d.ts +2 -1
- package/index.js +204 -120
- package/index.map +1 -1
- package/package.json +6 -8
- package/packages/cad-geometry-loaders/index.d.ts +4 -5
- package/packages/cad-geometry-loaders/src/{CadModelSectorBudget.d.ts → CadModelBudget.d.ts} +3 -10
- package/packages/cad-geometry-loaders/src/CadModelUpdateHandler.d.ts +4 -6
- package/packages/cad-geometry-loaders/src/sector/ModelStateHandler.d.ts +3 -3
- package/packages/cad-geometry-loaders/src/sector/SectorDownloadScheduler.d.ts +22 -0
- package/packages/cad-geometry-loaders/src/sector/SectorLoader.d.ts +9 -6
- package/packages/cad-geometry-loaders/src/sector/culling/ByScreenSizeSectorCuller.d.ts +23 -0
- package/packages/cad-geometry-loaders/src/sector/culling/ByVisibilityGpuSectorCuller.d.ts +3 -5
- package/packages/cad-geometry-loaders/src/sector/culling/WeightFunctionsHelper.d.ts +50 -0
- package/packages/cad-geometry-loaders/src/sector/culling/computeNdcAreaOfBox.d.ts +12 -0
- package/packages/cad-geometry-loaders/src/sector/culling/computeSectorCost.d.ts +7 -0
- package/packages/cad-geometry-loaders/src/sector/culling/createV8SectorCuller.d.ts +7 -0
- package/packages/cad-geometry-loaders/src/sector/culling/takensectors/TakenSectorMapBase.d.ts +11 -0
- package/packages/cad-geometry-loaders/src/sector/culling/takensectors/TakenV8SectorMap.d.ts +17 -0
- package/packages/cad-geometry-loaders/src/sector/culling/{TakenSectorTree.d.ts → takensectors/TakenV8SectorTree.d.ts} +5 -5
- package/packages/cad-geometry-loaders/src/sector/culling/takensectors/TakenV9SectorMap.d.ts +20 -0
- package/packages/cad-geometry-loaders/src/sector/culling/takensectors/index.d.ts +5 -0
- package/packages/cad-geometry-loaders/src/sector/culling/transformBoxToNDC.d.ts +5 -0
- package/packages/cad-geometry-loaders/src/sector/culling/types.d.ts +16 -4
- package/packages/cad-geometry-loaders/src/sector/rxSectorUtilities.d.ts +2 -2
- package/packages/cad-geometry-loaders/src/utilities/PromiseUtils.d.ts +12 -2
- package/packages/cad-geometry-loaders/src/utilities/rxOperations.d.ts +3 -2
- package/packages/cad-parsers/index.d.ts +3 -3
- package/packages/cad-parsers/src/cad/filterPrimitivesCommon.d.ts +5 -0
- package/packages/cad-parsers/src/cad/{filterPrimitives.d.ts → filterPrimitivesV8.d.ts} +0 -0
- package/packages/cad-parsers/src/cad/filterPrimitivesV9.d.ts +6 -0
- package/packages/cad-parsers/src/cad/primitiveGeometries.d.ts +1 -1
- package/packages/cad-parsers/src/cad/types.d.ts +2 -2
- package/packages/cad-parsers/src/metadata/CadModelMetadata.d.ts +10 -0
- package/packages/cad-parsers/src/metadata/CadModelMetadataRepository.d.ts +2 -2
- package/packages/cad-parsers/src/metadata/parsers/CadMetadataParserGltf.d.ts +6 -0
- package/packages/cad-parsers/src/metadata/parsers/CadMetadataParserV8.d.ts +2 -47
- package/packages/cad-parsers/src/metadata/parsers/types.d.ts +60 -0
- package/packages/cad-parsers/src/metadata/types.d.ts +15 -4
- package/packages/cad-parsers/src/utilities/SectorSceneFactory.d.ts +2 -5
- package/packages/cad-parsers/src/utilities/computeBoundingBoxFromAttributes.d.ts +4 -3
- package/packages/cad-parsers/src/utilities/types.d.ts +26 -0
- package/packages/cad-styling/index.d.ts +4 -0
- package/packages/cad-styling/src/CombineNodeCollectionBase.d.ts +3 -1
- package/packages/cad-styling/src/IntersectionNodeCollection.d.ts +4 -0
- package/packages/cad-styling/src/NodeAppearance.d.ts +23 -0
- package/packages/cad-styling/src/NodeAppearanceProvider.d.ts +7 -0
- package/packages/cad-styling/src/NodeCollectionBase.d.ts +7 -0
- package/packages/cad-styling/src/TreeIndexNodeCollection.d.ts +17 -1
- package/packages/cad-styling/src/UnionNodeCollection.d.ts +3 -0
- package/packages/cad-styling/src/prioritized/AreaCollection.d.ts +39 -0
- package/packages/cad-styling/src/prioritized/BoxClusterer.d.ts +29 -0
- package/packages/cad-styling/src/prioritized/ClusteredAreaCollection.d.ts +17 -0
- package/packages/cad-styling/src/prioritized/EmptyAreaCollection.d.ts +18 -0
- package/packages/cad-styling/src/prioritized/types.d.ts +7 -0
- package/packages/camera-manager/index.d.ts +3 -1
- package/packages/camera-manager/src/CameraManager.d.ts +84 -0
- package/packages/camera-manager/src/ComboControls.d.ts +37 -20
- package/packages/camera-manager/src/Keyboard.d.ts +5 -2
- package/packages/camera-manager/src/types.d.ts +64 -0
- package/packages/data-source/src/DataSource.d.ts +0 -1
- package/packages/metrics/src/MetricsLogger.d.ts +1 -1
- package/packages/modeldata-api/index.d.ts +1 -1
- package/packages/modeldata-api/src/CdfModelDataProvider.d.ts +4 -2
- package/packages/modeldata-api/src/CdfModelIdentifier.d.ts +1 -3
- package/packages/modeldata-api/src/CdfModelMetadataProvider.d.ts +4 -3
- package/packages/modeldata-api/src/CdfModelOutputsProvider.d.ts +2 -1
- package/packages/modeldata-api/src/LocalModelDataProvider.d.ts +2 -1
- package/packages/modeldata-api/src/LocalModelMetadataProvider.d.ts +2 -0
- package/packages/modeldata-api/src/ModelMetadataProvider.d.ts +4 -3
- package/packages/modeldata-api/src/types.d.ts +7 -1
- package/packages/nodes-api/src/NodesApiClient.d.ts +4 -6
- package/packages/nodes-api/src/NodesCdfClient.d.ts +1 -1
- package/packages/nodes-api/src/NodesLocalClient.d.ts +1 -1
- package/packages/rendering/src/GeometryBatchingManager.d.ts +30 -0
- package/packages/rendering/src/rendering/primitives.d.ts +1 -1
- package/packages/rendering/src/sector/CadNode.d.ts +13 -4
- package/packages/sector-loader/index.d.ts +6 -0
- package/packages/sector-loader/src/GltfSectorRepository.d.ts +14 -0
- package/packages/{cad-geometry-loaders/src/sector/Repository.d.ts → sector-loader/src/SectorRepository.d.ts} +2 -2
- package/packages/{cad-geometry-loaders/src/sector/CachedRepository.d.ts → sector-loader/src/V8SectorRepository.d.ts} +6 -6
- package/packages/{cad-geometry-loaders/src/sector → sector-loader/src/v8}/SimpleAndDetailedToSector3D.d.ts +3 -3
- package/packages/{cad-geometry-loaders/src/utilities → sector-loader/src/v8}/arrays.d.ts +0 -0
- package/packages/{cad-geometry-loaders/src/utilities → sector-loader/src/v8}/groupMeshesByNumber.d.ts +0 -0
- package/packages/sector-loader/src/v8/sectorUtilities.d.ts +16 -0
- package/packages/sector-parser/index.d.ts +5 -0
- package/packages/sector-parser/src/GltfSectorParser.d.ts +18 -0
- package/packages/sector-parser/src/reveal-glb-parser/GlbMetadataParser.d.ts +14 -0
- package/packages/sector-parser/src/reveal-glb-parser/primitiveGeometries.d.ts +12 -0
- package/packages/sector-parser/src/types.d.ts +98 -0
- package/packages/tools/src/DebugLoadedSectorsTool.d.ts +1 -1
- package/packages/tools/src/Geomap/Geomap.d.ts +4 -1
- package/packages/tools/src/Geomap/GeomapTool.d.ts +4 -2
- package/packages/tools/src/HtmlOverlay/HtmlOverlayTool.d.ts +2 -1
- package/packages/tools/src/Timeline/Keyframe.d.ts +2 -1
- package/packages/utilities/index.d.ts +6 -2
- package/packages/utilities/src/DeferredPromise.d.ts +17 -0
- package/packages/utilities/src/NumericRange.d.ts +2 -1
- package/packages/utilities/src/WebGLRendererStateHelper.d.ts +1 -1
- package/packages/utilities/src/counterMap.d.ts +5 -0
- package/packages/utilities/src/datastructures/DynamicDefragmentedBuffer.d.ts +16 -3
- package/packages/utilities/src/events/InputHandler.d.ts +25 -0
- package/packages/utilities/src/events/index.d.ts +1 -0
- package/packages/utilities/src/indexset/IndexSet.d.ts +1 -1
- package/packages/utilities/src/three/isBox3OnPositiveSideOfPlane.d.ts +10 -0
- package/packages/utilities/src/three/toThreeBox3.d.ts +6 -0
- package/packages/utilities/src/three/visitBox3CornerPoints.d.ts +12 -0
- package/packages/utilities/src/types.d.ts +1 -0
- package/tools.js +79 -66
- package/tools.map +1 -1
- package/packages/cad-geometry-loaders/src/sector/sectorUtilities.d.ts +0 -20
- package/packages/utilities/src/three/getBox3CornerPoints.d.ts +0 -5
|
@@ -5,14 +5,12 @@ import * as THREE from 'three';
|
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
import { CadModelFactory } from './CadModelFactory';
|
|
7
7
|
import { CadModelSectorLoadStatistics } from './CadModelSectorLoadStatistics';
|
|
8
|
-
import { GeometryFilter } from '
|
|
9
|
-
import {
|
|
10
|
-
import { CadModelUpdateHandler, CadModelSectorBudget, LoadingState } from '../../../../packages/cad-geometry-loaders';
|
|
8
|
+
import { GeometryFilter } from '../../public/types';
|
|
9
|
+
import { CadModelUpdateHandler, CadModelBudget, LoadingState } from '../../../../packages/cad-geometry-loaders';
|
|
11
10
|
import { CadNode, CadMaterialManager, RenderMode } from '../../../../packages/rendering';
|
|
12
11
|
import { ModelIdentifier } from '../../../../packages/modeldata-api';
|
|
13
12
|
export declare class CadManager {
|
|
14
13
|
private readonly _materialManager;
|
|
15
|
-
private readonly _cadModelMetadataRepository;
|
|
16
14
|
private readonly _cadModelFactory;
|
|
17
15
|
private readonly _cadModelUpdateHandler;
|
|
18
16
|
private readonly _cadModelMap;
|
|
@@ -21,13 +19,13 @@ export declare class CadManager {
|
|
|
21
19
|
private readonly _markNeedsRedrawBound;
|
|
22
20
|
private readonly _materialsChangedListener;
|
|
23
21
|
get materialManager(): CadMaterialManager;
|
|
24
|
-
get budget():
|
|
25
|
-
set budget(budget:
|
|
22
|
+
get budget(): CadModelBudget;
|
|
23
|
+
set budget(budget: CadModelBudget);
|
|
26
24
|
/**
|
|
27
25
|
* Returns statistics about how data loaded (or data about to be loaded).
|
|
28
26
|
*/
|
|
29
27
|
get loadedStatistics(): CadModelSectorLoadStatistics;
|
|
30
|
-
constructor(materialManger: CadMaterialManager,
|
|
28
|
+
constructor(materialManger: CadMaterialManager, cadModelFactory: CadModelFactory, cadModelUpdateHandler: CadModelUpdateHandler);
|
|
31
29
|
dispose(): void;
|
|
32
30
|
requestRedraw(): void;
|
|
33
31
|
resetRedraw(): void;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { GeometryFilter } from '../..';
|
|
1
2
|
import { CadMaterialManager, CadNode } from '../../../../packages/rendering';
|
|
2
|
-
import {
|
|
3
|
+
import { ModelDataProvider, ModelMetadataProvider, ModelIdentifier } from '../../../../packages/modeldata-api';
|
|
3
4
|
export declare class CadModelFactory {
|
|
4
5
|
private readonly _materialManager;
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
private readonly _cadModelMetadataRepository;
|
|
7
|
+
private readonly _v8SectorRepository;
|
|
8
|
+
private readonly _gltfSectorRepository;
|
|
9
|
+
constructor(materialManager: CadMaterialManager, modelMetadataProvider: ModelMetadataProvider, modelDataProvider: ModelDataProvider);
|
|
10
|
+
createModel(externalModelIdentifier: ModelIdentifier, geometryFilter?: GeometryFilter): Promise<CadNode>;
|
|
11
|
+
private getSectorRepository;
|
|
12
|
+
dispose(): void;
|
|
7
13
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { Cognite3DModel } from '../../../public/migration/Cognite3DModel';
|
|
6
6
|
import { IndexSet } from '../../../../../packages/utilities';
|
|
7
|
-
import { NodeCollectionBase, SerializedNodeCollection } from '../../../../../packages/cad-styling';
|
|
7
|
+
import { NodeCollectionBase, SerializedNodeCollection, AreaCollection } from '../../../../../packages/cad-styling';
|
|
8
8
|
import { CogniteClient } from '@cognite/sdk';
|
|
9
9
|
/**
|
|
10
10
|
* Represents a set of nodes associated with an [asset in Cognite Fusion]{@link https://docs.cognite.com/api/v1/#tag/Assets}
|
|
@@ -16,6 +16,7 @@ export declare class AssetNodeCollection extends NodeCollectionBase {
|
|
|
16
16
|
static readonly classToken = "AssetNodeCollection";
|
|
17
17
|
private readonly _client;
|
|
18
18
|
private _indexSet;
|
|
19
|
+
private _areas;
|
|
19
20
|
private readonly _model;
|
|
20
21
|
private _fetchResultHelper;
|
|
21
22
|
private _filter;
|
|
@@ -32,8 +33,13 @@ export declare class AssetNodeCollection extends NodeCollectionBase {
|
|
|
32
33
|
assetId?: number;
|
|
33
34
|
boundingBox?: THREE.Box3;
|
|
34
35
|
}): Promise<void>;
|
|
35
|
-
|
|
36
|
+
private fetchBoundingBoxesForAssetMappings;
|
|
37
|
+
getFilter(): {
|
|
38
|
+
assetId?: number | undefined;
|
|
39
|
+
boundingBox?: THREE.Box3 | undefined;
|
|
40
|
+
} | undefined;
|
|
36
41
|
clear(): void;
|
|
37
42
|
getIndexSet(): IndexSet;
|
|
43
|
+
getAreas(): AreaCollection;
|
|
38
44
|
serialize(): SerializedNodeCollection;
|
|
39
45
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Cognite3DModel } from '../../../public/migration/Cognite3DModel';
|
|
5
5
|
import { IndexSet } from '../../../../../packages/utilities';
|
|
6
|
-
import { NodeCollectionBase, SerializedNodeCollection } from '../../../../../packages/cad-styling';
|
|
6
|
+
import { AreaCollection, NodeCollectionBase, SerializedNodeCollection } from '../../../../../packages/cad-styling';
|
|
7
7
|
/**
|
|
8
8
|
* Node collection that inverts the result from another node collection.
|
|
9
9
|
*/
|
|
@@ -15,10 +15,11 @@ export declare class InvertedNodeCollection extends NodeCollectionBase {
|
|
|
15
15
|
constructor(model: Cognite3DModel, innerSet: NodeCollectionBase);
|
|
16
16
|
get isLoading(): boolean;
|
|
17
17
|
getIndexSet(): IndexSet;
|
|
18
|
+
getAreas(): AreaCollection;
|
|
18
19
|
serialize(): SerializedNodeCollection;
|
|
19
20
|
/**
|
|
20
21
|
* Not supported.
|
|
21
22
|
* @throws Always throws an error.
|
|
22
23
|
*/
|
|
23
|
-
clear():
|
|
24
|
+
clear(): never;
|
|
24
25
|
}
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
|
+
import * as THREE from 'three';
|
|
4
5
|
import { ListResponse } from '@cognite/sdk';
|
|
5
6
|
import { IndexSet, NumericRange } from '../../../../../packages/utilities';
|
|
7
|
+
import { AreaCollection } from '../../../../../packages/cad-styling';
|
|
6
8
|
/**
|
|
7
9
|
* Helper class that populates an IndexSet based on a paged results from the Cognite SDK.
|
|
8
10
|
*/
|
|
9
11
|
export declare class PopulateIndexSetFromPagedResponseHelper<T> {
|
|
10
|
-
private readonly
|
|
12
|
+
private readonly _itemsToTreeIndexRangesCallback;
|
|
13
|
+
private readonly _itemsToAreasCallback;
|
|
11
14
|
private readonly _notifyChangedCallback;
|
|
12
15
|
private _ongoingOperations;
|
|
13
16
|
private _interrupted;
|
|
14
|
-
|
|
17
|
+
private readonly _indexSet;
|
|
18
|
+
private readonly _areas;
|
|
19
|
+
constructor(itemsToTreeIndexRangesCallback: (items: T[]) => NumericRange[], itemsToAreasCallback: (items: T[]) => Promise<THREE.Box3[]>, notifySetChangedCallback: () => void);
|
|
15
20
|
interrupt(): void;
|
|
16
21
|
get isLoading(): boolean;
|
|
22
|
+
get indexSet(): IndexSet;
|
|
23
|
+
get areas(): AreaCollection;
|
|
17
24
|
/**
|
|
18
25
|
* Loops through all the pages of the provided response and populated the IndexSet provided.
|
|
19
|
-
* @param indexSet
|
|
20
26
|
* @param request
|
|
21
27
|
* @returns True if the operation was completed, false if it was interrupted using {@link interrupt}.
|
|
22
28
|
*/
|
|
23
|
-
pageResults(
|
|
29
|
+
pageResults(request: Promise<ListResponse<T[]>>): Promise<boolean>;
|
|
24
30
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { CogniteClient } from '@cognite/sdk';
|
|
5
5
|
import { Cognite3DModel } from '../../../public/migration/Cognite3DModel';
|
|
6
|
-
import { NodeCollectionBase } from '../../../../../packages/cad-styling';
|
|
6
|
+
import { AreaCollection, NodeCollectionBase, SerializedNodeCollection } from '../../../../../packages/cad-styling';
|
|
7
7
|
import { IndexSet } from '../../../../../packages/utilities';
|
|
8
8
|
/**
|
|
9
9
|
* Options for {@link PropertyFilterNodeCollection}.
|
|
@@ -24,8 +24,8 @@ export declare class PropertyFilterNodeCollection extends NodeCollectionBase {
|
|
|
24
24
|
static readonly classToken = "PropertyFilterNodeCollection";
|
|
25
25
|
private readonly _client;
|
|
26
26
|
private _indexSet;
|
|
27
|
-
private
|
|
28
|
-
private readonly
|
|
27
|
+
private _areas;
|
|
28
|
+
private readonly _model;
|
|
29
29
|
private readonly _options;
|
|
30
30
|
private _fetchResultHelper;
|
|
31
31
|
private _filter;
|
|
@@ -45,17 +45,11 @@ export declare class PropertyFilterNodeCollection extends NodeCollectionBase {
|
|
|
45
45
|
[key: string]: string;
|
|
46
46
|
};
|
|
47
47
|
}): Promise<void>;
|
|
48
|
-
getFilter(): {};
|
|
49
48
|
/**
|
|
50
49
|
* Clears the node collection and interrupts any ongoing operations.
|
|
51
50
|
*/
|
|
52
51
|
clear(): void;
|
|
53
52
|
getIndexSet(): IndexSet;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
state: {};
|
|
57
|
-
options: {
|
|
58
|
-
requestPartitions: number;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
53
|
+
getAreas(): AreaCollection;
|
|
54
|
+
serialize(): SerializedNodeCollection;
|
|
61
55
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { Cognite3DModel } from '../../../public/migration/Cognite3DModel';
|
|
5
5
|
import { PropertyFilterNodeCollectionOptions } from './PropertyFilterNodeCollection';
|
|
6
6
|
import { IndexSet } from '../../../../../packages/utilities';
|
|
7
|
-
import { NodeCollectionBase } from '../../../../../packages/cad-styling';
|
|
7
|
+
import { AreaCollection, NodeCollectionBase, SerializedNodeCollection } from '../../../../../packages/cad-styling';
|
|
8
8
|
import { CogniteClient } from '@cognite/sdk';
|
|
9
9
|
/**
|
|
10
10
|
* Node collection that filters nodes based on a node property from a list of values, similarly to how
|
|
@@ -15,9 +15,9 @@ import { CogniteClient } from '@cognite/sdk';
|
|
|
15
15
|
export declare class SinglePropertyFilterNodeCollection extends NodeCollectionBase {
|
|
16
16
|
static readonly classToken = "SinglePropertyNodeCollection";
|
|
17
17
|
private readonly _client;
|
|
18
|
+
private readonly _model;
|
|
18
19
|
private _indexSet;
|
|
19
|
-
private
|
|
20
|
-
private readonly _revisionId;
|
|
20
|
+
private _areas;
|
|
21
21
|
private readonly _options;
|
|
22
22
|
private _fetchResultHelper;
|
|
23
23
|
private readonly _filter;
|
|
@@ -45,16 +45,7 @@ export declare class SinglePropertyFilterNodeCollection extends NodeCollectionBa
|
|
|
45
45
|
*/
|
|
46
46
|
clear(): void;
|
|
47
47
|
getIndexSet(): IndexSet;
|
|
48
|
+
getAreas(): AreaCollection;
|
|
48
49
|
private buildUrl;
|
|
49
|
-
serialize():
|
|
50
|
-
token: string;
|
|
51
|
-
state: {
|
|
52
|
-
propertyCategory: string;
|
|
53
|
-
propertyKey: string;
|
|
54
|
-
propertyValues: string[];
|
|
55
|
-
};
|
|
56
|
-
options: {
|
|
57
|
-
requestPartitions: number;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
50
|
+
serialize(): SerializedNodeCollection;
|
|
60
51
|
}
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { CameraConfiguration } from '../../../../packages/utilities';
|
|
6
|
+
import { File3dFormat } from '../../../../packages/modeldata-api';
|
|
6
7
|
export interface PointCloudMetadata {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
readonly format: File3dFormat;
|
|
9
|
+
readonly formatVersion: number;
|
|
10
|
+
readonly modelBaseUrl: string;
|
|
11
|
+
readonly modelMatrix: THREE.Matrix4;
|
|
12
|
+
readonly cameraConfiguration?: CameraConfiguration;
|
|
13
|
+
readonly scene: any;
|
|
11
14
|
}
|
|
@@ -10,4 +10,5 @@ export declare class PointCloudMetadataRepository implements MetadataRepository<
|
|
|
10
10
|
private readonly _blobFileName;
|
|
11
11
|
constructor(modelMetadataProvider: ModelMetadataProvider, modelDataProvider: ModelDataProvider, blobFileName?: string);
|
|
12
12
|
loadData(modelIdentifier: ModelIdentifier): Promise<PointCloudMetadata>;
|
|
13
|
+
private getSupportedOutput;
|
|
13
14
|
}
|
|
@@ -8,7 +8,7 @@ import { LoadingStateChangeListener, PointCloudBudget } from './types';
|
|
|
8
8
|
import { PointCloudNode } from '../datamodels/pointcloud/PointCloudNode';
|
|
9
9
|
import { CadModelSectorLoadStatistics } from '../datamodels/cad/CadModelSectorLoadStatistics';
|
|
10
10
|
import { GeometryFilter } from '..';
|
|
11
|
-
import {
|
|
11
|
+
import { CadModelBudget } from '../../../packages/cad-geometry-loaders';
|
|
12
12
|
import { NodeAppearanceProvider } from '../../../packages/cad-styling';
|
|
13
13
|
import { RenderOptions, EffectRenderManager, CadNode, RenderMode } from '../../../packages/rendering';
|
|
14
14
|
import { ModelIdentifier } from '../../../packages/modeldata-api';
|
|
@@ -35,8 +35,8 @@ export declare class RevealManager {
|
|
|
35
35
|
set renderOptions(options: RenderOptions);
|
|
36
36
|
get needsRedraw(): boolean;
|
|
37
37
|
update(camera: THREE.PerspectiveCamera): void;
|
|
38
|
-
get cadBudget():
|
|
39
|
-
set cadBudget(budget:
|
|
38
|
+
get cadBudget(): CadModelBudget;
|
|
39
|
+
set cadBudget(budget: CadModelBudget);
|
|
40
40
|
get cadLoadedStatistics(): CadModelSectorLoadStatistics;
|
|
41
41
|
get cadRenderMode(): RenderMode;
|
|
42
42
|
set cadRenderMode(renderMode: RenderMode);
|
|
@@ -20,13 +20,11 @@ export declare class Cognite3DModel extends THREE.Object3D implements CogniteMod
|
|
|
20
20
|
* Returns the unit the coordinates for the model is stored. Returns an empty string
|
|
21
21
|
* if no unit has been stored.
|
|
22
22
|
* Note that coordinates in Reveal always are converted to meters using {@see modelUnitToMetersFactor}.
|
|
23
|
-
* @version New since 2.1
|
|
24
23
|
*/
|
|
25
24
|
get modelUnit(): WellKnownUnit | '';
|
|
26
25
|
/**
|
|
27
26
|
* Returns the conversion factor that converts from model coordinates to meters. Note that this can
|
|
28
27
|
* return undefined if the model has been stored in an unsupported unit.
|
|
29
|
-
* @version New since 2.1
|
|
30
28
|
*/
|
|
31
29
|
get modelUnitToMetersFactor(): number | undefined;
|
|
32
30
|
/**
|
|
@@ -90,13 +88,6 @@ export declare class Cognite3DModel extends THREE.Object3D implements CogniteMod
|
|
|
90
88
|
* @throws Error if node collection already has been assigned to the model.
|
|
91
89
|
*/
|
|
92
90
|
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;
|
|
100
91
|
/**
|
|
101
92
|
* Removes styling for previously added styled collection, resetting the style to the default (or
|
|
102
93
|
* the style imposed by other styled collections).
|
|
@@ -149,10 +140,20 @@ export declare class Cognite3DModel extends THREE.Object3D implements CogniteMod
|
|
|
149
140
|
* uses a right-hand Y-up coordinate system. This function also accounts for transformation
|
|
150
141
|
* applied to the model.
|
|
151
142
|
* @param box The box in ThreeJS/model coordinates.
|
|
152
|
-
* @param out Optional preallocated buffer for storing the result. May be `box`.
|
|
143
|
+
* @param out Optional preallocated buffer for storing the result. May be same input as `box`.
|
|
153
144
|
* @returns Transformed box.
|
|
154
145
|
*/
|
|
155
146
|
mapBoxFromModelToCdfCoordinates(box: THREE.Box3, out?: THREE.Box3): THREE.Box3;
|
|
147
|
+
/**
|
|
148
|
+
* Maps from a 3D position in "CDF space" to coordinates in "ThreeJS model space".
|
|
149
|
+
* This is necessary because CDF has a right-handed Z-up coordinate system while ThreeJS
|
|
150
|
+
* uses a right-hand Y-up coordinate system. This function also accounts for transformation
|
|
151
|
+
* applied to the model.
|
|
152
|
+
* @param box The box in CDF model coordinates.
|
|
153
|
+
* @param out Optional preallocated buffer for storing the result. May be same input as `box`.
|
|
154
|
+
* @returns Transformed box.
|
|
155
|
+
*/
|
|
156
|
+
mapBoxFromCdfToModelCoordinates(box: THREE.Box3, out?: THREE.Box3): THREE.Box3;
|
|
156
157
|
/**
|
|
157
158
|
* Cleans up used resources.
|
|
158
159
|
*/
|
|
@@ -10,7 +10,7 @@ import { DisposedDelegate, SceneRenderedDelegate } from '../types';
|
|
|
10
10
|
import { SupportedModelTypes } from '../../datamodels/base';
|
|
11
11
|
import { IntersectionFromPixelOptions } from '../..';
|
|
12
12
|
import { ViewerState } from '../../utilities/ViewStateHelper';
|
|
13
|
-
import ComboControls from '../../../../packages/camera-manager';
|
|
13
|
+
import { ComboControls, CameraControlsOptions } from '../../../../packages/camera-manager';
|
|
14
14
|
/**
|
|
15
15
|
* @example
|
|
16
16
|
* ```js
|
|
@@ -43,7 +43,7 @@ export declare class Cognite3DViewer {
|
|
|
43
43
|
private readonly _dataSource;
|
|
44
44
|
private readonly camera;
|
|
45
45
|
private readonly scene;
|
|
46
|
-
private readonly
|
|
46
|
+
private readonly _cameraManager;
|
|
47
47
|
private readonly _subscription;
|
|
48
48
|
private readonly _revealManagerHelper;
|
|
49
49
|
private readonly _domElement;
|
|
@@ -147,6 +147,15 @@ export declare class Cognite3DViewer {
|
|
|
147
147
|
off(event: 'cameraChange', callback: CameraChangeDelegate): void;
|
|
148
148
|
off(event: 'sceneRendered', callback: SceneRenderedDelegate): void;
|
|
149
149
|
off(event: 'disposed', callback: DisposedDelegate): void;
|
|
150
|
+
/**
|
|
151
|
+
* Sets camera control options. See {@link CameraControlsOptions}.
|
|
152
|
+
* @param controlsOptions JSON object with camera controls options.
|
|
153
|
+
*/
|
|
154
|
+
setCameraControlsOptions(controlsOptions: CameraControlsOptions): void;
|
|
155
|
+
/**
|
|
156
|
+
* Gets camera controls mode.
|
|
157
|
+
*/
|
|
158
|
+
getCameraControlsOptions(): CameraControlsOptions;
|
|
150
159
|
/**
|
|
151
160
|
* Gets the current viewer state which includes the camera pose as well as applied styling.
|
|
152
161
|
* @returns JSON object containing viewer state.
|
|
@@ -310,14 +319,8 @@ export declare class Cognite3DViewer {
|
|
|
310
319
|
* ```
|
|
311
320
|
*/
|
|
312
321
|
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
|
-
*/
|
|
317
|
-
setSlicingPlanes(slicingPlanes: THREE.Plane[]): void;
|
|
318
322
|
/**
|
|
319
323
|
* Returns the current active clipping planes.
|
|
320
|
-
* @version New in 2.1
|
|
321
324
|
*/
|
|
322
325
|
getClippingPlanes(): THREE.Plane[];
|
|
323
326
|
/**
|
|
@@ -358,6 +361,7 @@ export declare class Cognite3DViewer {
|
|
|
358
361
|
* Set camera's target.
|
|
359
362
|
* @public
|
|
360
363
|
* @param target Target in world space.
|
|
364
|
+
* @param animated Whether change of target should be animated or not (default is false).
|
|
361
365
|
* @example
|
|
362
366
|
* ```js
|
|
363
367
|
* // store position, target
|
|
@@ -368,7 +372,7 @@ export declare class Cognite3DViewer {
|
|
|
368
372
|
* viewer.setCameraTarget(target);
|
|
369
373
|
* ```
|
|
370
374
|
*/
|
|
371
|
-
setCameraTarget(target: THREE.Vector3): void;
|
|
375
|
+
setCameraTarget(target: THREE.Vector3, animated?: boolean): void;
|
|
372
376
|
/**
|
|
373
377
|
* Gets the camera controller. See https://www.npmjs.com/package/@cognite/three-combo-controls
|
|
374
378
|
* for documentation. Note that by default the `minDistance` setting of the controls will
|
|
@@ -441,11 +445,11 @@ export declare class Cognite3DViewer {
|
|
|
441
445
|
*/
|
|
442
446
|
requestRedraw(): void;
|
|
443
447
|
/**
|
|
444
|
-
* Allows to move camera with
|
|
448
|
+
* Allows to move camera with WASD or arrows keys.
|
|
445
449
|
*/
|
|
446
450
|
enableKeyboardNavigation(): void;
|
|
447
451
|
/**
|
|
448
|
-
* Disables camera movement by pressing
|
|
452
|
+
* Disables camera movement by pressing WASD or arrows keys.
|
|
449
453
|
*/
|
|
450
454
|
disableKeyboardNavigation(): void;
|
|
451
455
|
/**
|
|
@@ -539,8 +543,6 @@ export declare class Cognite3DViewer {
|
|
|
539
543
|
*/
|
|
540
544
|
getIntersectionFromPixel(offsetX: number, offsetY: number, options?: IntersectionFromPixelOptions): Promise<null | Intersection>;
|
|
541
545
|
private getModels;
|
|
542
|
-
/** @private */
|
|
543
|
-
private moveCameraTo;
|
|
544
546
|
/**
|
|
545
547
|
* Creates a helper for managing viewer state.
|
|
546
548
|
*/
|
|
@@ -548,6 +550,8 @@ export declare class Cognite3DViewer {
|
|
|
548
550
|
/** @private */
|
|
549
551
|
private animate;
|
|
550
552
|
/** @private */
|
|
553
|
+
private modelIntersectionCallback;
|
|
554
|
+
/** @private */
|
|
551
555
|
private updateCameraNearAndFar;
|
|
552
556
|
/** @private */
|
|
553
557
|
private resizeIfNecessary;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import { CogniteClient } from '@cognite/sdk';
|
|
5
|
+
import { CadModelBudget } from '../../../../packages/cad-geometry-loaders';
|
|
5
6
|
import { Cognite3DModel } from './Cognite3DModel';
|
|
6
7
|
import { CognitePointCloudModel } from './CognitePointCloudModel';
|
|
7
8
|
/**
|
|
@@ -121,6 +122,14 @@ export interface Cognite3DViewerOptions {
|
|
|
121
122
|
* This cannot be used together with {@link _localModels}.
|
|
122
123
|
*/
|
|
123
124
|
customDataSource?: DataSource;
|
|
125
|
+
/**
|
|
126
|
+
* Allows for controlling if geometry streaming should be halted when
|
|
127
|
+
* the camera is moving. Note that this option should left to false on
|
|
128
|
+
* low-end devices as more loading can cause frame drops.
|
|
129
|
+
*
|
|
130
|
+
* Default value is set to false.
|
|
131
|
+
*/
|
|
132
|
+
continuousModelStreaming?: boolean;
|
|
124
133
|
}
|
|
125
134
|
import { GeometryFilter } from '../../public/types';
|
|
126
135
|
import { DataSource } from '../../../../packages/data-source';
|
|
@@ -219,29 +228,7 @@ export declare type SceneRenderedDelegate = (event: {
|
|
|
219
228
|
}) => void;
|
|
220
229
|
export * from './NotSupportedInMigrationWrapperError';
|
|
221
230
|
export { CogniteModelBase } from './CogniteModelBase';
|
|
222
|
-
|
|
223
|
-
* Represents a measurement of how much geometry can be loaded.
|
|
224
|
-
*/
|
|
225
|
-
export declare type CadModelBudget = {
|
|
226
|
-
/**
|
|
227
|
-
* Sectors within this distance from the camera will always be loaded in high details.
|
|
228
|
-
*/
|
|
229
|
-
readonly highDetailProximityThreshold: number;
|
|
230
|
-
/**
|
|
231
|
-
* Number of bytes of the geometry that must be downloaded.
|
|
232
|
-
*/
|
|
233
|
-
readonly geometryDownloadSizeBytes: number;
|
|
234
|
-
/**
|
|
235
|
-
* Estimated maximum number of WebGL draw calls to download geometry for. Draw calls
|
|
236
|
-
* are very important for the framerate.
|
|
237
|
-
*/
|
|
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
|
-
};
|
|
231
|
+
export { CadModelBudget };
|
|
245
232
|
/**
|
|
246
233
|
* Represents a budget of how many point from point clouds can be
|
|
247
234
|
* loaded at the same time.
|
|
@@ -12,6 +12,7 @@ import { SectorGeometry } from '../../../packages/cad-parsers';
|
|
|
12
12
|
export declare type RevealOptions = {
|
|
13
13
|
logMetrics?: boolean;
|
|
14
14
|
renderOptions?: RenderOptions;
|
|
15
|
+
continuousModelStreaming?: boolean;
|
|
15
16
|
internal?: {
|
|
16
17
|
parseCallback?: (parsed: {
|
|
17
18
|
lod: string;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2021 Cognite AS
|
|
3
|
-
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
1
|
import { Cognite3DViewer } from '../public/migration/Cognite3DViewer';
|
|
6
2
|
import { NodeAppearance } from '../../../packages/cad-styling';
|
|
7
3
|
import { CogniteClient } from '@cognite/sdk';
|
|
8
4
|
export declare type ViewerState = {
|
|
9
5
|
camera: {
|
|
10
|
-
position:
|
|
11
|
-
|
|
6
|
+
position: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
z: number;
|
|
10
|
+
};
|
|
11
|
+
target: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
z: number;
|
|
15
|
+
};
|
|
12
16
|
};
|
|
13
17
|
models: ModelState[];
|
|
14
18
|
};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { DataSource } from '../packages/data-source';
|
|
8
8
|
export { NodesApiClient } from '../packages/nodes-api';
|
|
9
|
-
export { ModelIdentifier, CdfModelIdentifier, ModelMetadataProvider, ModelDataProvider } from '../packages/modeldata-api';
|
|
9
|
+
export { ModelIdentifier, CdfModelIdentifier, ModelMetadataProvider, ModelDataProvider, BlobOutputMetadata, File3dFormat } from '../packages/modeldata-api';
|
package/extensions/datasource.js
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
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.
|
|
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.3.0/",r(r.s=65)}({0:function(t,e){t.exports=require("three")},20:function(t,e){t.exports=require("@cognite/sdk-core")},5: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 u})),r.d(e,"e",(function(){return f})),r.d(e,"f",(function(){return h})),r.d(e,"g",(function(){return m})),r.d(e,"d",(function(){return i}));class o{constructor(t){this.client=t,this.authenticationPromise=t.authenticate()}get headers(){return this.client.getDefaultRequestHeaders()}async getBinaryFile(t,e){const r=`${t}/${e}`,o={...this.client.getDefaultRequestHeaders(),Accept:"*/*"};return(await this.fetchWithRetry(r,{headers:o,method:"GET"}).catch(t=>{throw Error("Could not download binary file")})).arrayBuffer()}async getJsonFile(t,e){return(await this.client.get(`${t}/${e}`).catch(t=>{throw Error("Could not download Json file")})).data}async fetchWithRetry(t,e,r=3){let o;for(let n=0;n<r;n++)try{await this.authenticationPromise;const r=await fetch(t,e);if(401===r.status){this.authenticationPromise=this.client.authenticate();continue}return r}catch(t){void 0!==o&&(o=t)}throw o}}class n{constructor(t,e){this.revealInternalId=Symbol(`${t}/${e}`),this.modelId=t,this.revisionId=e}toString(){return`${n.name} (${String(this.revealInternalId)})`}}var i,a=r(0);
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2021 Cognite AS
|
|
4
|
-
*/!function(t){t.EptPointCloud="ept-pointcloud",t.RevealCadModel="reveal-directory",t.AnyFormat="all-outputs"}(i||(i={}));
|
|
4
|
+
*/!function(t){t.EptPointCloud="ept-pointcloud",t.RevealCadModel="reveal-directory",t.GltfCadModel="gltf-directory",t.AnyFormat="all-outputs"}(i||(i={}));
|
|
5
5
|
/*!
|
|
6
6
|
* Copyright 2021 Cognite AS
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const s=(new a.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1);function c(t,e){switch(e){case i.RevealCadModel:t.premultiply(s);break;case i.RevealCadModel:case i.GltfCadModel:t.premultiply(s);break;case i.EptPointCloud:break;default:throw new Error("Unknown model format '"+e)}}
|
|
9
9
|
/*!
|
|
10
10
|
* Copyright 2021 Cognite AS
|
|
11
|
-
*/class
|
|
11
|
+
*/class u{constructor(t){this._client=t}async getModelMatrix(t,e){if(!(t instanceof n))throw new Error(`Model must be a ${n.name}, but got ${t.toString()}`);const{modelId:r,revisionId:o}=t,i=await this._client.revisions3D.retrieve(r,o),s=new a.Matrix4;return i.rotation&&s.makeRotationFromEuler(new a.Euler(...i.rotation)),c(s,e),s}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 a.Vector3(t[0],t[1],t[2]),target:new a.Vector3(e[0],e[1],e[2])}}}async getModelUri(t,e){if(!(t instanceof n))throw new Error(`Model must be a ${n.name}, but got ${t.toString()}`);return`${this._client.getBaseUrl()}${this.getRequestPath(e.blobId)}`}async getModelOutputs(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=`/api/v1/projects/${this._client.project}/3d/models/${e}/revisions/${r}/outputs`,a=await this._client.get(o,{params:{format:i.AnyFormat}});if(200===a.status)return a.data.items.filter(t=>Object.values(i).includes(t.format));throw new Error(`Unexpected response ${a.status} (payload: '${a.data})`)}getRequestPath(t){return`/api/v1/projects/${this._client.project}/3d/files/${t}`}}
|
|
12
12
|
/*!
|
|
13
13
|
* Copyright 2021 Cognite AS
|
|
14
|
-
*/
|
|
14
|
+
*/var l=r(20);
|
|
15
15
|
/*!
|
|
16
16
|
* Copyright 2021 Cognite AS
|
|
17
|
-
*/
|
|
17
|
+
*/async function d(t){const e=await fetch(t);if(!e.ok){const t={};throw e.headers.forEach((e,r)=>{t[e]=r}),new l.HttpError(e.status,e.body,t)}return e}
|
|
18
18
|
/*!
|
|
19
19
|
* Copyright 2021 Cognite AS
|
|
20
|
-
*/
|
|
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()}}
|
|
20
|
+
*/class f{get headers(){return{}}async getBinaryFile(t,e){return(await d(`${t}/${e}`)).arrayBuffer()}async getJsonFile(t,e){return(await d(`${t}/${e}`)).json()}}
|
|
24
21
|
/*!
|
|
25
22
|
* Copyright 2021 Cognite AS
|
|
26
23
|
*/class h{constructor(t){this.revealInternalId=Symbol(t),this.localPath=t}toString(){return`${h.name} (${this.localPath})`}}
|
|
27
24
|
/*!
|
|
28
25
|
* Copyright 2021 Cognite AS
|
|
29
|
-
*/class
|
|
26
|
+
*/class m{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 a.Matrix4;return c(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)}async getModelOutputs(t){var e;const r=await this.getModelUri(t),o=null!==(e=await async function(t){let e;try{e=(await(await d(t+"/scene.json")).json()).version}catch(t){return}switch(e){case 8:return Promise.resolve({blobId:-1,format:i.RevealCadModel,version:8});case 9:return Promise.resolve({blobId:-1,format:i.GltfCadModel,version:9});default:return}}(r))&&void 0!==e?e:await async function(t){let e;try{e=await(await d(t+"/ept.json")).json()}catch(t){return}return e?Promise.resolve({blobId:-1,format:i.EptPointCloud,version:-1}):void 0}(r);if(o)return[o];throw new Error("Only point cloud or CAD models (version 8 and 9) are supported)")}}
|
|
30
27
|
/*!
|
|
31
28
|
* Copyright 2021 Cognite AS
|
|
32
|
-
*/},
|
|
29
|
+
*/},65:function(t,e,r){"use strict";r.r(e);var o=r(5);r.d(e,"CdfModelIdentifier",(function(){return o.b})),r.d(e,"File3dFormat",(function(){return o.d}))}})}));
|
|
33
30
|
//# sourceMappingURL=datasource.map
|