You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

@equinor/echo-3d-viewer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equinor/echo-3d-viewer - npm Package Compare versions

Comparing version

to
0.0.4

@@ -7,2 +7,3 @@ import { CadModelBudget } from '@cognite/reveal';

* markerPoint - Emitted when item is clicked for marking. Payload contains point, treeIndex, modelId
* clearAllTools - Emitted when user requests all tools to be cleared. Payload is empty.
*/

@@ -12,2 +13,3 @@ export declare const toolsEvents: {

markerPoint: string;
clearAllTools: string;
};

@@ -14,0 +16,0 @@ /**

@@ -13,6 +13,8 @@ // copied from reveal (cannot import from reveal because it is not properly exported)

* markerPoint - Emitted when item is clicked for marking. Payload contains point, treeIndex, modelId
* clearAllTools - Emitted when user requests all tools to be cleared. Payload is empty.
*/
export const toolsEvents = {
coloringPoint: 'coloringPoint',
markerPoint: 'markerPoint'
markerPoint: 'markerPoint',
clearAllTools: 'clearAllTools'
};

@@ -19,0 +21,0 @@ /**

@@ -16,3 +16,3 @@ import CameraControls from 'camera-controls';

export { AabbModel, DataMaintenanceClient, ApiException as HierarchyApiException, HierarchyClient, HierarchyNodeModel, HierarchyNodeModelListResult, IAabbModel, IDataMaintenanceClient, IHierarchyClient, IHierarchyNodeModel, IHierarchyNodeModelListResult, INodeWithLeafNodes, INodeWithLeafNodesListResult, ISimpleNodeModel, IStatusClient, IStringListResult, IUInt32ListResult, IVector3Model, NodeWithLeafNodes, NodeWithLeafNodesListResult, SimpleNodeModel, StatusClient, StringListResult, UInt32ListResult, Vector3Model } from './services/generated/EchoHierarchyApiClient';
export { ApiStatusClient, AssetDownloadDto, AssetDownloadToken, AssetMetadataDto, AssetMetadataSimpleDto, AssetUploadToken, FileResponse, IApiStatusClient, IAssetDownloadDto, IAssetDownloadToken, IAssetMetadataDto, IAssetMetadataSimpleDto, IAssetUploadToken, IMinimapMetadata, IModelAdminClient, IModelsClient, IProblemDetails, IRevealBlobOutputMetadata, IRevealProxyClient, IRevealRevision3D, IRevealRevisionOutputs, IRevisionCameraProperties, IStream, MinimapMetadata, MinimapVector3, ModelAdminClient, ApiException as ModelApiException, ModelsClient, ModelStates, ProblemDetails, RevealBlobOutputMetadata, RevealProxyClient, RevealRevision3D, RevealRevisionOutputs, Revision3DStatus, RevisionCameraProperties, Stream } from './services/generated/EchoModelDistributionApiClient';
export { ApiStatusClient, AssetDownloadDto, AssetDownloadToken, AssetMetadataDto, AssetMetadataSimpleDto, AssetUploadToken, FileResponse, IApiStatusClient, IAssetDownloadDto, IAssetDownloadToken, IAssetMetadataDto, IAssetMetadataSimpleDto, IAssetUploadToken, IMinimapMetadata, IModelAdminClient, IModelsClient, IProblemDetails, IRevealBlobOutputMetadata, IRevealProxyClient, IRevealRevision3D, IRevealRevisionOutputs, IRevisionCameraProperties, MinimapMetadata, MinimapVector3, ModelAdminClient, ApiException as ModelApiException, ModelsClient, ModelStates, ProblemDetails, RevealBlobOutputMetadata, RevealProxyClient, RevealRevision3D, RevealRevisionOutputs, Revision3DStatus, RevisionCameraProperties } from './services/generated/EchoModelDistributionApiClient';
export { disposeHierarchyClient, getAreaNames, getHierarchyClient, getTagNoRefNoAndAabbByNodeId, getTopNodes, getTreeIndexNodeCollectionForNodesMatchingPdmsKeyValuePairs, initializeHierarchyClient } from './services/hierarchyClient';

@@ -30,2 +30,3 @@ export { disposeModelsClient, getAvailableModels, getModelsClient, initializeModelClient } from './services/modelsClient';

export { EchoSetupObject } from './types/echoSetupObject';
export { GlobalSelectionTagsUpdatedEvent } from './types/globalSelectionMultiSelectEvent';
export { PixelIntersectionQuery } from './types/pixelIntersectionQuery';

@@ -37,2 +38,3 @@ export { RendererConfiguration } from './types/rendererConfiguration';

export { SelectionStartedEvent } from './types/selectionStartedEvent';
export { SimpleHierarchyNode } from './types/SimpleHierarchyNode';
export { TrackErrorType } from './types/TrackErrorType';

@@ -39,0 +41,0 @@ export { TrackEventBySignature } from './types/trackEventBySignature';

@@ -17,3 +17,3 @@ import CameraControls from 'camera-controls';

export { AabbModel, DataMaintenanceClient, ApiException as HierarchyApiException, HierarchyClient, HierarchyNodeModel, HierarchyNodeModelListResult, NodeWithLeafNodes, NodeWithLeafNodesListResult, SimpleNodeModel, StatusClient, StringListResult, UInt32ListResult, Vector3Model } from './services/generated/EchoHierarchyApiClient';
export { ApiStatusClient, AssetDownloadDto, AssetDownloadToken, AssetMetadataDto, AssetMetadataSimpleDto, AssetUploadToken, MinimapMetadata, MinimapVector3, ModelAdminClient, ApiException as ModelApiException, ModelsClient, ProblemDetails, RevealBlobOutputMetadata, RevealProxyClient, RevealRevision3D, RevealRevisionOutputs, RevisionCameraProperties, Stream } from './services/generated/EchoModelDistributionApiClient';
export { ApiStatusClient, AssetDownloadDto, AssetDownloadToken, AssetMetadataDto, AssetMetadataSimpleDto, AssetUploadToken, MinimapMetadata, MinimapVector3, ModelAdminClient, ApiException as ModelApiException, ModelsClient, ProblemDetails, RevealBlobOutputMetadata, RevealProxyClient, RevealRevision3D, RevealRevisionOutputs, RevisionCameraProperties } from './services/generated/EchoModelDistributionApiClient';
export { disposeHierarchyClient, getAreaNames, getHierarchyClient, getTagNoRefNoAndAabbByNodeId, getTopNodes, getTreeIndexNodeCollectionForNodesMatchingPdmsKeyValuePairs, initializeHierarchyClient } from './services/hierarchyClient';

@@ -20,0 +20,0 @@ export { disposeModelsClient, getAvailableModels, getModelsClient, initializeModelClient } from './services/modelsClient';

@@ -18,2 +18,3 @@ /**

import { ParsedGeometry } from '@cognite/reveal/dist/packages/sector-parser';
import * as THREE from 'three';
import { Group } from 'three';

@@ -20,0 +21,0 @@ export declare function incrementOrInsertIndex(indexMap: Map<number, number>, index: number): void;

@@ -23,3 +23,3 @@ /*!

*/
static copyGeometryWithBufferAttributes(geometry: BufferGeometry): THREE.BufferGeometry;
static copyGeometryWithBufferAttributes(geometry: BufferGeometry): BufferGeometry;
/**

@@ -26,0 +26,0 @@ *

@@ -270,2 +270,3 @@ import { DebouncedCameraStopEventTrigger } from '@cognite/reveal';

this.controls = newControls;
this.onCameraPoseUpdated(); // Ensure reveal understands we have a new camera and load the 3D model accordingly
}

@@ -272,0 +273,0 @@ /**

@@ -45,5 +45,5 @@ import { CancelToken } from '@esfx/canceltoken';

value.clearSelectionAndCancelOngoing(this.previousCancellationTokenSource.token);
Echo3dGlobalSelectionManager.emitEvent('selectedTagInformationUpdated');
Echo3dGlobalSelectionManager.emitEvent('selectedModelInformationUpdated');
});
Echo3dGlobalSelectionManager.emitEvent('selectedTagInformationUpdated');
Echo3dGlobalSelectionManager.emitEvent('selectedModelInformationUpdated');
};

@@ -80,5 +80,5 @@ /**

value.clearSelection();
Echo3dGlobalSelectionManager.emitEvent('selectedTagInformationUpdated');
}
});
Echo3dGlobalSelectionManager.emitEvent('selectedTagInformationUpdated');
const data = await correctSingleSelectionHandler.setLocalSelectionBasedOnE3dTagNo(e3dTagNo, cancellationToken);

@@ -131,3 +131,2 @@ this.currentSelectionInfo = {

value.clearSelection();
Echo3dGlobalSelectionManager.emitEvent('selectedTagInformationUpdated');
}

@@ -134,0 +133,0 @@ });

import { CogniteCadModel, TreeIndexNodeCollection } from '@cognite/reveal';
import { SimpleHierarchyNode } from '../types/SimpleHierarchyNode';
import { HierarchyNodeModel } from './generated/EchoHierarchyApiClient';

@@ -16,3 +17,7 @@ /**

/**
* Adds highlighting to collections. Removes the current.
* Removes the current highlighting by unassigning the node collections
*/
removeHighlighting(): void;
/**
* Update highlighting to collections. Removes the current.
* @param collections collections of nodes to add style to, the key indicates which color to highlight with

@@ -22,3 +27,3 @@ * Color is defined in hex

*/
addHighlightToCollections(collections: Map<string, HierarchyNodeModel[]>): void;
updateHighlightToCollections(collections: Map<string, SimpleHierarchyNode[]>): void;
/**

@@ -25,0 +30,0 @@ * Adds highlighting to one node, used when user clicks in 3D model

@@ -19,3 +19,12 @@ import * as THREE from 'three';

/**
* Adds highlighting to collections. Removes the current.
* Removes the current highlighting by unassigning the node collections
*/
removeHighlighting() {
this.highlightCollections.forEach((nodeCollectionsToRemove) => {
this.model.unassignStyledNodeCollection(nodeCollectionsToRemove);
});
this.highlightCollections = new Map();
}
/**
* Update highlighting to collections. Removes the current.
* @param collections collections of nodes to add style to, the key indicates which color to highlight with

@@ -25,8 +34,5 @@ * Color is defined in hex

*/
addHighlightToCollections(collections) {
updateHighlightToCollections(collections) {
// remove current styled node collections to add new
this.highlightCollections.forEach((nodeCollectionsToRemove) => {
this.model.unassignStyledNodeCollection(nodeCollectionsToRemove);
});
this.highlightCollections = new Map();
this.removeHighlighting();
// create new styled node collections

@@ -33,0 +39,0 @@ collections.forEach((nodes, colorKey) => {

@@ -7,3 +7,3 @@ import { CogniteCadModel, IndexSet, NodeAppearance } from '@cognite/reveal';

/**
* Highlight handler class that handles highlighting of multiple tags or three indexes
* Highlight handler class that handles highlighting of multiple tags or tree indexes
*

@@ -40,2 +40,8 @@ */

/**
* Triggers a global selection multi select event
* @param treeIndex the pdms tag for the selection
* @param cancellationToken the cancellationToken
*/
static signalGlobalSelectionMultiSelect(treeIndex: number, cancellationToken?: CancelToken): void;
/**
* Used to highlight based on ctrl and click from the viewer

@@ -42,0 +48,0 @@ * @param treeIndex The treeIndex of the item clicked

@@ -18,3 +18,3 @@ import { IndexSet, TreeIndexNodeCollection } from '@cognite/reveal';

/**
* Highlight handler class that handles highlighting of multiple tags or three indexes
* Highlight handler class that handles highlighting of multiple tags or tree indexes
*

@@ -64,2 +64,13 @@ */

/**
* Triggers a global selection multi select event
* @param treeIndex the pdms tag for the selection
* @param cancellationToken the cancellationToken
*/
static signalGlobalSelectionMultiSelect(treeIndex, cancellationToken = CancelToken.none) {
Echo3dHighlightHandler.emitEvent('globalSelectionTagsUpdated', {
treeIndex,
cancellationToken
});
}
/**
* Used to highlight based on ctrl and click from the viewer

@@ -66,0 +77,0 @@ * @param treeIndex The treeIndex of the item clicked

import { CogniteCadModel, NodeAppearance } from '@cognite/reveal';
import { CancelToken } from '@esfx/canceltoken';
import * as THREE from 'three';
import { SelectedNodeInformation } from '../types/selectedNodeInformation';

@@ -37,3 +38,3 @@ import { SelectionInfo } from '../types/SelectionInfo';

* Clear the current selected tag information, selected nodes and sibling nodes
* Also cancel ongoing selection and emit event
* Also cancel ongoing selections
* @param cancellationToken Cancellation token

@@ -40,0 +41,0 @@ */

@@ -68,3 +68,3 @@ import { IndexSet, TreeIndexNodeCollection } from '@cognite/reveal';

* Clear the current selected tag information, selected nodes and sibling nodes
* Also cancel ongoing selection and emit event
* Also cancel ongoing selections
* @param cancellationToken Cancellation token

@@ -71,0 +71,0 @@ */

@@ -27,2 +27,3 @@ import { CadModelBudget, Cognite3DViewer, Cognite3DViewerOptions, CogniteCadModel, Image360, Intersection } from '@cognite/reveal';

private echoLatestRequestId;
private isGlobalSelectionEnabled;
private trackEventBy;

@@ -51,5 +52,6 @@ private selectionByPickingEnabled;

* @param options needed for CogniteClient
* @param isGlobalSelectionEnabled flag denoting whether global selection is activated
* @param trackEventBy optional event used to log/track when controls events are fired
*/
constructor(options: Cognite3DViewerOptions, trackEventBy?: TrackEventBySignature);
constructor(options: Cognite3DViewerOptions, isGlobalSelectionEnabled: boolean, trackEventBy?: TrackEventBySignature);
/**

@@ -272,3 +274,3 @@ * Replace Reveal getIntersectionFromPixel to add functionality, improve performance and fix bugs

*/
setTrackErrorOnSelectionByPicking: (trackError?: ((type: TrackErrorType, ex: Error) => void) | undefined) => void;
setTrackErrorOnSelectionByPicking: (trackError?: (type: TrackErrorType, ex: Error) => void) => void;
/**

@@ -401,4 +403,4 @@ * Method for enabling selection by pointer

*/
get360ImageFromImageCollections(imageId: string): Image360 | undefined;
get360ImageFromImageCollections(imageId: string): Image360<import("@cognite/reveal").ClassicDataSourceType> | undefined;
}
//# sourceMappingURL=echo3DViewer.d.ts.map

@@ -33,5 +33,6 @@ import { Cognite3DViewer, CogniteCadModel, DefaultNodeAppearance } from '@cognite/reveal';

* @param options needed for CogniteClient
* @param isGlobalSelectionEnabled flag denoting whether global selection is activated
* @param trackEventBy optional event used to log/track when controls events are fired
*/
constructor(options, trackEventBy) {
constructor(options, isGlobalSelectionEnabled, trackEventBy) {
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/no-unsafe-member-access, no-param-reassign, @typescript-eslint/no-explicit-any -- Needed to inject custom culler

@@ -340,2 +341,8 @@ options._sectorCuller = new EchoSectorCuller();

}
else if (event.ctrlKey && this.isGlobalSelectionEnabled) {
this.previousHighlightCancellationTokenSource.cancel();
const currentHighlightCancelTokenSource = CancelToken.source();
this.previousHighlightCancellationTokenSource = currentHighlightCancelTokenSource;
Echo3dHighlightHandler.signalGlobalSelectionMultiSelect(treeIndex, currentHighlightCancelTokenSource.token);
}
else {

@@ -545,2 +552,12 @@ // We are highlighting things

this.hackDeallocateTransformTexture(rootCadNode);
// Semi-Hack: Single Sided rendering
const materials = rootCadNode.materialManager.getModelMaterials(rootCadNode.cadModelIdentifier);
// Set single sided rendering for some materials.
// This should be a performance increase
// Primitives should usually be double sided, as they are specially handled in Reveal.
// See:
// https://github.com/equinor/reveal/blob/b83e6f117363c7c77541d5d350d3f6be8cca7b92/viewer/packages/sector-parser/src/reveal-glb-parser/primitiveGeometries.ts#L131
materials.triangleMesh.side = THREE.FrontSide;
materials.instancedMesh.side = THREE.FrontSide;
materials.box.side = THREE.FrontSide;
// Fix for https://github.com/cognitedata/reveal/pull/3946

@@ -572,4 +589,5 @@ // Where the budget reveal sets may be too low, and the memory cache gets in its own way.

this.getSelectionManager().removeModelSelectionHandler(modelId, revisionId);
this.removeHighlightHandler(modelId, revisionId);
this.removeColoringHandler(modelId, revisionId);
this.highlightHandler.delete(`${modelId}_${revisionId}`);
this.coloringToolHandler.delete(`${modelId}_${revisionId}`);
this.highlightCollectionsHandler.delete(`${modelId}_${revisionId}`);
}

@@ -653,2 +671,3 @@ else {

this.spinner = new NoOpSpinner();
this.isGlobalSelectionEnabled = isGlobalSelectionEnabled;
}

@@ -655,0 +674,0 @@ /**

import { HtmlOverlayOptions, HtmlOverlayTool } from '@cognite/reveal';
import * as THREE from 'three';
import { Echo3dViewer } from './echo3DViewer';

@@ -38,3 +39,3 @@ /**

/**
* Method for calculating the updates per secund based on the number of elements the html tool has
* Method for calculating the updates per second based on the number of elements the html tool has
* @returns updates per seconds

@@ -41,0 +42,0 @@ */

import { throttle } from 'lodash';
import * as THREE from 'three';
import { debounce } from '../utils/debounceUtils';

@@ -97,3 +98,3 @@ /**

/**
* Method for calculating the updates per secund based on the number of elements the html tool has
* Method for calculating the updates per second based on the number of elements the html tool has
* @returns updates per seconds

@@ -122,10 +123,40 @@ */

*/
add(htmlElement, position3D, options) {
add(htmlElement, position3D, options = {}) {
if (this.isDisposed)
return;
const updatesPerSeconds = this.getUpdatesPerSecondForNumberOfElements();
if (updatesPerSeconds !== this.previousMaxUpdatesPerSecond) {
this.updateMaxUpdatesPerSecondThrottle(updatesPerSeconds);
// In the Echo3DViewer we have a mocked htmlOverlayTool that has a fake state. To support the reveal v4.21.x code we temporarily add a check for if we are running under test to use the mock instead of the "real" implementation.
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access -- test
if (this.htmlOverlayTool.add._isMockFunction) {
this.htmlOverlayTool.add(htmlElement, position3D, options);
return;
}
this.htmlOverlayTool.add(htmlElement, position3D, options);
// AB#203433: This reimplements the 'htmlOverlayTool.add' method without the setTimeout found in reveal v4.21.3. We need to remove this workaround when we have created a PR and fix in reveal.
// --START Workaround Code--
if (this.EchoViewer.domElement.contains(htmlElement)) {
throw new Error(`Element is already attached to viewer`);
}
// eslint-disable-next-line no-param-reassign -- same as in reveal
htmlElement.style.visibility = 'hidden';
// Note! Must be part of DOM tree before we do getComputedStyle(), so add before check
this.EchoViewer.domElement.appendChild(htmlElement);
const style = getComputedStyle(htmlElement);
if (!style.position || style.position !== 'absolute') {
this.EchoViewer.domElement.removeChild(htmlElement);
throw new Error(`htmlElement style must have a position of absolute. but was '${style.position}'`);
}
const element = {
position3D,
options,
state: {
position2D: new THREE.Vector2(),
width: -1,
height: -1,
visible: true
}
};
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, no-underscore-dangle, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any -- need to inject this
this.htmlOverlayTool._htmlOverlays.set(htmlElement, element);
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any -- need to inject this
this.htmlOverlayTool.scheduleUpdate();
// --END Workaround Code--
}

@@ -132,0 +163,0 @@ /**

@@ -125,4 +125,3 @@ import { delayAsync } from '../../utils/asyncUtils';

async getNewTokenAndAddToCache(modelId) {
const data = await this.modelsClient.getModelFilesByModelId(modelId);
const assetDownloadInfo = data.assetDownloadInfo;
const { assetDownloadInfo } = await this.modelsClient.getModelFilesByModelId(modelId);
const expiration = parseExpirationFromSasToken(assetDownloadInfo.downloadSasToken);

@@ -129,0 +128,0 @@ this.tokenCache.set(modelId, { expiration, assetDownloadInfo });

@@ -118,3 +118,3 @@ export interface IDataMaintenanceClient {

*/
findNodeByTagsByTagStartsWith(collection: string, limit?: number | undefined, body?: string | undefined): Promise<HierarchyNodeModelListResult>;
findNodesByTagStartsWith(collection: string, limit?: number | undefined, body?: string | undefined): Promise<HierarchyNodeModelListResult>;
/**

@@ -254,2 +254,11 @@ * @param limit (optional)

getIdRangesForNodesMatchingPdmsKeyValuePairs(collection: string, pdmsKey?: string | undefined, pdmsValue?: string | undefined): Promise<IdRangeModel[]>;
/**
* Get the area of the parts closest to the input position
* @param xPos (optional)
* @param yPos (optional)
* @param zPos (optional)
* @param distance (optional) The distance from the given point to check for parts in areas
* @return Success
*/
getNearbyAreasToPosition(collection: string, xPos?: number | undefined, yPos?: number | undefined, zPos?: number | undefined, distance?: number | undefined): Promise<NearbyAreaModel[]>;
}

@@ -351,4 +360,4 @@ export declare class HierarchyClient implements IHierarchyClient {

*/
findNodeByTagsByTagStartsWith(collection: string, limit?: number | undefined, body?: string | undefined, signal?: AbortSignal | undefined): Promise<HierarchyNodeModelListResult>;
protected processFindNodeByTagsByTagStartsWith(response: Response): Promise<HierarchyNodeModelListResult>;
findNodesByTagStartsWith(collection: string, limit?: number | undefined, body?: string | undefined, signal?: AbortSignal | undefined): Promise<HierarchyNodeModelListResult>;
protected processFindNodesByTagStartsWith(response: Response): Promise<HierarchyNodeModelListResult>;
/**

@@ -512,2 +521,12 @@ * @param limit (optional)

protected processGetIdRangesForNodesMatchingPdmsKeyValuePairs(response: Response): Promise<IdRangeModel[]>;
/**
* Get the area of the parts closest to the input position
* @param xPos (optional)
* @param yPos (optional)
* @param zPos (optional)
* @param distance (optional) The distance from the given point to check for parts in areas
* @return Success
*/
getNearbyAreasToPosition(collection: string, xPos?: number | undefined, yPos?: number | undefined, zPos?: number | undefined, distance?: number | undefined, signal?: AbortSignal | undefined): Promise<NearbyAreaModel[]>;
protected processGetNearbyAreasToPosition(response: Response): Promise<NearbyAreaModel[]>;
}

@@ -626,2 +645,16 @@ export interface IStatusClient {

}
export declare class NearbyAreaModel implements INearbyAreaModel {
area: string;
count: number;
percentageOfTotal: number;
constructor(data?: INearbyAreaModel);
init(_data?: any): void;
static fromJS(data: any): NearbyAreaModel;
toJSON(data?: any): any;
}
export interface INearbyAreaModel {
area: string;
count: number;
percentageOfTotal: number;
}
export declare class NodeWithLeafNodes implements INodeWithLeafNodes {

@@ -628,0 +661,0 @@ parentNode: SimpleNodeModel;

@@ -5,3 +5,3 @@ export interface IApiStatusClient {

This route can be used as a "Am I online" check in the Echo Clients, instead of "ping equinor.com" or similar.
* @return Success
* @return OK
*/

@@ -20,3 +20,3 @@ getApiStatusIsOnline(): Promise<void>;

This route can be used as a "Am I online" check in the Echo Clients, instead of "ping equinor.com" or similar.
* @return Success
* @return OK
*/

@@ -32,3 +32,3 @@ getApiStatusIsOnline(signal?: AbortSignal | undefined): Promise<void>;

*/
addModelAndRetrieveUploadToken(body?: AssetMetadataDto | undefined): Promise<AssetUploadToken>;
addModelAndRetrieveUploadToken(body?: CreateAssetMetadataDto | undefined): Promise<AssetUploadToken>;
/**

@@ -52,3 +52,3 @@ * Set the upload state for an uploadToken

*/
addModelAndRetrieveUploadToken(body?: AssetMetadataDto | undefined, signal?: AbortSignal | undefined): Promise<AssetUploadToken>;
addModelAndRetrieveUploadToken(body?: CreateAssetMetadataDto | undefined, signal?: AbortSignal | undefined): Promise<AssetUploadToken>;
protected processAddModelAndRetrieveUploadToken(response: Response): Promise<AssetUploadToken>;

@@ -69,3 +69,3 @@ /**

* @param plantSection (optional)
* @return Success
* @return OK
*/

@@ -75,3 +75,3 @@ listModels(artifactKind?: string | undefined, artifactVersion?: string | undefined, plantCode?: string | undefined, plantSection?: string | undefined): Promise<AssetMetadataSimpleDto[]>;

* Get a model by Id
* @return Success
* @return OK
*/

@@ -81,3 +81,3 @@ getModelById(id: number): Promise<AssetDownloadDto>;

* Get a model by Id, including list of available files
* @return Success
* @return OK
*/

@@ -87,3 +87,3 @@ getModelFilesByModelId(id: number): Promise<AssetDownloadDto>;

* Get metadata of minimaps for model by model id.
* @return Success
* @return OK
*/

@@ -93,3 +93,3 @@ getMinimapsMetadataByModelId(id: number): Promise<MinimapMetadata[]>;

* Get minimap image by model id and minimap view.
* @return Success
* @return OK
*/

@@ -111,3 +111,3 @@ getMinimapByModelIdAndView(modelId: number, view: string): Promise<FileResponse>;

* @param plantSection (optional)
* @return Success
* @return OK
*/

@@ -118,3 +118,3 @@ listModels(artifactKind?: string | undefined, artifactVersion?: string | undefined, plantCode?: string | undefined, plantSection?: string | undefined, signal?: AbortSignal | undefined): Promise<AssetMetadataSimpleDto[]>;

* Get a model by Id
* @return Success
* @return OK
*/

@@ -125,3 +125,3 @@ getModelById(id: number, signal?: AbortSignal | undefined): Promise<AssetDownloadDto>;

* Get a model by Id, including list of available files
* @return Success
* @return OK
*/

@@ -132,3 +132,3 @@ getModelFilesByModelId(id: number, signal?: AbortSignal | undefined): Promise<AssetDownloadDto>;

* Get metadata of minimaps for model by model id.
* @return Success
* @return OK
*/

@@ -139,3 +139,3 @@ getMinimapsMetadataByModelId(id: number, signal?: AbortSignal | undefined): Promise<MinimapMetadata[]>;

* Get minimap image by model id and minimap view.
* @return Success
* @return OK
*/

@@ -147,4 +147,4 @@ getMinimapByModelIdAndView(modelId: number, view: string, signal?: AbortSignal | undefined): Promise<FileResponse>;

/**
* For now this is a dummy
* @return Success
* Returns some metadata for the revision of the model
* @return OK
*/

@@ -155,9 +155,15 @@ getRevealRevision3d(projectId: string, modelId: number, revisionId: number): Promise<RevealRevision3D>;

* @param format (optional)
* @return Success
* @return OK
*/
getRevealRevisionOutputs(projectId: string, modelId: number, revisionId: number, format?: string | undefined): Promise<RevealRevisionOutputs>;
/**
* @return Success
* @return OK
*/
getFilesByProjectIdAndModelId(projectId: string, modelId: number, fileName: string): Promise<Stream>;
getFilesByProjectIdAndModelId(projectId: string, modelId: number, fileName: string): Promise<FileResponse>;
/**
* Dummy implementation. Always returns an empty list.
* @param body (optional)
* @return OK
*/
listRevealAnnotations(projectId: string, body?: AnnotationsFilterDto | undefined): Promise<void>;
}

@@ -172,4 +178,4 @@ export declare class RevealProxyClient implements IRevealProxyClient {

/**
* For now this is a dummy
* @return Success
* Returns some metadata for the revision of the model
* @return OK
*/

@@ -181,3 +187,3 @@ getRevealRevision3d(projectId: string, modelId: number, revisionId: number, signal?: AbortSignal | undefined): Promise<RevealRevision3D>;

* @param format (optional)
* @return Success
* @return OK
*/

@@ -187,10 +193,100 @@ getRevealRevisionOutputs(projectId: string, modelId: number, revisionId: number, format?: string | undefined, signal?: AbortSignal | undefined): Promise<RevealRevisionOutputs>;

/**
* @return Success
* @return OK
*/
getFilesByProjectIdAndModelId(projectId: string, modelId: number, fileName: string, signal?: AbortSignal | undefined): Promise<Stream>;
protected processGetFilesByProjectIdAndModelId(response: Response): Promise<Stream>;
getFilesByProjectIdAndModelId(projectId: string, modelId: number, fileName: string, signal?: AbortSignal | undefined): Promise<FileResponse>;
protected processGetFilesByProjectIdAndModelId(response: Response): Promise<FileResponse>;
/**
* Dummy implementation. Always returns an empty list.
* @param body (optional)
* @return OK
*/
listRevealAnnotations(projectId: string, body?: AnnotationsFilterDto | undefined, signal?: AbortSignal | undefined): Promise<void>;
protected processListRevealAnnotations(response: Response): Promise<void>;
}
export interface IScaffoldsClient {
/**
* List all scaffolds available to the user, most recent versions only
* @param instCode (optional)
* @param plantCode (optional)
* @param workOrderId (optional)
* @return OK
*/
listScaffolds(instCode?: string | undefined, plantCode?: string | undefined, workOrderId?: string | undefined): Promise<ScaffoldingMetadataDto[]>;
}
export declare class ScaffoldsClient implements IScaffoldsClient {
private http;
private baseUrl;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined;
constructor(baseUrl?: string, http?: {
fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
});
/**
* List all scaffolds available to the user, most recent versions only
* @param instCode (optional)
* @param plantCode (optional)
* @param workOrderId (optional)
* @return OK
*/
listScaffolds(instCode?: string | undefined, plantCode?: string | undefined, workOrderId?: string | undefined, signal?: AbortSignal | undefined): Promise<ScaffoldingMetadataDto[]>;
protected processListScaffolds(response: Response): Promise<ScaffoldingMetadataDto[]>;
}
export interface IUserAccessClient {
/**
* Used to check if the user has access to a specific model.
* @param plantCode PlantCode to check access for (ignores case)
* @return OK
*/
getAccessPlantCode(plantCode: string): Promise<PlantCodeAccessResultDto>;
/**
* Returns all the PlantCodes the user has access to in lower case. Note PlantCode != InstCode.
* @return OK
*/
listAccessPlantCodes(): Promise<PlantCodeAccessResultDto[]>;
}
export declare class UserAccessClient implements IUserAccessClient {
private http;
private baseUrl;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined;
constructor(baseUrl?: string, http?: {
fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
});
/**
* Used to check if the user has access to a specific model.
* @param plantCode PlantCode to check access for (ignores case)
* @return OK
*/
getAccessPlantCode(plantCode: string, signal?: AbortSignal | undefined): Promise<PlantCodeAccessResultDto>;
protected processGetAccessPlantCode(response: Response): Promise<PlantCodeAccessResultDto>;
/**
* Returns all the PlantCodes the user has access to in lower case. Note PlantCode != InstCode.
* @return OK
*/
listAccessPlantCodes(signal?: AbortSignal | undefined): Promise<PlantCodeAccessResultDto[]>;
protected processListAccessPlantCodes(response: Response): Promise<PlantCodeAccessResultDto[]>;
}
export declare class AnnotatedResourceIdsDto implements IAnnotatedResourceIdsDto {
id?: number;
constructor(data?: IAnnotatedResourceIdsDto);
init(_data?: any): void;
static fromJS(data: any): AnnotatedResourceIdsDto;
toJSON(data?: any): any;
}
export interface IAnnotatedResourceIdsDto {
id?: number;
}
export declare class AnnotationsFilterDto implements IAnnotationsFilterDto {
filter?: FilterDto;
limit?: number;
constructor(data?: IAnnotationsFilterDto);
init(_data?: any): void;
static fromJS(data: any): AnnotationsFilterDto;
toJSON(data?: any): any;
}
export interface IAnnotationsFilterDto {
filter?: FilterDto;
limit?: number;
}
export declare class AssetDownloadDto implements IAssetDownloadDto {
assetMetaData?: AssetMetadataDto;
assetDownloadInfo?: AssetDownloadToken;
assetMetaData: AssetMetadataDto;
assetDownloadInfo: AssetDownloadToken;
files?: string[] | undefined;

@@ -203,4 +299,4 @@ constructor(data?: IAssetDownloadDto);

export interface IAssetDownloadDto {
assetMetaData?: AssetMetadataDto;
assetDownloadInfo?: AssetDownloadToken;
assetMetaData: AssetMetadataDto;
assetDownloadInfo: AssetDownloadToken;
files?: string[] | undefined;

@@ -238,5 +334,12 @@ }

sourceModelUpdatedDateTimeIso8601: Date;
metadata?: {
/** The metadata can be any key-value pair. The value is always a string, but can be a serialized JSON object. */
metadata: {
[key: string]: string;
} | undefined;
};
/** The numerical Model Id
ModelId increments for every revision. Old modelIds will automatically be deleted. */
id: number;
/** The HierarchyId is the identifier for the hierarchy file in the HierarchyService. Not all ArtifactKinds have a hierarchy file. */
hierarchyId?: string | undefined;
constructor(data?: IAssetMetadataDto);

@@ -261,14 +364,29 @@ init(_data?: any): void;

sourceModelUpdatedDateTimeIso8601: Date;
metadata?: {
/** The metadata can be any key-value pair. The value is always a string, but can be a serialized JSON object. */
metadata: {
[key: string]: string;
} | undefined;
};
/** The numerical Model Id
ModelId increments for every revision. Old modelIds will automatically be deleted. */
id: number;
/** The HierarchyId is the identifier for the hierarchy file in the HierarchyService. Not all ArtifactKinds have a hierarchy file. */
hierarchyId?: string | undefined;
}
export declare class AssetMetadataSimpleDto implements IAssetMetadataSimpleDto {
/** The ModelId increments for all builds, it should not be used in states as old models are auto-deleted. */
id: number;
/** The PlantCode is the Platform identifier used by the CAD team at https://cad.equinor.com */
plantCode: string;
/** The revision number of the same model configuration */
revisionNumber: number;
/** The Artifact Kind of this Model. For example Reveal or EchoLens, the client must know which ArtifactKind it can accept. */
artifactKind: string;
/** If there are breaking changes in the ArtifactKind it's represented with the ArtifactVersion */
artifactVersion: string;
/** The Blob container with this models data */
blobContainer?: string | undefined;
/** The path within the container */
filesPrefix?: string | undefined;
/** The STID Installation Code for an asset. (find it in the URL in STID for a given asset) */
installationCode?: string | undefined;

@@ -280,7 +398,15 @@ /** Describes when the Optimizer run was started. */

sourceModelUpdatedDateTime: Date;
/** The Project Name Label
For example: Johan Sverdrup */
projectNameLabel: string;
/** The Platform Name Label
For example: Riser Platform or Åsgard A */
platformNameLabel: string;
/** The Project section Id. This can be used to represent different 3D model types. For most assets this is Topside for the normal 3D models. Can be used in the client for differentiating models. */
projectSectionId: string;
/** The PlatformSectionId differentiates different Model definitions on a platform. This is not a Label */
platformSectionId: string;
/** This is the display text of the Platform Section */
platformSectionLabel: string;
/** HierarchyId is optional for some ArtifactKinds. It can be used with the Hierarchy Service. */
hierarchyId: string;

@@ -293,9 +419,17 @@ constructor(data?: IAssetMetadataSimpleDto);

export interface IAssetMetadataSimpleDto {
/** The ModelId increments for all builds, it should not be used in states as old models are auto-deleted. */
id: number;
/** The PlantCode is the Platform identifier used by the CAD team at https://cad.equinor.com */
plantCode: string;
/** The revision number of the same model configuration */
revisionNumber: number;
/** The Artifact Kind of this Model. For example Reveal or EchoLens, the client must know which ArtifactKind it can accept. */
artifactKind: string;
/** If there are breaking changes in the ArtifactKind it's represented with the ArtifactVersion */
artifactVersion: string;
/** The Blob container with this models data */
blobContainer?: string | undefined;
/** The path within the container */
filesPrefix?: string | undefined;
/** The STID Installation Code for an asset. (find it in the URL in STID for a given asset) */
installationCode?: string | undefined;

@@ -307,7 +441,15 @@ /** Describes when the Optimizer run was started. */

sourceModelUpdatedDateTime: Date;
/** The Project Name Label
For example: Johan Sverdrup */
projectNameLabel: string;
/** The Platform Name Label
For example: Riser Platform or Åsgard A */
platformNameLabel: string;
/** The Project section Id. This can be used to represent different 3D model types. For most assets this is Topside for the normal 3D models. Can be used in the client for differentiating models. */
projectSectionId: string;
/** The PlatformSectionId differentiates different Model definitions on a platform. This is not a Label */
platformSectionId: string;
/** This is the display text of the Platform Section */
platformSectionLabel: string;
/** HierarchyId is optional for some ArtifactKinds. It can be used with the Hierarchy Service. */
hierarchyId: string;

@@ -333,2 +475,60 @@ }

}
export declare class CreateAssetMetadataDto implements ICreateAssetMetadataDto {
artifactKind: string;
artifactFileFormatVersion: string;
plantCode: string;
installationCode?: string | undefined;
platformSapId?: string | undefined;
projectNameLabel: string;
platformNameLabel: string;
projectSectionId: string;
platformSectionId: string;
platformSectionLabel: string;
revisionNumber: number;
buildRunDateTimeIso8601: Date;
sourceModelUpdatedDateTimeIso8601: Date;
/** The metadata can be any key-value pair. The value is always a string, but can be a serialized JSON object. */
metadata: {
[key: string]: string;
};
constructor(data?: ICreateAssetMetadataDto);
init(_data?: any): void;
static fromJS(data: any): CreateAssetMetadataDto;
toJSON(data?: any): any;
}
export interface ICreateAssetMetadataDto {
artifactKind: string;
artifactFileFormatVersion: string;
plantCode: string;
installationCode?: string | undefined;
platformSapId?: string | undefined;
projectNameLabel: string;
platformNameLabel: string;
projectSectionId: string;
platformSectionId: string;
platformSectionLabel: string;
revisionNumber: number;
buildRunDateTimeIso8601: Date;
sourceModelUpdatedDateTimeIso8601: Date;
/** The metadata can be any key-value pair. The value is always a string, but can be a serialized JSON object. */
metadata: {
[key: string]: string;
};
}
/** FilterDto is used to filter the annotations */
export declare class FilterDto implements IFilterDto {
/** Probably an enum, but not implemented */
annotatedResourceType?: string | undefined;
annotatedResourceIds?: AnnotatedResourceIdsDto[] | undefined;
constructor(data?: IFilterDto);
init(_data?: any): void;
static fromJS(data: any): FilterDto;
toJSON(data?: any): any;
}
/** FilterDto is used to filter the annotations */
export interface IFilterDto {
/** Probably an enum, but not implemented */
annotatedResourceType?: string | undefined;
annotatedResourceIds?: AnnotatedResourceIdsDto[] | undefined;
}
export declare class MinimapMetadata implements IMinimapMetadata {

@@ -363,2 +563,20 @@ view: string;

export type ModelStates = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
/** Represents the current users Access to a PlantCode */
export declare class PlantCodeAccessResultDto implements IPlantCodeAccessResultDto {
/** True when the user has access to the PlantCode, false if the user does not have access OR the role does not exist */
hasAccess?: boolean;
/** PlantCode describing access to a specific 3D model */
plantCode?: string | undefined;
constructor(data?: IPlantCodeAccessResultDto);
init(_data?: any): void;
static fromJS(data: any): PlantCodeAccessResultDto;
toJSON(data?: any): any;
}
/** Represents the current users Access to a PlantCode */
export interface IPlantCodeAccessResultDto {
/** True when the user has access to the PlantCode, false if the user does not have access OR the role does not exist */
hasAccess?: boolean;
/** PlantCode describing access to a specific 3D model */
plantCode?: string | undefined;
}
export declare class ProblemDetails implements IProblemDetails {

@@ -451,25 +669,63 @@ type?: string | undefined;

}
export declare class Stream implements IStream {
readonly canRead?: boolean;
readonly canWrite?: boolean;
readonly canSeek?: boolean;
readonly canTimeout?: boolean;
readonly length?: number;
position?: number;
readTimeout?: number;
writeTimeout?: number;
constructor(data?: IStream);
export declare class ScaffoldingMetadataDto implements IScaffoldingMetadataDto {
/** Echo internal model Id, used to get more info on the model */
modelId: number;
/** Plant Code is the LCI 3D Model Plant Identifier */
plantCode: string | undefined;
/** Echo internal PlatformSectionId for the scaffolding model, this can be used to load the specific scaffold in Echo 3D web. */
platformSectionId: string | undefined;
/** The ID For the scaffolding as it comes from scaffplanner */
scaffoldingId: string | undefined;
/** The human readable display name for the Scaffolding */
scaffoldingDisplayName: string | undefined;
/** The WorkOrder ID. NOT Zero-padded. */
sapWorkOrderId: string | undefined;
/** The Build OperationId within the WorkOrder
This can be used to see if the scaffolding has been built. */
sapWorkOrderBuildOperationId: string | undefined;
/** The Dismantle OperationId within the WorkOrder
This can be used to see if the scaffolding has been dismantled. */
sapWorkOrderDismantleOperationId: string | undefined;
/** The Type of scaffolding */
scaffoldingType: string | undefined;
/** The Tag this scaffolding is related to, if any. */
tagNo: string | undefined;
/** The total weight as a display text. Includes unit (kg) */
totalWeight: string | undefined;
/** The STID Installation Code */
installationCode: string | undefined;
constructor(data?: IScaffoldingMetadataDto);
init(_data?: any): void;
static fromJS(data: any): Stream;
static fromJS(data: any): ScaffoldingMetadataDto;
toJSON(data?: any): any;
}
export interface IStream {
canRead?: boolean;
canWrite?: boolean;
canSeek?: boolean;
canTimeout?: boolean;
length?: number;
position?: number;
readTimeout?: number;
writeTimeout?: number;
export interface IScaffoldingMetadataDto {
/** Echo internal model Id, used to get more info on the model */
modelId: number;
/** Plant Code is the LCI 3D Model Plant Identifier */
plantCode: string | undefined;
/** Echo internal PlatformSectionId for the scaffolding model, this can be used to load the specific scaffold in Echo 3D web. */
platformSectionId: string | undefined;
/** The ID For the scaffolding as it comes from scaffplanner */
scaffoldingId: string | undefined;
/** The human readable display name for the Scaffolding */
scaffoldingDisplayName: string | undefined;
/** The WorkOrder ID. NOT Zero-padded. */
sapWorkOrderId: string | undefined;
/** The Build OperationId within the WorkOrder
This can be used to see if the scaffolding has been built. */
sapWorkOrderBuildOperationId: string | undefined;
/** The Dismantle OperationId within the WorkOrder
This can be used to see if the scaffolding has been dismantled. */
sapWorkOrderDismantleOperationId: string | undefined;
/** The Type of scaffolding */
scaffoldingType: string | undefined;
/** The Tag this scaffolding is related to, if any. */
tagNo: string | undefined;
/** The total weight as a display text. Includes unit (kg) */
totalWeight: string | undefined;
/** The STID Installation Code */
installationCode: string | undefined;
}

@@ -476,0 +732,0 @@ export interface FileResponse {

@@ -60,2 +60,17 @@ import { CadModelBudget } from '@cognite/reveal';

/**
* Always add the largest sector to render if no sectors are rendered for a model
* This helps to ensure we always have some area loaded for all models.
* This can help with smaller models that can easily be missed due to frustum-culling delays.
* @param model the current model
* @param candidateSectors The current candidate sectors
*/
export declare function addLargestSectorIfNone(model: CadModelMetadata, candidateSectors: {
model: CadModelMetadata;
sectorId: number;
estDrawCalls: number;
estRenderCost: number;
priority: number;
depth: number;
}[]): void;
/**
* Determines candidate sectors per model, i.e. sectors within frustum.

@@ -62,0 +77,0 @@ * @param cadModelsMetadata The CadModels to determine from

@@ -41,2 +41,8 @@ import * as THREE from 'three';

const percentOfScreenFilledByLargestNode = weightFunctions.computeMaximumNodeScreenSize(distance, sector.maxDiagonalLength);
// Discard all non-default sectors by default.
// This will stop new non-default sectors on the backend from being used in the frontend before it has been updated to handle them.
const normalSector = sector.sectorFileName && sector.sectorFileName?.startsWith('sector');
if (!normalSector) {
return 0;
}
if (percentOfScreenFilledByLargestNode < 0.02) {

@@ -130,2 +136,3 @@ // If the largest node would fill less than x percent of the screen at the distance we assume we can discard the sector.

}
/* istanbul ignore next */
/**

@@ -164,3 +171,44 @@ * Determines candidate sectors

}
/* istanbul ignore next */
/**
* Always add the largest sector to render if no sectors are rendered for a model
* This helps to ensure we always have some area loaded for all models.
* This can help with smaller models that can easily be missed due to frustum-culling delays.
* @param model the current model
* @param candidateSectors The current candidate sectors
*/
export function addLargestSectorIfNone(model, candidateSectors) {
if (candidateSectors.some((x) => x.model.modelIdentifier === model.modelIdentifier && x.priority >= SectorZonePriority.zonePriorityTop)) {
// We already have a high-priority sector for this model, so we don't need to force in the largest sector.
return;
}
// We use allSectors as the input to the sortSectorsByPriority function is already frustum-culled
const allSectors = model.scene.getAllSectors().filter((sector) => sector.sectorFileName !== null);
const vec3Holder = new THREE.Vector3();
const largestSector = allSectors.reduce((largest, sector) => {
if (sector.subtreeBoundingBox.getSize(vec3Holder).lengthSq() >
largest.subtreeBoundingBox.getSize(vec3Holder).lengthSq()) {
return sector;
}
return largest;
});
if (largestSector) {
const alreadyPrioritized = candidateSectors.find((x) => x.model.modelIdentifier === model.modelIdentifier && x.sectorId === largestSector.id);
if (alreadyPrioritized) {
// Bump priority if we already have the sector in the list
alreadyPrioritized.priority = Math.max(alreadyPrioritized.priority, SectorZonePriority.zonePriorityTop);
}
else {
candidateSectors.push({
model,
sectorId: largestSector.id,
estDrawCalls: largestSector.estimatedDrawCallCount,
estRenderCost: largestSector.estimatedRenderCost,
priority: SectorZonePriority.zonePriorityTop,
depth: largestSector.depth
});
}
}
}
/**
* Determines candidate sectors per model, i.e. sectors within frustum.

@@ -212,2 +260,4 @@ * @param cadModelsMetadata The CadModels to determine from

});
// Always include the largest sector in the model with a download size by its subtree bounding box even if its culled.
addLargestSectorIfNone(model, candidateSectors);
});

@@ -214,0 +264,0 @@ // Sort candidate sectors descending by priority

@@ -0,1 +1,2 @@

import * as THREE from 'three';
/**

@@ -2,0 +3,0 @@ * Fake implementation of the Reveal Spinner.ts class which has performance issues and cannot be disabled.

@@ -74,3 +74,3 @@ /* eslint-disable -- Vendor file from Cognite. Mainly new return functionality */

const gl = renderer.getContext();
const utils = new THREE.WebGLUtils(gl, renderer.extensions, renderer.capabilities);
const utils = new THREE.WebGLUtils(gl, renderer.extensions);
const texture = renderTarget.texture;

@@ -77,0 +77,0 @@ const format = utils.convert(texture.format);

@@ -20,5 +20,6 @@ import { Image360Provider } from '@cognite/reveal/dist/packages/data-providers';

* @param image360Provider the image 360 provider
* @param isGlobalSelectionEnabled flag describing if global selection is on
* @returns Everything needed to load a model in the provided canvas initialized
*/
export declare const setupEcho3dWeb: (canvas: HTMLCanvasElement, modelDistributionConfig: ApiServiceConfiguration, hierarchyConfig: ApiServiceConfiguration, renderConfig?: RendererConfiguration, graphicsConfig?: RevealGraphicsConfig, image360Provider?: Image360Provider<PanoramaMetadata>) => Promise<EchoSetupObject>;
export declare const setupEcho3dWeb: (canvas: HTMLCanvasElement, modelDistributionConfig: ApiServiceConfiguration, hierarchyConfig: ApiServiceConfiguration, renderConfig?: RendererConfiguration, graphicsConfig?: RevealGraphicsConfig, image360Provider?: Image360Provider<PanoramaMetadata>, isGlobalSelectionEnabled?: boolean) => Promise<EchoSetupObject>;
//# sourceMappingURL=echo3dwebSetup.d.ts.map

@@ -18,9 +18,10 @@ import { initializeHierarchyClient } from '../services/hierarchyClient';

* @param image360Provider the image 360 provider
* @param isGlobalSelectionEnabled flag describing if global selection is on
* @returns Everything needed to load a model in the provided canvas initialized
*/
export const setupEcho3dWeb = async (canvas, modelDistributionConfig, hierarchyConfig, renderConfig, graphicsConfig, image360Provider) => {
export const setupEcho3dWeb = async (canvas, modelDistributionConfig, hierarchyConfig, renderConfig, graphicsConfig, image360Provider, isGlobalSelectionEnabled) => {
const modelApiClient = initializeModelClient(modelDistributionConfig.baseUrl, modelDistributionConfig.getAccessToken);
const hierarchyApiClient = initializeHierarchyClient(hierarchyConfig.baseUrl, hierarchyConfig.getAccessToken);
const client = await initializeEcho3dClient(modelDistributionConfig.baseUrl, modelDistributionConfig.getAccessToken);
const echo3dViewer = initializeEcho3dViewer(client, canvas, renderConfig, image360Provider, graphicsConfig);
const echo3dViewer = initializeEcho3dViewer(client, canvas, renderConfig, image360Provider, graphicsConfig, isGlobalSelectionEnabled);
return {

@@ -27,0 +28,0 @@ client,

@@ -18,5 +18,6 @@ import { Image360Provider } from '@cognite/reveal/dist/packages/data-providers';

* @param graphicsConfig The Graphics config. If not supplied will use defaults.
* @param isGlobalSelectionEnabled flag describing if global selection is on
* @returns The Echo3dViewer to render models on
*/
export declare const initializeEcho3dViewer: (client: CogniteClient, canvas: HTMLCanvasElement, renderConfig?: RendererConfiguration, image360Provider?: Image360Provider<PanoramaMetadata>, graphicsConfig?: RevealGraphicsConfig) => Echo3dViewer;
export declare const initializeEcho3dViewer: (client: CogniteClient, canvas: HTMLCanvasElement, renderConfig?: RendererConfiguration, image360Provider?: Image360Provider<PanoramaMetadata>, graphicsConfig?: RevealGraphicsConfig, isGlobalSelectionEnabled?: boolean) => Echo3dViewer;
//# sourceMappingURL=initializeEcho3dViewer.d.ts.map

@@ -37,2 +37,3 @@ import * as THREE from 'three';

* @param graphicsConfig The Graphics config. If not supplied will use defaults.
* @param isGlobalSelectionEnabled flag describing if global selection is on
* @returns The Echo3dViewer to render models on

@@ -47,3 +48,3 @@ */

movingCameraResolutionFactor: undefined
}) => {
}, isGlobalSelectionEnabled) => {
const renderer = initializeRenderer(canvas, renderConfig);

@@ -63,3 +64,3 @@ if (!renderer.domElement.parentElement)

continuousModelStreaming: graphicsConfig.continuousModelStreaming
});
}, isGlobalSelectionEnabled ?? false);
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any -- Need to override reveals image provider somehow and this is currently the only way

@@ -66,0 +67,0 @@ viewer._image360ApiHelper._image360Facade._entityFactory._image360DataProvider = image360Provider;

@@ -138,3 +138,10 @@ import * as THREE from 'three';

}
}
},
side: THREE.DoubleSide
},
triangleMesh: {
side: THREE.DoubleSide
},
instancedMesh: {
side: THREE.DoubleSide
}

@@ -158,2 +165,3 @@ };

this.removeObject3D = jest.fn();
this.getGlobalClippingPlanes = jest.fn().mockReturnValue(new THREE.Plane());
this._renderer = options.renderer;

@@ -160,0 +168,0 @@ this._domElement = options.domElement;

import * as THREE from 'three';
import { CameraControlsExtended } from '../controls/CameraControlsExtended';
import { FirstPersonCameraControls } from '../controls/FirstPersonCameraControls';
import { UpDownMode } from '../types/cameraUpDownMode';
/**

@@ -30,3 +31,3 @@ * Calculate the DomPosition for a given camera and a 3d position

*/
export declare const isCameraUpDownValue: (value: string | undefined | null) => value is "WorldSpace" | "CameraSpace";
export declare const isCameraUpDownValue: (value: string | undefined | null) => value is UpDownMode;
//# sourceMappingURL=cameraUtils.d.ts.map
import { CancelToken } from '@esfx/canceltoken';
/**
* Utils method that coverts a cancel token from '@esfx/canceltoken'
* into an abort signal from node
* Convert a cancel token from '@esfx/canceltoken'
* into an abort signal. Useful for libraries that use AbortController for cancellation.
* @param token to be converted
* @returns the converted abort signal
* @returns the new abort signal
*/
export declare function convertCancelTokenToAbort(token: CancelToken): AbortSignal;
/**
* Convert an abort signal into a cancel token from '@esfx/canceltoken'
* @param signal to be converted
* @returns the new cancel token
*/
export declare function convertAbortSignalToCancelToken(signal: AbortSignal): CancelToken;
//# sourceMappingURL=cancelTokenUtils.d.ts.map

@@ -0,6 +1,7 @@

import { CancelToken } from '@esfx/canceltoken';
/**
* Utils method that coverts a cancel token from '@esfx/canceltoken'
* into an abort signal from node
* Convert a cancel token from '@esfx/canceltoken'
* into an abort signal. Useful for libraries that use AbortController for cancellation.
* @param token to be converted
* @returns the converted abort signal
* @returns the new abort signal
*/

@@ -12,2 +13,11 @@ export function convertCancelTokenToAbort(token) {

}
/**
* Convert an abort signal into a cancel token from '@esfx/canceltoken'
* @param signal to be converted
* @returns the new cancel token
*/
export function convertAbortSignalToCancelToken(signal) {
const source = CancelToken.source([signal]); // Will be canceled when signal is aborted
return source.token;
}
//# sourceMappingURL=cancelTokenUtils.js.map
import { NumericRange } from '@cognite/reveal';
import * as THREE from 'three';
import { AabbModel, HierarchyNodeModel, IdRangeModel, Vector3Model } from '../services/generated/EchoHierarchyApiClient';
import { SimpleHierarchyNode } from '../types/SimpleHierarchyNode';
/**

@@ -45,6 +46,6 @@ * Method for converting vectors, from Vector3Model to THREE vector3

* Convert the Id + EndId of a HierarchyNode to a Reveal NumericRange
* @param hierarchyNode HierarchyNode
* @param hierarchyNode HierarchyNode | SimpleHierarchyNode
* @returns NumericRange matching the input IdRange.
*/
export declare function getNumericRange(hierarchyNode: HierarchyNodeModel): NumericRange;
export declare function getNumericRange(hierarchyNode: HierarchyNodeModel | SimpleHierarchyNode): NumericRange;
/**

@@ -51,0 +52,0 @@ * Converts an Id range to a numeric range

@@ -91,3 +91,3 @@ import { NumericRange } from '@cognite/reveal';

* Convert the Id + EndId of a HierarchyNode to a Reveal NumericRange
* @param hierarchyNode HierarchyNode
* @param hierarchyNode HierarchyNode | SimpleHierarchyNode
* @returns NumericRange matching the input IdRange.

@@ -94,0 +94,0 @@ */

{
"name": "@equinor/echo-3d-viewer",
"version": "0.0.3",
"version": "0.0.4",
"description": "The Echo 3D Viewer component for internal use in Equinor",

@@ -32,4 +32,4 @@ "main": "dist/src/index.js",

"@types/geojson": "^7946.0.12",
"@types/jest": "^29.5.11",
"@types/three": "~0.158.3",
"@types/jest": "^29.5.13",
"@types/three": "^0.166.0",
"eslint-plugin-jsdoc": "^46.9.0",

@@ -39,19 +39,19 @@ "jest": "^29.6.1",

"nswag": "^13.20.0",
"ts-jest": "^29.1.1",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.1",
"typescript": "^5.3.3"
"typescript": "^5.6.3"
},
"peerDependencies": {
"@cognite/reveal": "4.11.0",
"@cognite/reveal": "4.21.3",
"@cognite/sdk": "8.3.0",
"lodash": "^4.17.21",
"three": "0.158.0"
"three": "0.166.1"
},
"dependencies": {
"@esfx/canceltoken": "^1.0.0",
"@tweenjs/tween.js": "^21.0.0",
"camera-controls": "^2.7.2",
"@tweenjs/tween.js": "^21.1.1",
"camera-controls": "^2.9.0",
"hold-event": "^1.1.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet