@cognite/reveal-components 1.0.0 → 1.0.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/README.md +1 -1
- package/dist/assets/poi-markers/poi-create-cursor.js +4 -0
- package/dist/common/i18n/en/reveal-components.js +183 -178
- package/dist/data-providers/Fdm3dDataProvider.d.ts +3 -3
- package/dist/data-providers/FdmSDK.d.ts +8 -0
- package/dist/data-providers/FdmSDK.js +34 -21
- package/dist/data-providers/assets/createClassicAssetsCache.d.ts +7 -0
- package/dist/data-providers/assets/createClassicAssetsCache.js +18 -0
- package/dist/data-providers/assets/createDmsDescribableNodesCache.d.ts +23 -0
- package/dist/data-providers/assets/createDmsDescribableNodesCache.js +19 -0
- package/dist/data-providers/cache/PointCloudAnnotationCache.js +10 -10
- package/dist/data-providers/cache/RevisionFdmNodeCache.d.ts +3 -2
- package/dist/data-providers/cache/RevisionFdmNodeCache.js +65 -39
- package/dist/data-providers/cache/annotationModelUtils.js +8 -6
- package/dist/data-providers/cache/cad/CadInstanceMappingsCache.d.ts +5 -2
- package/dist/data-providers/cache/cad/CadInstanceMappingsCacheImpl.js +9 -6
- package/dist/data-providers/cache/cad/FdmCadNodeCache.d.ts +3 -1
- package/dist/data-providers/cache/cad/FdmCadNodeCacheImpl.d.ts +5 -0
- package/dist/data-providers/cache/cad/FdmCadNodeCacheImpl.js +8 -3
- package/dist/data-providers/core-dm-provider/CoreDm3dDataProvider.d.ts +3 -3
- package/dist/data-providers/core-dm-provider/CoreDm3dDataProvider.js +11 -11
- package/dist/data-providers/core-dm-provider/filterNodesByMappedTo3d.js +13 -13
- package/dist/data-providers/core-dm-provider/getCadConnectionsForInstances.js +18 -18
- package/dist/data-providers/core-dm-provider/getCadConnectionsForRevisions.js +11 -11
- package/dist/data-providers/core-dm-provider/getCadModelsForInstance.js +3 -3
- package/dist/data-providers/core-dm-provider/getDMSModels.js +6 -6
- package/dist/data-providers/core-dm-provider/getEdgeConnected3dInstances.js +8 -8
- package/dist/data-providers/core-dm-provider/getFdmConnectionsForNodes.d.ts +2 -3
- package/dist/data-providers/core-dm-provider/getFdmConnectionsForNodes.js +19 -19
- package/dist/data-providers/core-dm-provider/listMappedFdmNodes.js +14 -14
- package/dist/data-providers/index.d.ts +2 -1
- package/dist/data-providers/index.js +2 -0
- package/dist/data-providers/legacy-fdm-provider/LegacyFdm3dDataProvider.d.ts +3 -3
- package/dist/data-providers/legacy-fdm-provider/fdmEdgesToCadConnections.js +3 -3
- package/dist/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.d.ts +3 -3
- package/dist/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.js +1 -1
- package/dist/data-providers/network/cad/searchClassicAssetsForCadModels.js +5 -5
- package/dist/data-providers/network/cad/searchHybridDmAssetsForCadModels.js +3 -3
- package/dist/data-providers/network/common/getDMAssetsForAnnotationReference.js +3 -3
- package/dist/data-providers/utils/getDMSModelRevisionRefs.js +3 -3
- package/dist/domains/annotation360/image360SceneCollectionTransform.d.ts +18 -0
- package/dist/domains/annotation360/image360SceneCollectionTransform.js +37 -0
- package/dist/domains/index.d.ts +4 -2
- package/dist/domains/index.js +3 -1
- package/dist/domains/pointsOfInterest/PointsOfInterestTool.d.ts +5 -0
- package/dist/domains/pointsOfInterest/PointsOfInterestTool.js +36 -17
- package/dist/domains/reveal/RevealDomainObjectUtils.d.ts +1 -0
- package/dist/domains/reveal/RevealDomainObjectUtils.js +1 -1
- package/dist/domains/reveal/cad/CadDomainObject.d.ts +18 -1
- package/dist/domains/reveal/cad/CadDomainObject.js +31 -15
- package/dist/foundation/renderTarget/CdfCaches.d.ts +9 -1
- package/dist/foundation/renderTarget/CdfCaches.js +24 -14
- package/dist/foundation/treeNodes/cad-tree-node/cad-lazy-loader.d.ts +3 -1
- package/dist/foundation/treeNodes/cad-tree-node/cad-lazy-loader.js +33 -22
- package/dist/foundation/treeNodes/cad-tree-node/cad-node-update-styling.js +6 -6
- package/dist/foundation/treeNodes/cad-tree-node/cad-tree-node.d.ts +1 -0
- package/dist/foundation/treeNodes/cad-tree-node/cad-tree-node.js +4 -1
- package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/classic-instance-mappings-sdk.js +2 -5
- package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.d.ts +14 -0
- package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.js +23 -0
- package/dist/ui/components/InstanceLabel/InstanceLabel.js +18 -30
- package/dist/ui/components/Reveal3DResources/Reveal3DResources.js +20 -20
- package/dist/ui/components/RevealCanvas/SDKProvider.js +6 -6
- package/dist/ui/components/RevealCanvas/UsageMetricsTrackerContext.d.ts +3 -0
- package/dist/ui/components/RevealCanvas/UsageMetricsTrackerContext.js +6 -0
- package/dist/ui/components/RevealCanvas/ViewerContext.d.ts +2 -0
- package/dist/ui/components/RevealCanvas/ViewerContext.js +5 -5
- package/dist/ui/components/RevealContext/RevealContext.js +6 -6
- package/dist/ui/components/RevealToolbar/AssetContextualizedButton.js +1 -1
- package/dist/ui/components/RuleBasedOutputs/hooks/useGetDMConnectionWithNodeFromHybridMappingsQuery.js +11 -11
- package/dist/ui/components/Widget/RevealWidget.context.d.ts +2 -1
- package/dist/ui/components/Widget/RevealWidget.context.js +1 -1
- package/dist/ui/components/Widget/RevealWidget.d.ts +11 -2
- package/dist/ui/components/Widget/RevealWidget.js +35 -20
- package/dist/ui/components/Widget/RevealWidgetCameraController.d.ts +3 -1
- package/dist/ui/components/Widget/RevealWidgetCameraController.js +12 -10
- package/dist/ui/components/Widget/RevealWidgetController.d.ts +3 -1
- package/dist/ui/components/Widget/RevealWidgetController.js +40 -33
- package/dist/ui/components/Widget/index.d.ts +1 -1
- package/dist/ui/components/Widget/styling/applyPointCloudInstanceStyling.js +5 -5
- package/dist/ui/components/Widget/useRevealWidgetMetricsTracking.d.ts +21 -0
- package/dist/ui/components/Widget/useRevealWidgetMetricsTracking.js +33 -0
- package/dist/ui/components/commandBased/Factories/DefaultIcons.js +31 -31
- package/dist/ui/components/commandBased/buttons/DropdownButton.d.ts +2 -0
- package/dist/ui/components/commandBased/buttons/DropdownButton.js +67 -48
- package/dist/ui/components/commandBased/pointsOfInterest/PoiCommentSection.js +6 -6
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.d.ts +16 -0
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.js +6 -0
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.d.ts +15 -0
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.d.ts +5 -0
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.js +14 -0
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.js +105 -0
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.function.d.ts +13 -2
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.function.js +17 -9
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.js +27 -13
- package/dist/ui/components/commandBased/treeView/TreeView/components/tree-view-info.js +2 -2
- package/dist/ui/components/commandBased/treeView/TreeView/extraComponents/CadTreeAssetMappingDropdown.js +34 -33
- package/dist/ui/components/commandBased/treeView/TreeView/tree-view-node.js +1 -0
- package/dist/ui/components/commandBased/treeView/TreeView/tree-view-props.d.ts +1 -0
- package/dist/ui/components/commandBased/treeView/TreeView/tree-view.js +27 -25
- package/dist/ui/components/i18n/I18n.js +3 -3
- package/dist/ui/components/index.d.ts +1 -1
- package/dist/ui/hooks/network/fetchLinkFromRelationshipsByTimeseries.js +4 -4
- package/dist/ui/hooks/network/getImage360CollectionsForDmInstance.js +7 -7
- package/dist/ui/hooks/network/getTimeseriesLatestDatapoints.js +3 -3
- package/dist/ui/hooks/pointClouds/fetchAnnotationsForModel.js +4 -4
- package/dist/ui/hooks/pointClouds/usePointCloudAnnotationMappingForIntersection.js +11 -11
- package/dist/ui/hooks/pointClouds/usePointCloudAnnotationMappingsForAssetInstances.js +4 -4
- package/dist/ui/hooks/scenes/use3dScenes.js +4 -4
- package/dist/ui/query/core-dm/usePointCloudDMVolumeMappingForIntersection.js +9 -9
- package/dist/ui/query/core-dm/usePointCloudDMVolumes.js +10 -10
- package/dist/ui/query/index.d.ts +1 -0
- package/dist/ui/query/index.js +17 -16
- package/dist/ui/query/useAll3dDirectConnectionsWithProperties.js +6 -6
- package/dist/ui/query/useAssetsAndTimeseriesLinkageDataQuery.js +24 -24
- package/dist/ui/query/useAssetsAndTimeseriesLinkages.context.d.ts +3 -2
- package/dist/ui/query/useAssetsAndTimeseriesLinkages.context.js +4 -4
- package/dist/ui/query/useAssetsAndTimeseriesLinkages.js +13 -13
- package/dist/ui/query/useAssetsByIdsQuery.js +10 -11
- package/dist/ui/query/useCadNode3DInfo.d.ts +8 -0
- package/dist/ui/query/useCadNode3DInfo.js +24 -0
- package/dist/ui/query/useFetchClassicAssetsByIds.js +5 -5
- package/dist/ui/query/useFilterOnClassicAssetsInScene.js +6 -6
- package/dist/ui/query/useHybridMappingsForAssetInstances.js +9 -9
- package/dist/ui/query/useInstanceNames.d.ts +11 -0
- package/dist/ui/query/useInstanceNames.js +17 -0
- package/dist/ui/query/useInstancesByIdsQuery.context.d.ts +3 -5
- package/dist/ui/query/useInstancesByIdsQuery.context.js +4 -8
- package/dist/ui/query/useInstancesByIdsQuery.d.ts +9 -6
- package/dist/ui/query/useInstancesByIdsQuery.js +14 -23
- package/dist/ui/query/useNamedDmInstancesByIds.d.ts +12 -0
- package/dist/utilities/cache/ReadonlyEntityCache.d.ts +4 -0
- package/dist/utilities/cache/ReadonlyEntityCache.js +27 -0
- package/dist/utilities/createMixpanelUsageMetricsTracker.d.ts +23 -0
- package/dist/utilities/createMixpanelUsageMetricsTracker.js +23 -0
- package/dist/utilities/externalIndex.d.ts +2 -0
- package/dist/utilities/externalIndex.js +3 -1
- package/dist/utilities/getInstancesFromClick.js +9 -9
- package/dist/utilities/index.d.ts +2 -1
- package/dist/utilities/index.js +12 -9
- package/dist/utilities/queryKeys.d.ts +2 -0
- package/dist/utilities/queryKeys.js +7 -0
- package/dist/utilities/signal/useCombinedUpdateSignal.d.ts +9 -0
- package/dist/utilities/signal/useCombinedUpdateSignal.js +14 -0
- package/dist/utilities/signal/useMemoWithUpdateSignal.d.ts +3 -0
- package/dist/utilities/signal/useMemoWithUpdateSignal.js +13 -0
- package/dist/utilities/usageMetricsTracker.d.ts +4 -0
- package/dist/utilities/usageMetricsTracker.js +4 -0
- package/package.json +7 -3
- package/dist/ui/hooks/network/getAssetsByIds.d.ts +0 -2
- package/dist/ui/hooks/network/getAssetsByIds.js +0 -4
- package/dist/ui/query/useDmsInstanceByIdsQuery.d.ts +0 -3
- package/dist/ui/query/useDmsInstanceByIdsQuery.js +0 -18
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CogniteInstanceId, InstanceType } from '@cognite/sdk';
|
|
2
|
+
import { ReadonlyEntityCache, createReadonlyEntityCache } from '../../utilities/cache/ReadonlyEntityCache';
|
|
3
|
+
import { FdmKey } from '../cache';
|
|
4
|
+
import { CORE_DM_SPACE } from '../core-dm-provider/dataModels';
|
|
5
|
+
import { DmsUniqueIdentifier, ExternalIdsResultList, FdmNode, Source } from '../FdmSDK';
|
|
6
|
+
export type DmsDescribableNode = FdmNode<{
|
|
7
|
+
[CORE_DM_SPACE]: {
|
|
8
|
+
[`CogniteDescribable/v1`]: {
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
13
|
+
export declare function createDmsDescribableNodesCache(sdk: {
|
|
14
|
+
getByExternalIds: (queries: Array<{
|
|
15
|
+
instanceType: InstanceType;
|
|
16
|
+
externalId: string;
|
|
17
|
+
space: string;
|
|
18
|
+
}>, sources?: Source[]) => Promise<ExternalIdsResultList<{
|
|
19
|
+
name: string;
|
|
20
|
+
}>>;
|
|
21
|
+
}, dependencies?: {
|
|
22
|
+
createReadonlyEntityCache: typeof createReadonlyEntityCache<DmsUniqueIdentifier, DmsDescribableNode, FdmKey>;
|
|
23
|
+
}): ReadonlyEntityCache<CogniteInstanceId, DmsDescribableNode, FdmKey>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFdmKey as e } from "../cache/idAndKeyTranslation.js";
|
|
2
|
+
import { restrictToDmsId as t } from "../../utilities/restrictToDmsId.js";
|
|
3
|
+
import { createReadonlyEntityCache as n } from "../../utilities/cache/ReadonlyEntityCache.js";
|
|
4
|
+
import "../cache/index.js";
|
|
5
|
+
import { COGNITE_DESCRIBABLE_SOURCE as r, CORE_DM_SPACE as i } from "../core-dm-provider/dataModels.js";
|
|
6
|
+
//#region libs/shared/reveal-components/src/data-providers/assets/createDmsDescribableNodesCache.ts
|
|
7
|
+
var a = `${r.externalId}/${r.version}`;
|
|
8
|
+
function o(o, s = { createReadonlyEntityCache: n }) {
|
|
9
|
+
let c = e;
|
|
10
|
+
return s.createReadonlyEntityCache(async (e) => {
|
|
11
|
+
let n = await o.getByExternalIds(e.map((e) => ({
|
|
12
|
+
...t(e),
|
|
13
|
+
instanceType: "node"
|
|
14
|
+
})), [r]);
|
|
15
|
+
return new Map(n.items.filter((e) => e.properties[i]?.[a]?.name !== void 0).map((e) => [c(e), e]));
|
|
16
|
+
}, c);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { o as createDmsDescribableNodesCache };
|
|
@@ -2,10 +2,10 @@ import { isSameAssetReference as e } from "../../utilities/instanceIds/equality.
|
|
|
2
2
|
import { createModelRevisionKey as t } from "./idAndKeyTranslation.js";
|
|
3
3
|
import { createInstanceReferenceKey as n } from "../../utilities/instanceIds/toKey.js";
|
|
4
4
|
import "../../utilities/instanceIds/index.js";
|
|
5
|
-
import {
|
|
6
|
-
import { fetchPointCloudAnnotationAssets as i } from "./annotationModelUtils.js";
|
|
7
|
-
import { isClassicAsset as a } from "../../utilities/instances/typeGuards.js";
|
|
5
|
+
import { isClassicAsset as r } from "../../utilities/instances/typeGuards.js";
|
|
8
6
|
import "../../utilities/instances/index.js";
|
|
7
|
+
import { getInstanceReferencesFromPointCloudAnnotation as i } from "./utils.js";
|
|
8
|
+
import { fetchPointCloudAnnotationAssets as a } from "./annotationModelUtils.js";
|
|
9
9
|
import { assert as o } from "@cognite/underscore";
|
|
10
10
|
//#region libs/shared/reveal-components/src/data-providers/cache/PointCloudAnnotationCache.ts
|
|
11
11
|
var s = class {
|
|
@@ -16,7 +16,7 @@ var s = class {
|
|
|
16
16
|
fetchAnnotationAssets;
|
|
17
17
|
constructor(e, t) {
|
|
18
18
|
this._sdk = e;
|
|
19
|
-
let { fetchAnnotationAssets: n } = t ?? { fetchAnnotationAssets:
|
|
19
|
+
let { fetchAnnotationAssets: n } = t ?? { fetchAnnotationAssets: a };
|
|
20
20
|
this.fetchAnnotationAssets = n;
|
|
21
21
|
}
|
|
22
22
|
async getPointCloudAnnotationAssetsForModel(e, n) {
|
|
@@ -38,7 +38,7 @@ var s = class {
|
|
|
38
38
|
filter: t,
|
|
39
39
|
limit: 1e3
|
|
40
40
|
}).autoPagingToArray({ limit: Infinity });
|
|
41
|
-
return o(n.every((e) => e.annotationType === "pointcloud.BoundingVolume")), n.filter((e) =>
|
|
41
|
+
return o(n.every((e) => e.annotationType === "pointcloud.BoundingVolume")), n.filter((e) => i(e).length !== 0);
|
|
42
42
|
}
|
|
43
43
|
async getOrBuildAssetKeyToAnnotationIdsCache(e, n) {
|
|
44
44
|
let r = t(e, n), i = this._assetKeyToAnnotationIdsCache.get(r);
|
|
@@ -67,12 +67,12 @@ var s = class {
|
|
|
67
67
|
};
|
|
68
68
|
function c(e) {
|
|
69
69
|
let t = /* @__PURE__ */ new Map();
|
|
70
|
-
for (let [
|
|
71
|
-
let
|
|
72
|
-
|
|
73
|
-
for (let e of
|
|
70
|
+
for (let [i, a] of e.entries()) for (let e of a) {
|
|
71
|
+
let a = [];
|
|
72
|
+
r(e) ? (a.push(n({ id: e.id })), e.externalId !== void 0 && a.push(n({ externalId: e.externalId }))) : a.push(n(e));
|
|
73
|
+
for (let e of a) {
|
|
74
74
|
let n = t.get(e);
|
|
75
|
-
n === void 0 && (n = /* @__PURE__ */ new Set(), t.set(e, n)), n.add(
|
|
75
|
+
n === void 0 && (n = /* @__PURE__ */ new Set(), t.set(e, n)), n.add(i);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
return t;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CogniteClient } from '@cognite/sdk';
|
|
2
2
|
import { Fdm3dDataProvider } from '../Fdm3dDataProvider';
|
|
3
3
|
import { FdmSDK } from '../FdmSDK';
|
|
4
|
-
import {
|
|
4
|
+
import { CadNodeMapping } from './cad/CadInstanceMappingsCache';
|
|
5
|
+
import { TreeIndex, FdmConnectionWithNode, FdmNodeDataPromises, CadNodeIdData } from './types';
|
|
5
6
|
export declare class RevisionFdmNodeCache {
|
|
6
7
|
private readonly _cogniteClient;
|
|
7
8
|
private readonly _fdmClient;
|
|
@@ -19,10 +20,10 @@ export declare class RevisionFdmNodeCache {
|
|
|
19
20
|
private setCacheDataForTreeIndices;
|
|
20
21
|
private getAndCacheViewsPromiseForNodeData;
|
|
21
22
|
private getClosestParentMapping;
|
|
22
|
-
private combineConnectionsWithTreeIndex;
|
|
23
23
|
private getMappingConnectionsForAncestors;
|
|
24
24
|
fetchViewsForAllConnections(): Promise<void>;
|
|
25
25
|
insertTreeIndexMappings(treeIndex: TreeIndex, connection: FdmConnectionWithNode): void;
|
|
26
|
+
getConnectionsForNodes(nodes: CadNodeIdData[]): Promise<CadNodeMapping[]>;
|
|
26
27
|
getAllConnections(): FdmConnectionWithNode[];
|
|
27
28
|
}
|
|
28
29
|
export declare function checkDefinedViews(connections?: FdmConnectionWithNode[]): connections is Array<Required<FdmConnectionWithNode>>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { isDefined as e } from "../../utilities/isDefined.js";
|
|
2
|
+
import { fetchAncestorNodesForTreeIndex as t, inspectNodes as n } from "./requests.js";
|
|
3
|
+
import { max as r, partition as i } from "lodash-es";
|
|
4
|
+
import { assert as a } from "@cognite/underscore";
|
|
4
5
|
//#region libs/shared/reveal-components/src/data-providers/cache/RevisionFdmNodeCache.ts
|
|
5
|
-
var
|
|
6
|
+
var o = {
|
|
6
7
|
connections: [],
|
|
7
8
|
ancestorsWithSameMapping: [],
|
|
8
9
|
firstMappedAncestorTreeIndex: -1
|
|
9
|
-
},
|
|
10
|
+
}, s = class {
|
|
10
11
|
_cogniteClient;
|
|
11
12
|
_fdmClient;
|
|
12
13
|
_fdm3dDataProvider;
|
|
@@ -31,7 +32,7 @@ var i = {
|
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
async assertOrFetchViewsForNodeData(e, t) {
|
|
34
|
-
if (
|
|
35
|
+
if (d(t)) return t.map((e) => e.views);
|
|
35
36
|
let n = t[0].cadNode, r = {
|
|
36
37
|
cadNode: n,
|
|
37
38
|
connections: t.map((e) => e.connection)
|
|
@@ -50,17 +51,17 @@ var i = {
|
|
|
50
51
|
}
|
|
51
52
|
async getViewsPromiseFromDataPromises(e, t) {
|
|
52
53
|
let n = await e, { ancestorsWithSameMapping: r } = await t, i = r.map((e) => e.treeIndex), a = i.filter((e) => this._treeIndexToFdmConnections.has(e)).sort((e, t) => t - e), o = a.length === 0 ? void 0 : this._treeIndexToFdmConnections.get(a[0]);
|
|
53
|
-
return
|
|
54
|
+
return d(o) ? (this.setCacheDataForTreeIndices(i, o), o.map((e) => e.views)) : await this.getAndCacheViewsPromiseForNodeData(n, i);
|
|
54
55
|
}
|
|
55
56
|
async getCadAndConnectionsPromiseForAncestorData(e) {
|
|
56
|
-
let { connections: t, ancestorsWithSameMapping: n, firstMappedAncestorTreeIndex:
|
|
57
|
+
let { connections: t, ancestorsWithSameMapping: n, firstMappedAncestorTreeIndex: r } = await e;
|
|
57
58
|
if (t.length === 0) {
|
|
58
59
|
this.setCacheDataForTreeIndices(n.map((e) => e.treeIndex), []);
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
|
-
let
|
|
62
|
-
return
|
|
63
|
-
cadNode:
|
|
62
|
+
let i = n.find((e) => e.treeIndex === r);
|
|
63
|
+
return a(i !== void 0), {
|
|
64
|
+
cadNode: i,
|
|
64
65
|
connections: t
|
|
65
66
|
};
|
|
66
67
|
}
|
|
@@ -69,50 +70,47 @@ var i = {
|
|
|
69
70
|
this._treeIndexToFdmConnections.set(e, t);
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
|
-
async getAndCacheViewsPromiseForNodeData(e,
|
|
73
|
+
async getAndCacheViewsPromiseForNodeData(e, t) {
|
|
73
74
|
if (e === void 0) {
|
|
74
|
-
this.setCacheDataForTreeIndices(
|
|
75
|
+
this.setCacheDataForTreeIndices(t, []);
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
77
|
-
let r = (await
|
|
78
|
+
let r = (await n(this._fdmClient, e.connections.map((e) => e.instance))).items.map((e) => e.inspectionResults.involvedViews), i = e.connections.map((t, n) => ({
|
|
78
79
|
connection: t,
|
|
79
80
|
cadNode: e.cadNode,
|
|
80
81
|
view: r[n]
|
|
81
82
|
}));
|
|
82
|
-
return this.setCacheDataForTreeIndices(
|
|
83
|
+
return this.setCacheDataForTreeIndices(t, i), r;
|
|
83
84
|
}
|
|
84
|
-
async getClosestParentMapping(
|
|
85
|
-
let n = await
|
|
86
|
-
if (r.length === 0) return
|
|
87
|
-
let
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return
|
|
92
|
-
let r = t.find((e) => e.treeIndex === n.treeIndex);
|
|
93
|
-
return r !== void 0 && e.push({
|
|
94
|
-
connection: n,
|
|
95
|
-
treeIndex: r.treeIndex
|
|
96
|
-
}), e;
|
|
97
|
-
}, []);
|
|
85
|
+
async getClosestParentMapping(e) {
|
|
86
|
+
let n = await t(this._modelId, this._revisionId, e, this._cogniteClient), r = await this.getMappingConnectionsForAncestors(n);
|
|
87
|
+
if (r.length === 0) return o;
|
|
88
|
+
let i = r.map((e) => ({
|
|
89
|
+
connection: e,
|
|
90
|
+
treeIndex: e.treeIndex
|
|
91
|
+
})), a = l(i);
|
|
92
|
+
return a === void 0 ? o : u(a, i, n);
|
|
98
93
|
}
|
|
99
94
|
async getMappingConnectionsForAncestors(e) {
|
|
100
95
|
let t = e.filter((e) => this._treeIndexToFdmConnections.has(e.treeIndex)).sort((e, t) => t.treeIndex - e.treeIndex)[0];
|
|
101
96
|
if (t !== void 0) {
|
|
102
97
|
let e = this._treeIndexToFdmConnections.get(t.treeIndex);
|
|
103
|
-
return
|
|
98
|
+
return a(e !== void 0), e.map((e) => e.connection);
|
|
104
99
|
}
|
|
105
100
|
let n = await this._modelInstances;
|
|
106
|
-
return n === void 0 || n.length === 0 ? [] : await this._fdm3dDataProvider.getFdmConnectionsForNodes(n, this._revisionId, e)
|
|
101
|
+
return n === void 0 || n.length === 0 ? [] : await this._fdm3dDataProvider.getFdmConnectionsForNodes(n, this._revisionId, e.map((e) => ({
|
|
102
|
+
...e,
|
|
103
|
+
nodeId: e.id
|
|
104
|
+
})));
|
|
107
105
|
}
|
|
108
106
|
async fetchViewsForAllConnections() {
|
|
109
107
|
let e = this.getAllConnections().filter((e) => e.views === void 0 || e.views.length === 0);
|
|
110
108
|
if (e.length === 0) return;
|
|
111
|
-
let
|
|
112
|
-
e.forEach((e,
|
|
109
|
+
let t = await n(this._fdmClient, e.map((e) => e.connection.instance));
|
|
110
|
+
e.forEach((e, n) => {
|
|
113
111
|
let r = {
|
|
114
112
|
...e,
|
|
115
|
-
views: [
|
|
113
|
+
views: [t.items[n].inspectionResults.involvedViews[0]]
|
|
116
114
|
};
|
|
117
115
|
this.insertTreeIndexMappings(r.cadNode.treeIndex, r);
|
|
118
116
|
});
|
|
@@ -129,14 +127,42 @@ var i = {
|
|
|
129
127
|
n.push(t);
|
|
130
128
|
}
|
|
131
129
|
}
|
|
130
|
+
async getConnectionsForNodes(t) {
|
|
131
|
+
let n = await this._modelInstances;
|
|
132
|
+
if (n === void 0 || n.length === 0) return [];
|
|
133
|
+
let [r, a] = i(t, (e) => this._treeIndexToFdmConnections.has(e.treeIndex)), o = r.map((e) => this._treeIndexToFdmConnections.get(e.treeIndex)).filter(e).flat(), s = await this._fdm3dDataProvider.getFdmConnectionsForNodes(n, this._revisionId, a);
|
|
134
|
+
return s.forEach((e) => {
|
|
135
|
+
if (e.nodeId === void 0 || e.treeIndex === void 0 || e.subtreeSize === void 0) return;
|
|
136
|
+
let t = {
|
|
137
|
+
id: e.nodeId,
|
|
138
|
+
treeIndex: e.treeIndex,
|
|
139
|
+
subtreeSize: e.subtreeSize
|
|
140
|
+
};
|
|
141
|
+
this.insertTreeIndexMappings(e.treeIndex, {
|
|
142
|
+
connection: e,
|
|
143
|
+
cadNode: t
|
|
144
|
+
});
|
|
145
|
+
}), c(t, [...s, ...o.map((e) => e.connection)]);
|
|
146
|
+
}
|
|
132
147
|
getAllConnections() {
|
|
133
148
|
return [...this._treeIndexToFdmConnections.values()].flat();
|
|
134
149
|
}
|
|
135
150
|
};
|
|
136
|
-
function
|
|
137
|
-
|
|
151
|
+
function c(t, n) {
|
|
152
|
+
let r = new Map(t.map((e) => [e.treeIndex, e]));
|
|
153
|
+
return n.map((e) => {
|
|
154
|
+
let t = r.get(e.treeIndex);
|
|
155
|
+
if (t !== void 0) return {
|
|
156
|
+
sourceType: "cdm",
|
|
157
|
+
node: t,
|
|
158
|
+
instance: e.instance
|
|
159
|
+
};
|
|
160
|
+
}).filter(e);
|
|
161
|
+
}
|
|
162
|
+
function l(e) {
|
|
163
|
+
return r(e.map((e) => e.treeIndex));
|
|
138
164
|
}
|
|
139
|
-
function
|
|
165
|
+
function u(e, t, n) {
|
|
140
166
|
let r = t.filter((t) => t.treeIndex === e), i = n.filter((t) => t.treeIndex >= e);
|
|
141
167
|
return {
|
|
142
168
|
connections: r.map((e) => e.connection),
|
|
@@ -144,8 +170,8 @@ function s(e, t, n) {
|
|
|
144
170
|
firstMappedAncestorTreeIndex: e
|
|
145
171
|
};
|
|
146
172
|
}
|
|
147
|
-
function
|
|
173
|
+
function d(e) {
|
|
148
174
|
return e !== void 0 && e?.every((e) => e.views !== void 0 && e.views.length > 0);
|
|
149
175
|
}
|
|
150
176
|
//#endregion
|
|
151
|
-
export {
|
|
177
|
+
export { s as RevisionFdmNodeCache, d as checkDefinedViews };
|
|
@@ -4,17 +4,17 @@ import { createInstanceReferenceKey as r } from "../../utilities/instanceIds/toK
|
|
|
4
4
|
import "../../utilities/instanceIds/index.js";
|
|
5
5
|
import { FdmSDK as i } from "../FdmSDK.js";
|
|
6
6
|
import { isDefined as a } from "../../utilities/isDefined.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getInstanceReferencesFromPointCloudAnnotation as o } from "./utils.js";
|
|
8
8
|
import { COGNITE_ASSET_SOURCE as s, COGNITE_ASSET_VIEW_VERSION_KEY as c, CORE_DM_SPACE as l } from "../core-dm-provider/dataModels.js";
|
|
9
|
-
import {
|
|
9
|
+
import { concatenateMapValues as u } from "../../utilities/map/concatenateMapValues.js";
|
|
10
10
|
import { chunk as d, uniqBy as f, uniqWith as p } from "lodash-es";
|
|
11
11
|
//#region libs/shared/reveal-components/src/data-providers/cache/annotationModelUtils.ts
|
|
12
12
|
async function m(e, t) {
|
|
13
|
-
let n = e.flatMap((e) =>
|
|
13
|
+
let n = e.flatMap((e) => o(e).map((t) => ({
|
|
14
14
|
annotationId: e.id,
|
|
15
15
|
assetId: t
|
|
16
16
|
}))).filter(a), i = await h(f(n.map((e) => e.assetId), r), t), s = new Map(i.map((e) => [r(e), e]));
|
|
17
|
-
return
|
|
17
|
+
return u(n.map((e) => {
|
|
18
18
|
let t = r(e.assetId), n = s.get(t);
|
|
19
19
|
if (n !== void 0) return [e.annotationId, n];
|
|
20
20
|
}).filter(a));
|
|
@@ -24,10 +24,12 @@ async function h(n, r) {
|
|
|
24
24
|
return [].concat(await _(i, r), await g(a, r));
|
|
25
25
|
}
|
|
26
26
|
async function g(e, t) {
|
|
27
|
-
|
|
27
|
+
if (e.length === 0) return [];
|
|
28
|
+
let { items: n } = await new i(t).getByExternalIds(e.map((e) => ({
|
|
28
29
|
...e,
|
|
29
30
|
instanceType: "node"
|
|
30
|
-
})), [s])
|
|
31
|
+
})), [s]);
|
|
32
|
+
return n.map((e) => ({
|
|
31
33
|
...e,
|
|
32
34
|
properties: e.properties[l][c]
|
|
33
35
|
}));
|
|
@@ -4,11 +4,13 @@ import { SlimCadNodeWithBounds } from '../../utils/cadNodeConnectionFields';
|
|
|
4
4
|
import { ModelRevisionKey, ModelRevisionId, CadNodeIdData } from '../types';
|
|
5
5
|
export type CadModelMappingsWithNodes = Map<ModelRevisionKey, Map<InstanceKey, SlimCadNodeWithBounds[]>>;
|
|
6
6
|
export type CadModelMappings = Map<ModelRevisionKey, Map<InstanceKey, CadNodeIdData[]>>;
|
|
7
|
-
export type CadNodeMapping =
|
|
7
|
+
export type CadNodeMapping = CdmCadNodeMapping | HybridCadNodeMapping;
|
|
8
|
+
export type CdmCadNodeMapping = {
|
|
8
9
|
sourceType: 'cdm';
|
|
9
10
|
node: CadNodeIdData;
|
|
10
11
|
instance: DmsUniqueIdentifier;
|
|
11
|
-
}
|
|
12
|
+
};
|
|
13
|
+
export type HybridCadNodeMapping = {
|
|
12
14
|
sourceType: 'assetMapping';
|
|
13
15
|
node: CadNodeIdData;
|
|
14
16
|
instance: InstanceId;
|
|
@@ -17,4 +19,5 @@ export type CadInstanceMappingsCache = {
|
|
|
17
19
|
getMappingsForModelsAndInstances: (instances: InstanceId[], models: ModelRevisionId[], signal?: AbortSignal) => Promise<CadModelMappingsWithNodes>;
|
|
18
20
|
getAllModelMappings: (models: ModelRevisionId[], signal?: AbortSignal) => Promise<CadModelMappings>;
|
|
19
21
|
getAllModelMappingsWithViews: (models: ModelRevisionId[], signal?: AbortSignal) => Promise<CadModelMappings>;
|
|
22
|
+
getMappingsForNodes: (model: ModelRevisionId, nodes: CadNodeIdData[], signal?: AbortSignal) => Promise<CadNodeMapping[]>;
|
|
20
23
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isDmsInstance as e } from "../../../utilities/instanceIds/typeGuards.js";
|
|
2
2
|
import { createFdmKey as t, createModelRevisionKey as n } from "../idAndKeyTranslation.js";
|
|
3
3
|
import "../../../utilities/instanceIds/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { isDefined as r } from "../../../utilities/isDefined.js";
|
|
5
|
+
import { executeParallel as i } from "../../../utilities/executeParallel.js";
|
|
6
6
|
import { concatenateMapValues as a } from "../../../utilities/map/concatenateMapValues.js";
|
|
7
7
|
import { mergeMapMapValues as o } from "../../../utilities/map/mergeMapMapValues.js";
|
|
8
8
|
import "../../utils/getDMSModelRevisionRefs.js";
|
|
@@ -25,9 +25,9 @@ var l = class {
|
|
|
25
25
|
u(s);
|
|
26
26
|
let r = await this._classicCache?.getNodesForInstanceIds(e.modelId, e.revisionId, t);
|
|
27
27
|
if (u(s), r !== void 0) return [n(e.modelId, e.revisionId), r];
|
|
28
|
-
}).filter(
|
|
28
|
+
}).filter(r), m = await i(p, 2);
|
|
29
29
|
u(s);
|
|
30
|
-
let h = new Map(m.filter(
|
|
30
|
+
let h = new Map(m.filter(r));
|
|
31
31
|
return o([...h.entries(), ...f?.entries() ?? []]);
|
|
32
32
|
}
|
|
33
33
|
async getAllModelMappings(e, t) {
|
|
@@ -36,14 +36,17 @@ var l = class {
|
|
|
36
36
|
async getAllModelMappingsWithViews(e, t) {
|
|
37
37
|
return await this.getAllModelMappingsInternal(e, !0, t);
|
|
38
38
|
}
|
|
39
|
+
async getMappingsForNodes(e, t, n) {
|
|
40
|
+
return u(n), await this._dmCache?.getMappingsForNodes(e, t) ?? [];
|
|
41
|
+
}
|
|
39
42
|
async getAllModelMappingsInternal(e, c, l) {
|
|
40
43
|
u(l);
|
|
41
|
-
let d =
|
|
44
|
+
let d = i(e.map((e) => async () => {
|
|
42
45
|
if (this._classicCache !== void 0) return {
|
|
43
46
|
model: e,
|
|
44
47
|
mappings: await this._classicCache.getAssetMappingsForModel(e.modelId, e.revisionId)
|
|
45
48
|
};
|
|
46
|
-
}), 2), f = this._dmCache?.getAllMappingExternalIds(e, c), p = (await d).filter(
|
|
49
|
+
}), 2), f = this._dmCache?.getAllMappingExternalIds(e, c), p = (await d).filter(r).flat();
|
|
47
50
|
u(l);
|
|
48
51
|
let m = await f;
|
|
49
52
|
u(l);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { DmsUniqueIdentifier } from '../../FdmSDK';
|
|
2
|
-
import { FdmNodeDataPromises, ModelRevisionId, ModelRevisionToConnectionMap } from '../types';
|
|
2
|
+
import { CadNodeIdData, FdmNodeDataPromises, ModelRevisionId, ModelRevisionToConnectionMap } from '../types';
|
|
3
|
+
import { CadNodeMapping } from './CadInstanceMappingsCache';
|
|
3
4
|
import { ThreeDModelFdmMappings } from './types';
|
|
4
5
|
export type FdmCadNodeCache = {
|
|
5
6
|
getMappingsForFdmInstances: (instances: DmsUniqueIdentifier[], modelRevisionIds: ModelRevisionId[]) => Promise<ThreeDModelFdmMappings[]>;
|
|
6
7
|
getAllMappingExternalIds: (modelRevisionIds: ModelRevisionId[], fetchViews: boolean) => Promise<ModelRevisionToConnectionMap>;
|
|
8
|
+
getMappingsForNodes: (modelRevisionId: ModelRevisionId, nodes: CadNodeIdData[]) => Promise<CadNodeMapping[]>;
|
|
7
9
|
getClosestParentDataPromises: (modelId: number, revisionId: number, treeIndex: number) => FdmNodeDataPromises;
|
|
8
10
|
};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { CogniteClient } from '@cognite/sdk';
|
|
2
2
|
import { Fdm3dDataProvider } from '../../Fdm3dDataProvider';
|
|
3
|
+
import { FdmSDK } from '../../FdmSDK';
|
|
3
4
|
import { fetchNodesForNodeIds, inspectNodes, treeIndexesToNodeIds } from '../requests';
|
|
5
|
+
import { RevisionFdmNodeCache } from '../RevisionFdmNodeCache';
|
|
6
|
+
import { ModelId, RevisionId } from '../types';
|
|
4
7
|
import { FdmCadNodeCache } from './FdmCadNodeCache';
|
|
5
8
|
export type FdmCadNodeCacheDeps = {
|
|
6
9
|
treeIndexesToNodeIds: typeof treeIndexesToNodeIds;
|
|
7
10
|
fetchNodesForNodeIds: typeof fetchNodesForNodeIds;
|
|
8
11
|
inspectNodes: typeof inspectNodes;
|
|
12
|
+
createRevisionCache: (sdk: CogniteClient, fdmSdk: FdmSDK, fdmDataProvider: Fdm3dDataProvider, modelId: ModelId, revisionId: RevisionId) => RevisionFdmNodeCache;
|
|
13
|
+
createFdmClient: (sdk: CogniteClient) => FdmSDK;
|
|
9
14
|
};
|
|
10
15
|
export declare const defaultFdmCadNodeCacheDeps: FdmCadNodeCacheDeps;
|
|
11
16
|
export declare function createFdmCadNodeCache(cdfClient: CogniteClient, fdm3dDataProvider: Fdm3dDataProvider, deps?: FdmCadNodeCacheDeps): FdmCadNodeCache;
|
|
@@ -12,7 +12,9 @@ import { assert as h } from "@cognite/underscore";
|
|
|
12
12
|
var g = {
|
|
13
13
|
treeIndexesToNodeIds: l,
|
|
14
14
|
fetchNodesForNodeIds: s,
|
|
15
|
-
inspectNodes: c
|
|
15
|
+
inspectNodes: c,
|
|
16
|
+
createRevisionCache: (e, t, n, r, i) => new f(e, t, n, r, i),
|
|
17
|
+
createFdmClient: (e) => new i(e)
|
|
16
18
|
};
|
|
17
19
|
function _(e, t, n = g) {
|
|
18
20
|
return new v(e, t, n);
|
|
@@ -25,7 +27,7 @@ var v = class {
|
|
|
25
27
|
_deps;
|
|
26
28
|
_completeRevisions = /* @__PURE__ */ new Set();
|
|
27
29
|
constructor(e, t, n = g) {
|
|
28
|
-
this._cdfClient = e, this._fdmClient =
|
|
30
|
+
this._cdfClient = e, this._fdmClient = n.createFdmClient(e), this._fdm3dDataProvider = t, this._deps = n;
|
|
29
31
|
}
|
|
30
32
|
async getMappingsForFdmInstances(e, n) {
|
|
31
33
|
let [r, i] = m(n, (e) => {
|
|
@@ -34,6 +36,9 @@ var v = class {
|
|
|
34
36
|
}), a = await this.getNonCachedModelMappings(e, i), o = [...this.getCachedModelMappings(r, e), ...a];
|
|
35
37
|
return p(o, this._cdfClient);
|
|
36
38
|
}
|
|
39
|
+
getMappingsForNodes(e, t) {
|
|
40
|
+
return this.getOrCreateRevisionCache(e.modelId, e.revisionId).getConnectionsForNodes(t);
|
|
41
|
+
}
|
|
37
42
|
getCachedModelMappings(t, n) {
|
|
38
43
|
let r = new Set(n.map(e));
|
|
39
44
|
return t.map((e) => this.getCachedModelMappingForRevision(e, r));
|
|
@@ -141,7 +146,7 @@ var v = class {
|
|
|
141
146
|
getOrCreateRevisionCache(e, n) {
|
|
142
147
|
let r = t(e, n), i = this._revisionNodeCaches.get(r);
|
|
143
148
|
if (i !== void 0) return i;
|
|
144
|
-
let a =
|
|
149
|
+
let a = this._deps.createRevisionCache(this._cdfClient, this._fdmClient, this._fdm3dDataProvider, e, n);
|
|
145
150
|
return this._revisionNodeCaches.set(r, a), a;
|
|
146
151
|
}
|
|
147
152
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ViewDefinition
|
|
1
|
+
import { ViewDefinition } from '@cognite/sdk';
|
|
2
2
|
import { InstancesWithView, InstancesWithViewDefinition } from '../../ui/query/useSearchMappedEquipmentFDM';
|
|
3
|
-
import { FdmCadConnection } from '../cache/types';
|
|
3
|
+
import { CadNodeIdData, FdmCadConnection } from '../cache/types';
|
|
4
4
|
import { Fdm3dDataProvider } from '../Fdm3dDataProvider';
|
|
5
5
|
import { DmsUniqueIdentifier, FdmSDK, InstanceFilter, NodeItem, Source } from '../FdmSDK';
|
|
6
6
|
import { Classic3DResourceIdentifier, ThreeDResourceIdentifier } from '../types/resources';
|
|
@@ -22,7 +22,7 @@ export declare class CoreDm3dFdm3dDataProvider implements Fdm3dDataProvider {
|
|
|
22
22
|
private getDMSRevisionsForRevisionIdsAndModelRefs;
|
|
23
23
|
private getRevisionRefsByType;
|
|
24
24
|
getEdgeConnected3dInstances(instance: DmsUniqueIdentifier): Promise<DmsUniqueIdentifier[]>;
|
|
25
|
-
getFdmConnectionsForNodes(models: DmsUniqueIdentifier[], revisionId: number, nodes:
|
|
25
|
+
getFdmConnectionsForNodes(models: DmsUniqueIdentifier[], revisionId: number, nodes: CadNodeIdData[]): Promise<FdmCadConnection[]>;
|
|
26
26
|
listMappedFdmNodes(models: ThreeDResourceIdentifier[], sourcesToSearch: ViewDefinition[], instanceFilter: InstanceFilter | undefined, limit: number): Promise<NodeItem[]>;
|
|
27
27
|
listAllMappedFdmNodes(models: ThreeDResourceIdentifier[], sourcesToSearch: Source[], instanceFilter: InstanceFilter | undefined): Promise<NodeItem[]>;
|
|
28
28
|
filterNodesByMappedTo3d(nodes: InstancesWithViewDefinition[], models: ThreeDResourceIdentifier[], includeIndirectRelations: boolean): Promise<InstancesWithView[]>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { restrictToDmsId as e } from "../../utilities/restrictToDmsId.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { isDefined as t } from "../../utilities/isDefined.js";
|
|
3
|
+
import { COGNITE_3D_OBJECT_SOURCE as n } from "./dataModels.js";
|
|
4
|
+
import { executeParallel as r } from "../../utilities/executeParallel.js";
|
|
5
5
|
import { getDMSModels as i } from "./getDMSModels.js";
|
|
6
6
|
import { getDMSRevision as a } from "./getDMSRevision.js";
|
|
7
7
|
import { EMPTY_ARRAY as o } from "../../utilities/constants.js";
|
|
@@ -27,7 +27,7 @@ var v = 2, y = {
|
|
|
27
27
|
this._fdmSdk = e, this._deps = t;
|
|
28
28
|
}
|
|
29
29
|
is3dView(e) {
|
|
30
|
-
return e.implements?.some((e) => e.externalId ===
|
|
30
|
+
return e.implements?.some((e) => e.externalId === n.externalId && e.space === n.space && e.version === n.version) ?? !1;
|
|
31
31
|
}
|
|
32
32
|
async getDMSModels(e) {
|
|
33
33
|
let t = this._modelIdToDMSIdentifier.get(e);
|
|
@@ -45,10 +45,10 @@ var v = 2, y = {
|
|
|
45
45
|
return e(r);
|
|
46
46
|
}
|
|
47
47
|
async getDMSModelsForIds(e) {
|
|
48
|
-
return (await
|
|
48
|
+
return (await r(e.map((e) => async () => await this.getDMSModels(e)), v)).flat();
|
|
49
49
|
}
|
|
50
|
-
async getDMSRevisionsForRevisionIdsAndModelRefs(e,
|
|
51
|
-
return (await
|
|
50
|
+
async getDMSRevisionsForRevisionIdsAndModelRefs(e, n) {
|
|
51
|
+
return (await r(n.map((t, n) => async () => e[n] === void 0 ? void 0 : await this.getDMSRevision(e[n], t)), v)).filter(t);
|
|
52
52
|
}
|
|
53
53
|
async getRevisionRefsByType(e) {
|
|
54
54
|
let [t, n] = g(e, (e) => e.type === "cad"), [r, i] = g(n, (e) => e.type === "pointcloud"), [a, o, s] = await Promise.all([
|
|
@@ -87,12 +87,12 @@ var v = 2, y = {
|
|
|
87
87
|
}
|
|
88
88
|
async getCadConnectionsForRevisions(e) {
|
|
89
89
|
if (e.length === 0) return o;
|
|
90
|
-
let
|
|
90
|
+
let n = await this.getDMSModelsForIds(e.map((e) => e.modelId)), r = await this.getDMSRevisionsForRevisionIdsAndModelRefs(n, e.map((e) => e.revisionId)), i = _(n, r).filter((e) => t(e[0]) && t(e[1]));
|
|
91
91
|
return await u(i, this._fdmSdk);
|
|
92
92
|
}
|
|
93
|
-
async getCadConnectionsForInstances(e,
|
|
94
|
-
if (
|
|
95
|
-
let r = await this.getDMSModelsForIds(
|
|
93
|
+
async getCadConnectionsForInstances(e, n) {
|
|
94
|
+
if (n.length === 0) return o;
|
|
95
|
+
let r = await this.getDMSModelsForIds(n.map((e) => e.modelId)), i = await this.getDMSRevisionsForRevisionIdsAndModelRefs(r, n.map((e) => e.revisionId)), a = _(r, i).filter((e) => t(e[0]) && t(e[1]));
|
|
96
96
|
return await l(e, a, this._fdmSdk);
|
|
97
97
|
}
|
|
98
98
|
async getRevisionRefs(e) {
|
|
@@ -3,8 +3,8 @@ import { createFdmKey as t } from "../cache/idAndKeyTranslation.js";
|
|
|
3
3
|
import "../../utilities/instanceIds/index.js";
|
|
4
4
|
import { restrictToDmsId as n } from "../../utilities/restrictToDmsId.js";
|
|
5
5
|
import { isDefined as r } from "../../utilities/isDefined.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { COGNITE_CAD_NODE_VIEW_VERSION_KEY as i, COGNITE_POINT_CLOUD_VOLUME_VIEW_VERSION_KEY as a, CORE_DM_SPACE as o } from "./dataModels.js";
|
|
7
|
+
import { createDmsQueryDataAccumulator as s } from "../../utilities/dms-cursoring/dmsAccumulator.js";
|
|
8
8
|
import { getCogniteAssetDirectRelationProperties as c } from "../utils/getCogniteAssetDirectRelationProperties.js";
|
|
9
9
|
import { createCheck3dConnectedEquipmentQuery as l } from "./check3dConnectedEquipmentQuery.js";
|
|
10
10
|
import { transformViewDefinitionToSource as u } from "./utils/transformViewItemToSource.js";
|
|
@@ -27,13 +27,13 @@ async function m(n, i, a, o, s) {
|
|
|
27
27
|
instances: e.instances
|
|
28
28
|
})).filter(r);
|
|
29
29
|
}
|
|
30
|
-
async function h(e, a, o,
|
|
31
|
-
let m = e.flatMap((e) => e.instances.map(n)), h = e.flatMap((e) => e.instances.flatMap((t) => c(t, e.view))).filter((e) => r(e) && e.externalId !== void 0 && e.space !== void 0), _ = f(m, h), v = p(_, t), y = d(v, 2e3), b = { revisionRefs:
|
|
30
|
+
async function h(e, i, a, o, u) {
|
|
31
|
+
let m = e.flatMap((e) => e.instances.map(n)), h = e.flatMap((e) => e.instances.flatMap((t) => c(t, e.view))).filter((e) => r(e) && e.externalId !== void 0 && e.space !== void 0), _ = f(m, h), v = p(_, t), y = d(v, 2e3), b = { revisionRefs: i }, x = [];
|
|
32
32
|
for (let e of y) {
|
|
33
33
|
let t = {
|
|
34
|
-
...l(e,
|
|
34
|
+
...l(e, i, u),
|
|
35
35
|
parameters: b
|
|
36
|
-
}, n = await
|
|
36
|
+
}, n = await s(a, t, { serial: ["initial_nodes", { parallel: [
|
|
37
37
|
"initial_nodes_cad_nodes",
|
|
38
38
|
"initial_nodes_point_cloud_volumes",
|
|
39
39
|
{ serial: ["initial_edges_360_image_annotations", "initial_nodes_360_images"] },
|
|
@@ -43,18 +43,18 @@ async function h(e, a, o, s, u) {
|
|
|
43
43
|
{ serial: ["indirect_edges_360_image_annotations", "indirect_nodes_360_images"] }
|
|
44
44
|
] }] }
|
|
45
45
|
] }] }).accumulateAllData();
|
|
46
|
-
x.push(...g(n,
|
|
46
|
+
x.push(...g(n, o));
|
|
47
47
|
}
|
|
48
48
|
return new Set(x);
|
|
49
49
|
}
|
|
50
|
-
function g(n,
|
|
51
|
-
let c = [...n.items.initial_nodes_cad_nodes].concat(
|
|
52
|
-
let r = n.properties[
|
|
50
|
+
function g(n, s) {
|
|
51
|
+
let c = [...n.items.initial_nodes_cad_nodes].concat(s ? n.items.indirect_nodes_cad_nodes : []).map((n) => {
|
|
52
|
+
let r = n.properties[o][i].object3D;
|
|
53
53
|
return e(r) ? t(r) : void 0;
|
|
54
|
-
}).filter(r), l = [...n.items.initial_nodes_point_cloud_volumes].concat(
|
|
55
|
-
let r = n.properties[
|
|
54
|
+
}).filter(r), l = [...n.items.initial_nodes_point_cloud_volumes].concat(s ? n.items.indirect_nodes_point_cloud_volumes : []).map((n) => {
|
|
55
|
+
let r = n.properties[o][a].object3D;
|
|
56
56
|
return e(r) ? t(r) : void 0;
|
|
57
|
-
}).filter(r), u = new Set([...n.items.initial_nodes_360_images, ...
|
|
57
|
+
}).filter(r), u = new Set([...n.items.initial_nodes_360_images, ...s ? n.items.indirect_nodes_360_images : []].map(t)), d = [...n.items.initial_edges_360_image_annotations, ...s ? n.items.indirect_edges_360_image_annotations : []].filter((e) => u.has(t(e.endNode))).map((e) => t(e.startNode));
|
|
58
58
|
return [
|
|
59
59
|
...c,
|
|
60
60
|
...l,
|