@cognite/reveal 3.1.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/eptBinaryDecoder.worker.map +1 -1
- package/extensions/datasource.d.ts +9 -9
- package/extensions/datasource.js +2 -26
- package/{core/src/public/migration/RenderController.d.ts → extensions/datasource.js.LICENSE.txt} +3 -4
- package/extensions/datasource.map +1 -1
- package/index.d.ts +13 -13
- package/index.js +2 -576
- package/index.js.LICENSE.txt +11 -0
- package/index.map +1 -1
- package/package.json +9 -6
- package/packages/api/index.d.ts +11 -0
- package/{core → packages/api}/src/public/RevealManager.d.ts +52 -52
- package/{core → packages/api}/src/public/createRevealManager.d.ts +24 -24
- package/{core → packages/api}/src/public/migration/Cognite3DViewer.d.ts +509 -498
- package/{core → packages/api}/src/public/migration/renderOptionsHelpers.d.ts +36 -29
- package/{core → packages/api}/src/public/migration/types.d.ts +184 -171
- package/{core → packages/api}/src/public/types.d.ts +31 -30
- package/{core → packages/api}/src/storage/RevealManagerHelper.d.ts +61 -60
- package/{core → packages/api}/src/utilities/Spinner.d.ts +27 -27
- package/{core → packages/api}/src/utilities/ViewStateHelper.d.ts +49 -49
- package/{core → packages/api}/src/utilities/reflection.d.ts +7 -7
- package/packages/cad-geometry-loaders/index.d.ts +10 -10
- package/packages/cad-geometry-loaders/src/CadLoadingHints.d.ts +11 -11
- package/packages/cad-geometry-loaders/src/CadManager.d.ts +46 -46
- package/packages/cad-geometry-loaders/src/CadModelBudget.d.ts +21 -21
- package/packages/cad-geometry-loaders/src/CadModelUpdateHandler.d.ts +44 -44
- package/packages/cad-geometry-loaders/src/InternalRevealCadOptions.d.ts +13 -13
- package/packages/cad-geometry-loaders/src/createCadManager.d.ts +10 -10
- package/packages/cad-geometry-loaders/src/sector/ModelStateHandler.d.ts +12 -12
- package/packages/cad-geometry-loaders/src/sector/SectorDownloadScheduler.d.ts +22 -22
- package/packages/cad-geometry-loaders/src/sector/SectorLoader.d.ts +32 -32
- package/packages/cad-geometry-loaders/src/sector/culling/ByScreenSizeSectorCuller.d.ts +23 -23
- package/packages/cad-geometry-loaders/src/sector/culling/ByVisibilityGpuSectorCuller.d.ts +51 -51
- package/packages/cad-geometry-loaders/src/sector/culling/OrderSectorsByVisibilityCoverage.d.ts +106 -106
- package/packages/cad-geometry-loaders/src/sector/culling/RenderAlreadyLoadedGeometryProvider.d.ts +11 -11
- package/packages/cad-geometry-loaders/src/sector/culling/SectorCuller.d.ts +33 -33
- package/packages/cad-geometry-loaders/src/sector/culling/WeightFunctionsHelper.d.ts +51 -50
- package/packages/cad-geometry-loaders/src/sector/culling/computeNdcAreaOfBox.d.ts +12 -12
- package/packages/cad-geometry-loaders/src/sector/culling/computeSectorCost.d.ts +7 -7
- package/packages/cad-geometry-loaders/src/sector/culling/createV8SectorCuller.d.ts +7 -7
- package/packages/cad-geometry-loaders/src/sector/culling/takensectors/TakenSectorMapBase.d.ts +11 -11
- package/packages/cad-geometry-loaders/src/sector/culling/takensectors/TakenV8SectorMap.d.ts +17 -17
- package/packages/cad-geometry-loaders/src/sector/culling/takensectors/TakenV8SectorTree.d.ts +24 -24
- package/packages/cad-geometry-loaders/src/sector/culling/takensectors/TakenV9SectorMap.d.ts +20 -20
- package/packages/cad-geometry-loaders/src/sector/culling/takensectors/index.d.ts +5 -5
- package/packages/cad-geometry-loaders/src/sector/culling/transformBoxToNDC.d.ts +5 -5
- package/packages/cad-geometry-loaders/src/sector/culling/types.d.ts +83 -83
- package/packages/cad-geometry-loaders/src/sector/rxSectorUtilities.d.ts +12 -12
- package/packages/cad-geometry-loaders/src/utilities/PromiseUtils.d.ts +28 -28
- package/packages/cad-model/index.d.ts +9 -9
- package/packages/cad-model/src/CadModelFactory.d.ts +17 -17
- package/packages/cad-model/src/batching/GeometryBatchingManager.d.ts +31 -31
- package/packages/cad-model/src/batching/InstancedMeshManager.d.ts +20 -20
- package/packages/cad-model/src/picking/PickingHandler.d.ts +36 -35
- package/packages/cad-model/src/picking/readPixelsFromTargetAsync.d.ts +17 -0
- package/packages/cad-model/src/types.d.ts +59 -59
- package/packages/cad-model/src/utilities/BoundingBoxClipper.d.ts +23 -23
- package/packages/cad-model/src/utilities/NodeIdAndTreeIndexMaps.d.ts +4 -4
- package/packages/cad-model/src/utilities/callActionWithIndicesAsync.d.ts +4 -4
- package/packages/cad-model/src/wrappers/CadNode.d.ts +54 -54
- package/packages/cad-model/src/wrappers/Cognite3DModel.d.ts +337 -337
- package/packages/cad-parsers/index.d.ts +20 -20
- package/packages/cad-parsers/src/cad/CadSectorParser.d.ts +15 -15
- package/packages/cad-parsers/src/cad/LevelOfDetail.d.ts +8 -8
- package/packages/cad-parsers/src/cad/filterInstanceMesh.d.ts +6 -6
- package/packages/cad-parsers/src/cad/filterPrimitivesCommon.d.ts +5 -5
- package/packages/cad-parsers/src/cad/filterPrimitivesV8.d.ts +9 -9
- package/packages/cad-parsers/src/cad/filterPrimitivesV9.d.ts +6 -6
- package/packages/cad-parsers/src/cad/primitiveGeometries.d.ts +30 -30
- package/packages/cad-parsers/src/cad/triangleMeshes.d.ts +6 -6
- package/packages/cad-parsers/src/cad/types.d.ts +56 -56
- package/packages/cad-parsers/src/metadata/CadMetadataParser.d.ts +7 -7
- package/packages/cad-parsers/src/metadata/CadModelClipper.d.ts +10 -10
- package/packages/cad-parsers/src/metadata/CadModelMetadata.d.ts +54 -54
- package/packages/cad-parsers/src/metadata/CadModelMetadataRepository.d.ts +16 -16
- package/packages/cad-parsers/src/metadata/parsers/CadMetadataParserGltf.d.ts +8 -8
- package/packages/cad-parsers/src/metadata/parsers/CadMetadataParserV8.d.ts +6 -6
- package/packages/cad-parsers/src/metadata/parsers/types.d.ts +62 -62
- package/packages/cad-parsers/src/metadata/types.d.ts +53 -53
- package/packages/cad-parsers/src/sector/RootSectorNode.d.ts +13 -13
- package/packages/cad-parsers/src/sector/SectorNode.d.ts +22 -22
- package/packages/cad-parsers/src/utilities/SectorScene.d.ts +23 -23
- package/packages/cad-parsers/src/utilities/SectorSceneFactory.d.ts +9 -9
- package/packages/cad-parsers/src/utilities/computeBoundingBoxFromAttributes.d.ts +10 -10
- package/packages/cad-parsers/src/utilities/float32BufferToMatrix.d.ts +12 -12
- package/packages/cad-parsers/src/utilities/types.d.ts +71 -71
- package/packages/cad-styling/index.d.ts +20 -20
- package/packages/cad-styling/src/AssetNodeCollection.d.ts +47 -47
- package/packages/cad-styling/src/CdfModelNodeCollectionDataProvider.d.ts +26 -26
- package/packages/cad-styling/src/CombineNodeCollectionBase.d.ts +34 -34
- package/packages/cad-styling/src/IntersectionNodeCollection.d.ts +20 -20
- package/packages/cad-styling/src/InvertedNodeCollection.d.ts +27 -27
- package/packages/cad-styling/src/NodeAppearance.d.ts +85 -85
- package/packages/cad-styling/src/NodeAppearanceProvider.d.ts +38 -38
- package/packages/cad-styling/src/NodeCollection.d.ts +31 -26
- package/packages/cad-styling/src/NodeCollectionDeserializer.d.ts +26 -26
- package/packages/cad-styling/src/PopulateIndexSetFromPagedResponseHelper.d.ts +30 -30
- package/packages/cad-styling/src/PropertyFilterNodeCollection.d.ts +57 -57
- package/packages/cad-styling/src/SerializedNodeCollection.d.ts +8 -8
- package/packages/cad-styling/src/SinglePropertyFilterNodeCollection.d.ts +53 -53
- package/packages/cad-styling/src/TreeIndexNodeCollection.d.ts +40 -40
- package/packages/cad-styling/src/UnionNodeCollection.d.ts +19 -19
- package/packages/cad-styling/src/prioritized/AreaCollection.d.ts +39 -39
- package/packages/cad-styling/src/prioritized/BoxClusterer.d.ts +29 -29
- package/packages/cad-styling/src/prioritized/ClusteredAreaCollection.d.ts +17 -17
- package/packages/cad-styling/src/prioritized/EmptyAreaCollection.d.ts +18 -18
- package/packages/cad-styling/src/prioritized/types.d.ts +7 -7
- package/packages/camera-manager/index.d.ts +8 -8
- package/packages/camera-manager/src/CameraManager.d.ts +78 -74
- package/packages/camera-manager/src/CameraManagerHelper.d.ts +42 -42
- package/packages/camera-manager/src/ComboControls.d.ts +110 -112
- package/packages/camera-manager/src/DefaultCameraManager.d.ts +150 -136
- package/packages/camera-manager/src/Keyboard.d.ts +19 -17
- package/packages/camera-manager/src/types.d.ts +66 -66
- package/packages/data-source/index.d.ts +6 -6
- package/packages/data-source/src/CdfDataSource.d.ts +19 -19
- package/packages/data-source/src/DataSource.d.ts +25 -25
- package/packages/data-source/src/LocalDataSource.d.ts +15 -15
- package/packages/logger/index.d.ts +5 -5
- package/packages/logger/src/Log.d.ts +5 -5
- package/packages/metrics/index.d.ts +4 -4
- package/packages/metrics/src/MetricsLogger.d.ts +34 -21
- package/packages/metrics/src/types.d.ts +7 -7
- package/packages/model-base/index.d.ts +7 -7
- package/packages/model-base/src/CogniteModelBase.d.ts +17 -17
- package/packages/model-base/src/MetadataRepository.d.ts +7 -7
- package/packages/model-base/src/SupportedModelTypes.d.ts +4 -4
- package/packages/model-base/src/types.d.ts +36 -36
- package/packages/modeldata-api/index.d.ts +12 -12
- package/packages/modeldata-api/src/CdfModelDataProvider.d.ts +16 -16
- package/packages/modeldata-api/src/CdfModelIdentifier.d.ts +15 -15
- package/packages/modeldata-api/src/CdfModelMetadataProvider.d.ts +20 -20
- package/packages/modeldata-api/src/LocalModelDataProvider.d.ts +8 -8
- package/packages/modeldata-api/src/LocalModelIdentifier.d.ts +14 -14
- package/packages/modeldata-api/src/LocalModelMetadataProvider.d.ts +16 -16
- package/packages/modeldata-api/src/ModelIdentifier.d.ts +12 -12
- package/packages/modeldata-api/src/ModelMetadataProvider.d.ts +18 -18
- package/packages/modeldata-api/src/applyDefaultModelTransformation.d.ts +6 -6
- package/packages/modeldata-api/src/types.d.ts +43 -43
- package/packages/modeldata-api/src/utilities.d.ts +7 -7
- package/packages/nodes-api/index.d.ts +6 -6
- package/packages/nodes-api/src/NodesApiClient.d.ts +50 -50
- package/packages/nodes-api/src/NodesCdfClient.d.ts +24 -24
- package/packages/nodes-api/src/NodesLocalClient.d.ts +30 -30
- package/packages/nodes-api/src/types.d.ts +10 -10
- package/packages/pointclouds/index.d.ts +15 -15
- package/packages/pointclouds/src/CognitePointCloudModel.d.ts +131 -131
- package/packages/pointclouds/src/PointCloudBudget.d.ts +14 -14
- package/packages/pointclouds/src/PointCloudFactory.d.ts +13 -13
- package/packages/pointclouds/src/PointCloudIntersection.d.ts +26 -26
- package/packages/pointclouds/src/PointCloudManager.d.ts +37 -37
- package/packages/pointclouds/src/PointCloudMetadata.d.ts +15 -14
- package/packages/pointclouds/src/PointCloudMetadataRepository.d.ts +14 -14
- package/packages/pointclouds/src/PointCloudNode.d.ts +69 -69
- package/packages/pointclouds/src/{picking.d.ts → PointCloudPickingHandler.d.ts} +36 -29
- package/packages/pointclouds/src/PotreeGroupWrapper.d.ts +46 -46
- package/packages/pointclouds/src/PotreeNodeWrapper.d.ts +39 -36
- package/packages/pointclouds/src/PotreePnextLoader.d.ts +4 -4
- package/packages/pointclouds/src/createPointClassKey.d.ts +5 -5
- package/packages/pointclouds/src/createPointCloudManager.d.ts +7 -7
- package/packages/pointclouds/src/potree-three-loader/Potree.d.ts +43 -46
- package/packages/pointclouds/src/potree-three-loader/geometry/IPointCloudTreeGeometry.d.ts +10 -10
- package/packages/pointclouds/src/potree-three-loader/geometry/IPointCloudTreeGeometryNode.d.ts +11 -11
- package/packages/pointclouds/src/potree-three-loader/geometry/PointCloudEptGeometry.d.ts +50 -50
- package/packages/pointclouds/src/potree-three-loader/geometry/PointCloudEptGeometryNode.d.ts +63 -63
- package/packages/pointclouds/src/potree-three-loader/geometry/translationUtils.d.ts +7 -7
- package/packages/pointclouds/src/potree-three-loader/index.d.ts +10 -10
- package/packages/pointclouds/src/potree-three-loader/loading/EptBinaryLoader.d.ts +12 -12
- package/packages/pointclouds/src/potree-three-loader/loading/EptLoader.d.ts +5 -5
- package/packages/pointclouds/src/potree-three-loader/loading/ILoader.d.ts +4 -4
- package/packages/pointclouds/src/potree-three-loader/loading/globalLoadingCounter.d.ts +5 -5
- package/packages/pointclouds/src/potree-three-loader/rendering/PointCloudMaterial.d.ts +204 -203
- package/packages/pointclouds/src/potree-three-loader/rendering/classification.d.ts +2 -2
- package/packages/pointclouds/src/potree-three-loader/rendering/clipping.d.ts +12 -12
- package/packages/pointclouds/src/potree-three-loader/rendering/constants.d.ts +15 -14
- package/packages/pointclouds/src/potree-three-loader/rendering/enums.d.ts +46 -46
- package/packages/pointclouds/src/potree-three-loader/rendering/features.d.ts +6 -6
- package/packages/pointclouds/src/potree-three-loader/rendering/gradients/SpectralGradient.d.ts +2 -2
- package/packages/pointclouds/src/potree-three-loader/rendering/index.d.ts +5 -5
- package/packages/pointclouds/src/potree-three-loader/rendering/texture-generation.d.ts +5 -5
- package/packages/pointclouds/src/potree-three-loader/rendering/types.d.ts +10 -10
- package/packages/pointclouds/src/potree-three-loader/tree/IPointCloudTreeNode.d.ts +7 -7
- package/packages/pointclouds/src/potree-three-loader/tree/IPointCloudTreeNodeBase.d.ts +18 -18
- package/packages/pointclouds/src/potree-three-loader/tree/PointAttributes.d.ts +52 -52
- package/packages/pointclouds/src/potree-three-loader/tree/PointCloudOctree.d.ts +48 -48
- package/packages/pointclouds/src/potree-three-loader/tree/PointCloudOctreeNode.d.ts +27 -27
- package/packages/pointclouds/src/potree-three-loader/tree/PointCloudOctreePicker.d.ts +14 -11
- package/packages/pointclouds/src/potree-three-loader/tree/PointCloudOctreePickerHelper.d.ts +57 -57
- package/packages/pointclouds/src/potree-three-loader/tree/PointCloudTree.d.ts +6 -6
- package/packages/pointclouds/src/potree-three-loader/types/IPotree.d.ts +10 -11
- package/packages/pointclouds/src/potree-three-loader/types/IVisibilityUpdateResult.d.ts +18 -18
- package/packages/pointclouds/src/potree-three-loader/types/type-predicates.d.ts +6 -6
- package/packages/pointclouds/src/potree-three-loader/types/types.d.ts +14 -14
- package/packages/pointclouds/src/potree-three-loader/utils/BinaryHeap.d.ts +11 -11
- package/packages/pointclouds/src/potree-three-loader/utils/WorkerPool.d.ts +31 -31
- package/packages/pointclouds/src/potree-three-loader/utils/async-blocking-queue.d.ts +8 -8
- package/packages/pointclouds/src/potree-three-loader/utils/bounds.d.ts +6 -6
- package/packages/pointclouds/src/potree-three-loader/utils/box3-helper.d.ts +13 -13
- package/packages/pointclouds/src/potree-three-loader/utils/lru.d.ts +32 -32
- package/packages/pointclouds/src/potree-three-loader/utils/math.d.ts +1 -1
- package/packages/pointclouds/src/potree-three-loader/utils/utils.d.ts +8 -8
- package/packages/pointclouds/src/potree-three-loader/version.d.ts +9 -9
- package/packages/pointclouds/src/potree-three-loader/workers/eptBinaryDecoder.worker.d.ts +18 -18
- package/packages/pointclouds/src/types.d.ts +84 -84
- package/packages/rendering/index.d.ts +18 -17
- package/packages/rendering/src/CadMaterialManager.d.ts +39 -39
- package/packages/rendering/src/RenderPass.d.ts +15 -15
- package/packages/rendering/src/RenderPipelineExecutor.d.ts +13 -12
- package/packages/rendering/src/RenderPipelineProvider.d.ts +15 -15
- package/packages/rendering/src/pipeline-executors/BasicPipelineExecutor.d.ts +22 -11
- package/packages/rendering/src/render-passes/GeometryPass.d.ts +16 -16
- package/packages/rendering/src/render-passes/PointCloudEffectsPass.d.ts +16 -0
- package/packages/rendering/src/render-passes/PostProcessingPass.d.ts +22 -24
- package/packages/rendering/src/render-passes/SSAOPass.d.ts +14 -14
- package/packages/rendering/src/render-passes/types.d.ts +67 -31
- package/packages/rendering/src/render-pipeline-providers/CadGeometryRenderModePipelineProvider.d.ts +23 -23
- package/packages/rendering/src/render-pipeline-providers/CadGeometryRenderPipelineProvider.d.ts +25 -25
- package/packages/rendering/src/render-pipeline-providers/DefaultRenderPipelineProvider.d.ts +37 -34
- package/packages/rendering/src/render-pipeline-providers/PointCloudRenderPipelineProvider.d.ts +24 -0
- package/packages/rendering/src/render-pipeline-providers/types.d.ts +23 -19
- package/packages/rendering/src/rendering/NodeAppearanceTextureBuilder.d.ts +51 -51
- package/packages/rendering/src/rendering/RenderMode.d.ts +15 -15
- package/packages/rendering/src/rendering/createSimpleGeometryMesh.d.ts +6 -6
- package/packages/rendering/src/rendering/matCapTextureData.d.ts +5 -5
- package/packages/rendering/src/rendering/materials.d.ts +23 -23
- package/packages/rendering/src/rendering/primitives.d.ts +12 -12
- package/packages/rendering/src/rendering/shaders.d.ts +100 -87
- package/packages/rendering/src/rendering/types.d.ts +89 -76
- package/packages/rendering/src/transform/NodeTransformProvider.d.ts +13 -13
- package/packages/rendering/src/transform/NodeTransformTextureBuilder.d.ts +24 -23
- package/packages/rendering/src/transform/TransformOverrideBuffer.d.ts +21 -21
- package/packages/rendering/src/utilities/renderUtilities.d.ts +29 -26
- package/packages/rendering/src/utilities/types.d.ts +26 -26
- package/packages/sector-loader/index.d.ts +6 -6
- package/packages/sector-loader/src/GltfSectorLoader.d.ts +12 -12
- package/packages/sector-loader/src/GltfSectorRepository.d.ts +19 -19
- package/packages/sector-loader/src/SectorRepository.d.ts +10 -10
- package/packages/sector-loader/src/V8SectorRepository.d.ts +26 -26
- package/packages/sector-loader/src/v8/SimpleAndDetailedToSector3D.d.ts +20 -20
- package/packages/sector-loader/src/v8/arrays.d.ts +5 -5
- package/packages/sector-loader/src/v8/groupMeshesByNumber.d.ts +8 -8
- package/packages/sector-loader/src/v8/sectorUtilities.d.ts +16 -16
- package/packages/sector-parser/index.d.ts +5 -5
- package/packages/sector-parser/src/DracoDecoderHelper.d.ts +32 -32
- package/packages/sector-parser/src/GltfSectorParser.d.ts +19 -19
- package/packages/sector-parser/src/constants.d.ts +6 -6
- package/packages/sector-parser/src/lib/draco_decoder_gltf.d.ts +5 -0
- package/packages/sector-parser/src/reveal-glb-parser/GlbMetadataParser.d.ts +14 -14
- package/packages/sector-parser/src/reveal-glb-parser/primitiveGeometries.d.ts +12 -12
- package/packages/sector-parser/src/types.d.ts +106 -106
- package/packages/tools/index.d.ts +18 -15
- package/packages/tools/src/AxisView/AxisViewTool.d.ts +31 -31
- package/packages/tools/src/AxisView/types.d.ts +98 -98
- package/packages/tools/src/Cognite3DViewerToolBase.d.ts +25 -25
- package/packages/tools/src/DebugCameraTool.d.ts +20 -20
- package/packages/tools/src/DebugLoadedSectorsTool.d.ts +23 -23
- package/packages/tools/src/ExplodedViewTool.d.ts +12 -12
- package/packages/tools/src/Geomap/Geomap.d.ts +17 -17
- package/packages/tools/src/Geomap/GeomapTool.d.ts +23 -23
- package/packages/tools/src/Geomap/MapConfig.d.ts +195 -195
- package/packages/tools/src/HtmlOverlay/BucketGrid2D.d.ts +28 -28
- package/packages/tools/src/HtmlOverlay/HtmlOverlayTool.d.ts +166 -160
- package/packages/tools/src/Measurement/MeasurementLabels.d.ts +18 -0
- package/packages/tools/src/Measurement/MeasurementLine.d.ts +44 -0
- package/packages/tools/src/Measurement/MeasurementManager.d.ts +66 -0
- package/packages/tools/src/Measurement/MeasurementTool.d.ts +183 -0
- package/packages/tools/src/Measurement/types.d.ts +38 -0
- package/packages/tools/src/Timeline/Keyframe.d.ts +39 -39
- package/packages/tools/src/Timeline/TimelineTool.d.ts +79 -79
- package/packages/tools/src/Timeline/types.d.ts +13 -13
- package/packages/tools/src/types.d.ts +4 -4
- package/packages/utilities/index.d.ts +36 -36
- package/packages/utilities/src/CameraConfiguration.d.ts +10 -10
- package/packages/utilities/src/DeferredPromise.d.ts +17 -17
- package/packages/utilities/src/IndexSet.d.ts +1 -1
- package/packages/utilities/src/NumericRange.d.ts +22 -22
- package/packages/utilities/src/RandomColors.d.ts +34 -34
- package/packages/utilities/src/SceneHandler.d.ts +28 -21
- package/packages/utilities/src/WebGLRendererStateHelper.d.ts +29 -27
- package/packages/utilities/src/assertNever.d.ts +7 -7
- package/packages/utilities/src/cache/MemoryRequestCache.d.ts +24 -24
- package/packages/utilities/src/cache/MostFrequentlyUsedCache.d.ts +19 -19
- package/packages/utilities/src/cache/RequestCache.d.ts +13 -13
- package/packages/utilities/src/calculateVolumeOfMesh.d.ts +4 -4
- package/packages/utilities/src/counterMap.d.ts +5 -5
- package/packages/utilities/src/datastructures/DynamicDefragmentedBuffer.d.ts +33 -33
- package/packages/utilities/src/determinePowerOfTwoDimensions.d.ts +11 -11
- package/packages/utilities/src/device.d.ts +10 -10
- package/packages/utilities/src/disposeAttributeArrayOnUpload.d.ts +17 -17
- package/packages/utilities/src/events/EventTrigger.d.ts +13 -13
- package/packages/utilities/src/events/InputHandler.d.ts +30 -30
- package/packages/utilities/src/events/clickOrTouchEventOffset.d.ts +13 -13
- package/packages/utilities/src/events/index.d.ts +7 -7
- package/packages/utilities/src/events/types.d.ts +32 -27
- package/packages/utilities/src/indexset/IndexSet.d.ts +26 -26
- package/packages/utilities/src/indexset/IntermediateIndexNode.d.ts +26 -26
- package/packages/utilities/src/indexset/LeafIndexNode.d.ts +16 -16
- package/packages/utilities/src/isMobileOrTablet.d.ts +5 -5
- package/packages/utilities/src/networking/isTheSameDomain.d.ts +11 -11
- package/packages/utilities/src/objectTraversal.d.ts +8 -8
- package/packages/utilities/src/revealEnv.d.ts +10 -10
- package/packages/utilities/src/three/AutoDisposeGroup.d.ts +17 -17
- package/packages/utilities/src/three/BoundingBoxLOD.d.ts +27 -27
- package/packages/utilities/src/three/createFullScreenTriangleGeometry.d.ts +5 -5
- package/packages/utilities/src/three/fitCameraToBoundingBox.d.ts +15 -0
- package/packages/utilities/src/three/isBox3OnPositiveSideOfPlane.d.ts +10 -10
- package/packages/utilities/src/three/toThreeBox3.d.ts +6 -6
- package/packages/utilities/src/three/unionBoxes.d.ts +5 -5
- package/packages/utilities/src/three/visitBox3CornerPoints.d.ts +12 -12
- package/packages/utilities/src/transformCameraConfiguration.d.ts +6 -6
- package/packages/utilities/src/types.d.ts +11 -11
- package/packages/utilities/src/workers/WorkerPool.d.ts +14 -14
- package/packages/utilities/src/worldToViewport.d.ts +30 -30
- package/tools.d.ts +7 -7
- package/tools.js +2 -280
- package/tools.js.LICENSE.txt +7 -0
- package/tools.map +1 -1
- package/core/cad.d.ts +0 -4
- package/core/index.d.ts +0 -6
- package/core/src/index.d.ts +0 -13
- package/core/src/internals.d.ts +0 -10
- package/core/src/public/migration/NotSupportedInMigrationWrapperError.d.ts +0 -11
- package/core/src/utilities/index.d.ts +0 -6
- package/core/utilities.d.ts +0 -4
- package/packages/cad-geometry-loaders/src/utilities/rxOperations.d.ts +0 -6
- package/packages/utilities/src/packFloat.d.ts +0 -6
package/README.md
CHANGED
|
@@ -131,6 +131,16 @@ Add the following script to your package's `package.json`:
|
|
|
131
131
|
Running the command `yarn start` will host a localhost site with a template HTML that includes the `/app/index.ts` script that has been transpiled to javascript.
|
|
132
132
|
To see an example of this check out the `packages/camera-manager` package.
|
|
133
133
|
|
|
134
|
+
## Creating and running visual tests
|
|
135
|
+
|
|
136
|
+
Visual test files must be on the format `visual-tests/SomeTest.VisualTest.ts`. See one of the existing tests
|
|
137
|
+
for example on how to create a test.
|
|
138
|
+
|
|
139
|
+
Visual tests can be run from `viewer/` using `yarn test:visual`. This will run all visual tests. You can also
|
|
140
|
+
run a single test by using `yarn test:visual -- -t="SomeTest"` (will run all tests with "SomeTest" in the name). Note that arguments only will be passed to the client, to pass arguments to the server you will need to manually start the server and client separately.
|
|
141
|
+
|
|
142
|
+
For more information about visual tests, see [visual-tests/README.md](visual-tests/README.md).
|
|
143
|
+
|
|
134
144
|
### Recommended package folder structure
|
|
135
145
|
├── app # Runnable app
|
|
136
146
|
└──index.ts # Entry point for runnable app
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./packages/pointclouds/src/potree-three-loader/workers/eptBinaryDecoder.worker.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","ctx","self","onmessage","arg0","event","buffer","data","view","DataView","schema","scale","offset","mins","dimensions","reduce","getExtractor","length","size","dimOffset","type","getInt8","getInt16","getInt32","Error","getUint8","getUint16","getUint32","getFloat32","getFloat64","str","JSON","stringify","pointSize","numPoints","byteLength","rgbBuffer","intensityBuffer","classificationBuffer","returnNumberBuffer","numberOfReturnsBuffer","pointSourceIdBuffer","rgb","intensity","classification","returnNumber","numberOfReturns","pointSourceId","rgbExtractor","intensityExtractor","classificationExtractor","returnNumberExtractor","numberOfReturnsExtractor","pointSourceIdExtractor","twoByteColor","xyzBuffer","ArrayBuffer","xyz","Float32Array","xyzExtractor","g","b","pos","Uint8Array","Uint16Array","mean","bounds","min","Number","MAX_VALUE","max","x","y","z","Math","indicesBuffer","indices","Uint32Array","message","tightBoundingBox","position","color","transferables","filter","undefined","postMessage","parseEpt"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBk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,IAAInB,YAAwB,EAAZtB,GAChC0C,EAAU,IAAIC,YAAYF,GAChC,IAAK,IAAI1G,EAAI,EAAGA,EAAIiE,IAAajE,EAC/B2G,EAAQ3G,GAAKA,EAGf,MAAM6G,EAAyB,CAC7B5C,UAAWA,EACX6C,iBAAkBb,EAClBD,KAAMA,EAENe,SAAUzB,EACV0B,MAAO7C,EACPO,UAAWN,EACXO,eAAgBN,EAChBO,aAAcN,EACdO,gBAAiBN,EACjBO,cAAeN,EACfmC,QAASD,GAOX,MAAMO,EAAgB,CACpBJ,EAAQE,SACRF,EAAQG,MACRH,EAAQnC,UACRmC,EAAQlC,eACRkC,EAAQjC,aACRiC,EAAQhC,gBACRgC,EAAQ/B,cACR+B,EAAQF,SACRO,QAbF,SAAuB7E,GACrB,YAAkB8E,IAAX9E,KAcTL,EAAIoF,YAAYP,EAASI,GArQzBI,CAASlF,IAwQI","file":"eptBinaryDecoder.worker.worker.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"https://apps-cdn.cogniteapp.com/@cognite/reveal-parser-worker/1.3.0/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","const ctx: Worker = self as any;\n\nctx.onmessage = function (arg0: any) {\n parseEpt(arg0);\n};\n\nexport type ParsedEptData = {\n numPoints: number;\n tightBoundingBox: { min: number[]; max: number[] };\n mean: number[];\n position: ArrayBuffer;\n color: ArrayBuffer | undefined;\n intensity: ArrayBuffer | undefined;\n classification: ArrayBuffer | undefined;\n returnNumber: ArrayBuffer | undefined;\n numberOfReturns: ArrayBuffer | undefined;\n pointSourceId: ArrayBuffer | undefined;\n indices: ArrayBuffer;\n};\n\ntype SchemaEntry = {\n name: string;\n size: number;\n type: 'signed' | 'unsigned' | 'float';\n};\n\nfunction parseEpt(event: MessageEvent): void {\n const buffer = event.data.buffer;\n const view = new DataView(buffer);\n const schema: SchemaEntry[] = event.data.schema;\n const scale = event.data.scale;\n const offset = event.data.offset;\n const mins = event.data.mins;\n\n const dimensions: Record<string, SchemaEntry> = schema.reduce((p, c) => {\n p[c.name] = c;\n return p;\n }, {} as Record<string, SchemaEntry>);\n\n const dimOffset = (name: string) => {\n let offset = 0;\n for (let i = 0; i < schema.length; ++i) {\n if (schema[i].name === name) return offset;\n offset += schema[i].size;\n }\n return undefined;\n };\n\n function getExtractor(name: string) {\n const offset = dimOffset(name)!;\n const type = dimensions[name].type;\n const size = dimensions[name].size;\n\n if (type == 'signed')\n switch (size) {\n case 1:\n return (p: number) => view.getInt8(p + offset);\n case 2:\n return (p: number) => view.getInt16(p + offset, true);\n case 4:\n return (p: number) => view.getInt32(p + offset, true);\n default:\n throw Error('Unrecognized byte size for \"signed\" numbers');\n }\n if (type == 'unsigned')\n switch (size) {\n case 1:\n return (p: number) => view.getUint8(p + offset);\n case 2:\n return (p: number) => view.getUint16(p + offset, true);\n case 4:\n return (p: number) => view.getUint32(p + offset, true);\n default:\n throw Error('Unrecognized byte size for \"unsigned\" numbers');\n }\n if (type == 'float')\n switch (size) {\n case 4:\n return (p: number) => view.getFloat32(p + offset, true);\n case 8:\n return (p: number) => view.getFloat64(p + offset, true);\n default:\n throw Error('Unrecognized byte size for \"float\" numbers');\n }\n\n const str = JSON.stringify(dimensions[name]);\n throw new Error(`Invalid dimension specification for ${name}: ${str}`);\n }\n\n const pointSize = schema.reduce((p: number, c) => p + c.size, 0);\n const numPoints = buffer.byteLength / pointSize;\n\n let rgbBuffer: ArrayBuffer | undefined;\n let intensityBuffer: ArrayBuffer | undefined;\n let classificationBuffer: ArrayBuffer | undefined;\n let returnNumberBuffer: ArrayBuffer | undefined;\n let numberOfReturnsBuffer: ArrayBuffer | undefined;\n let pointSourceIdBuffer: ArrayBuffer | undefined;\n\n let rgb: Uint8Array | undefined;\n let intensity: Float32Array | undefined;\n let classification: Uint8Array | undefined;\n let returnNumber: Uint8Array | undefined;\n let numberOfReturns: Uint8Array | undefined;\n let pointSourceId: Uint16Array | undefined;\n\n let rgbExtractor: ((name: number) => number)[];\n let intensityExtractor: (name: number) => number;\n let classificationExtractor: (name: number) => number;\n let returnNumberExtractor: (name: number) => number;\n let numberOfReturnsExtractor: (name: number) => number;\n let pointSourceIdExtractor: (name: number) => number;\n\n let twoByteColor = false;\n\n if (!dimensions['X'] || !dimensions['Y'] || !dimensions['Z']) {\n throw Error('Point cloud did not contain position data');\n }\n\n const xyzBuffer = new ArrayBuffer(numPoints * 4 * 3);\n const xyz = new Float32Array(xyzBuffer);\n const xyzExtractor = [getExtractor('X'), getExtractor('Y'), getExtractor('Z')];\n\n if (dimensions['Red'] && dimensions['Green'] && dimensions['Blue']) {\n rgbBuffer = new ArrayBuffer(numPoints * 4);\n rgb = new Uint8Array(rgbBuffer);\n rgbExtractor = [getExtractor('Red'), getExtractor('Green'), getExtractor('Blue')];\n\n let r: number, g: number, b: number, pos: number;\n for (let i = 0; i < numPoints && !twoByteColor; ++i) {\n pos = i * pointSize;\n r = rgbExtractor[0](pos);\n g = rgbExtractor[1](pos);\n b = rgbExtractor[2](pos);\n if (r > 255 || g > 255 || b > 255) twoByteColor = true;\n }\n }\n\n if (dimensions['Intensity']) {\n intensityBuffer = new ArrayBuffer(numPoints * 4);\n intensity = new Float32Array(intensityBuffer);\n intensityExtractor = getExtractor('Intensity');\n }\n\n if (dimensions['Classification']) {\n classificationBuffer = new ArrayBuffer(numPoints);\n classification = new Uint8Array(classificationBuffer);\n classificationExtractor = getExtractor('Classification');\n }\n\n if (dimensions['ReturnNumber']) {\n returnNumberBuffer = new ArrayBuffer(numPoints);\n returnNumber = new Uint8Array(returnNumberBuffer);\n returnNumberExtractor = getExtractor('ReturnNumber');\n }\n\n if (dimensions['NumberOfReturns']) {\n numberOfReturnsBuffer = new ArrayBuffer(numPoints);\n numberOfReturns = new Uint8Array(numberOfReturnsBuffer);\n numberOfReturnsExtractor = getExtractor('NumberOfReturns');\n }\n\n if (dimensions['PointSourceId']) {\n pointSourceIdBuffer = new ArrayBuffer(numPoints * 2);\n pointSourceId = new Uint16Array(pointSourceIdBuffer);\n pointSourceIdExtractor = getExtractor('PointSourceId');\n }\n\n const mean = [0, 0, 0];\n const bounds = {\n min: [Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE],\n max: [-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE]\n };\n\n let x: number;\n let y: number;\n let z: number;\n let r: number;\n let g: number;\n let b: number;\n\n for (let i = 0; i < numPoints; ++i) {\n const pos = i * pointSize;\n if (xyz) {\n x = xyzExtractor[0](pos) * scale.x + offset.x - mins[0];\n y = xyzExtractor[1](pos) * scale.y + offset.y - mins[1];\n z = xyzExtractor[2](pos) * scale.z + offset.z - mins[2];\n\n mean[0] += x / numPoints;\n mean[1] += y / numPoints;\n mean[2] += z / numPoints;\n\n bounds.min[0] = Math.min(bounds.min[0], x);\n bounds.min[1] = Math.min(bounds.min[1], y);\n bounds.min[2] = Math.min(bounds.min[2], z);\n\n bounds.max[0] = Math.max(bounds.max[0], x);\n bounds.max[1] = Math.max(bounds.max[1], y);\n bounds.max[2] = Math.max(bounds.max[2], z);\n\n xyz[3 * i + 0] = x;\n xyz[3 * i + 1] = y;\n xyz[3 * i + 2] = z;\n }\n\n if (rgb) {\n r = rgbExtractor;\n g = rgbExtractor;\n b = rgbExtractor;\n\n if (twoByteColor) {\n r /= 256;\n g /= 256;\n b /= 256;\n }\n\n rgb[4 * i + 0] = r;\n rgb[4 * i + 1] = g;\n rgb[4 * i + 2] = b;\n }\n\n if (intensity) intensity[i] = intensityExtractor!(pos);\n if (classification) classification[i] = classificationExtractor!(pos);\n if (returnNumber) returnNumber[i] = returnNumberExtractor!(pos);\n if (numberOfReturns) numberOfReturns[i] = numberOfReturnsExtractor!(pos);\n if (pointSourceId) pointSourceId[i] = pointSourceIdExtractor!(pos);\n }\n\n const indicesBuffer = new ArrayBuffer(numPoints * 4);\n const indices = new Uint32Array(indicesBuffer);\n for (let i = 0; i < numPoints; ++i) {\n indices[i] = i;\n }\n\n const message: ParsedEptData = {\n numPoints: numPoints,\n tightBoundingBox: bounds,\n mean: mean,\n\n position: xyzBuffer,\n color: rgbBuffer,\n intensity: intensityBuffer,\n classification: classificationBuffer,\n returnNumber: returnNumberBuffer,\n numberOfReturns: numberOfReturnsBuffer,\n pointSourceId: pointSourceIdBuffer,\n indices: indicesBuffer\n };\n\n function assertDefined(buffer: ArrayBuffer | undefined): buffer is ArrayBuffer {\n return buffer !== undefined;\n }\n\n const transferables = [\n message.position,\n message.color,\n message.intensity,\n message.classification,\n message.returnNumber,\n message.numberOfReturns,\n message.pointSourceId,\n message.indices\n ].filter(assertDefined);\n\n ctx.postMessage(message, transferables);\n}\n\nexport default null as any;\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"eptBinaryDecoder.worker.worker.js","mappings":"mBAAA,MAAMA,EAAcC,KAEpBD,EAAIE,UAAY,SAAUC,IAwB1B,SAAkBC,GAChB,MAAMC,EAASD,EAAME,KAAKD,OACpBE,EAAO,IAAIC,SAASH,GACpBI,EAAwBL,EAAME,KAAKG,OACnCC,EAAQN,EAAME,KAAKI,MACnBC,EAASP,EAAME,KAAKK,OACpBC,EAAOR,EAAME,KAAKM,KAElBC,EAA0CJ,EAAOK,QAAO,CAACC,EAAGC,KAChED,EAAEC,EAAEC,MAAQD,EACLD,IACN,IAWH,SAASG,EAAaD,GACpB,MAAMN,EAVU,CAACM,IACjB,IAAIN,EAAS,EACb,IAAK,IAAIQ,EAAI,EAAGA,EAAIV,EAAOW,SAAUD,EAAG,CACtC,GAAIV,EAAOU,GAAGF,OAAS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5B,GAAKkC,EAAyBa,IAC7DlB,IAAcA,EAAa7B,GAAKmC,EAAuBY,IACvDjB,IAAiBA,EAAgB9B,GAAKoC,EAA0BW,IAChEhB,IAAeA,EAAc/B,GAAKqC,EAAwBU,IAGhE,MAAMa,EAAgB,IAAIpB,YAAwB,EAAZtB,GAChC2C,EAAU,IAAIC,YAAYF,GAChC,IAAK,IAAI5D,EAAI,EAAGA,EAAIkB,IAAalB,EAC/B6D,EAAQ7D,GAAKA,EAGf,MAAM+D,EAAyB,CAC7B7C,UAAWA,EACX8C,iBAAkBb,EAClBD,KAAMA,EAENe,SAAU1B,EACV2B,MAAO9C,EACPO,UAAWN,EACXO,eAAgBN,EAChBO,aAAcN,EACdO,gBAAiBN,EACjBO,cAAeN,EACfoC,QAASD,GAOX,MAAMO,EAAgB,CACpBJ,EAAQE,SACRF,EAAQG,MACRH,EAAQpC,UACRoC,EAAQnC,eACRmC,EAAQlC,aACRkC,EAAQjC,gBACRiC,EAAQhC,cACRgC,EAAQF,SACRO,QAbF,SAAuBlF,GACrB,YAAkBmF,IAAXnF,KAcTL,EAAIyF,YAAYP,EAASI,GArQzBI,CAASvF,K","sources":["webpack://@cognite/reveal/./packages/pointclouds/src/potree-three-loader/workers/eptBinaryDecoder.worker.ts"],"sourcesContent":["const ctx: Worker = self as any;\n\nctx.onmessage = function (arg0: any) {\n parseEpt(arg0);\n};\n\nexport type ParsedEptData = {\n numPoints: number;\n tightBoundingBox: { min: number[]; max: number[] };\n mean: number[];\n position: ArrayBuffer;\n color: ArrayBuffer | undefined;\n intensity: ArrayBuffer | undefined;\n classification: ArrayBuffer | undefined;\n returnNumber: ArrayBuffer | undefined;\n numberOfReturns: ArrayBuffer | undefined;\n pointSourceId: ArrayBuffer | undefined;\n indices: ArrayBuffer;\n};\n\ntype SchemaEntry = {\n name: string;\n size: number;\n type: 'signed' | 'unsigned' | 'float';\n};\n\nfunction parseEpt(event: MessageEvent): void {\n const buffer = event.data.buffer;\n const view = new DataView(buffer);\n const schema: SchemaEntry[] = event.data.schema;\n const scale = event.data.scale;\n const offset = event.data.offset;\n const mins = event.data.mins;\n\n const dimensions: Record<string, SchemaEntry> = schema.reduce((p, c) => {\n p[c.name] = c;\n return p;\n }, {} as Record<string, SchemaEntry>);\n\n const dimOffset = (name: string) => {\n let offset = 0;\n for (let i = 0; i < schema.length; ++i) {\n if (schema[i].name === name) return offset;\n offset += schema[i].size;\n }\n return undefined;\n };\n\n function getExtractor(name: string) {\n const offset = dimOffset(name)!;\n const type = dimensions[name].type;\n const size = dimensions[name].size;\n\n if (type == 'signed')\n switch (size) {\n case 1:\n return (p: number) => view.getInt8(p + offset);\n case 2:\n return (p: number) => view.getInt16(p + offset, true);\n case 4:\n return (p: number) => view.getInt32(p + offset, true);\n default:\n throw Error('Unrecognized byte size for \"signed\" numbers');\n }\n if (type == 'unsigned')\n switch (size) {\n case 1:\n return (p: number) => view.getUint8(p + offset);\n case 2:\n return (p: number) => view.getUint16(p + offset, true);\n case 4:\n return (p: number) => view.getUint32(p + offset, true);\n default:\n throw Error('Unrecognized byte size for \"unsigned\" numbers');\n }\n if (type == 'float')\n switch (size) {\n case 4:\n return (p: number) => view.getFloat32(p + offset, true);\n case 8:\n return (p: number) => view.getFloat64(p + offset, true);\n default:\n throw Error('Unrecognized byte size for \"float\" numbers');\n }\n\n const str = JSON.stringify(dimensions[name]);\n throw new Error(`Invalid dimension specification for ${name}: ${str}`);\n }\n\n const pointSize = schema.reduce((p: number, c) => p + c.size, 0);\n const numPoints = buffer.byteLength / pointSize;\n\n let rgbBuffer: ArrayBuffer | undefined;\n let intensityBuffer: ArrayBuffer | undefined;\n let classificationBuffer: ArrayBuffer | undefined;\n let returnNumberBuffer: ArrayBuffer | undefined;\n let numberOfReturnsBuffer: ArrayBuffer | undefined;\n let pointSourceIdBuffer: ArrayBuffer | undefined;\n\n let rgb: Uint8Array | undefined;\n let intensity: Float32Array | undefined;\n let classification: Uint8Array | undefined;\n let returnNumber: Uint8Array | undefined;\n let numberOfReturns: Uint8Array | undefined;\n let pointSourceId: Uint16Array | undefined;\n\n let rgbExtractor: ((name: number) => number)[];\n let intensityExtractor: (name: number) => number;\n let classificationExtractor: (name: number) => number;\n let returnNumberExtractor: (name: number) => number;\n let numberOfReturnsExtractor: (name: number) => number;\n let pointSourceIdExtractor: (name: number) => number;\n\n let twoByteColor = false;\n\n if (!dimensions['X'] || !dimensions['Y'] || !dimensions['Z']) {\n throw Error('Point cloud did not contain position data');\n }\n\n const xyzBuffer = new ArrayBuffer(numPoints * 4 * 3);\n const xyz = new Float32Array(xyzBuffer);\n const xyzExtractor = [getExtractor('X'), getExtractor('Y'), getExtractor('Z')];\n\n if (dimensions['Red'] && dimensions['Green'] && dimensions['Blue']) {\n rgbBuffer = new ArrayBuffer(numPoints * 4);\n rgb = new Uint8Array(rgbBuffer);\n rgbExtractor = [getExtractor('Red'), getExtractor('Green'), getExtractor('Blue')];\n\n let r: number, g: number, b: number, pos: number;\n for (let i = 0; i < numPoints && !twoByteColor; ++i) {\n pos = i * pointSize;\n r = rgbExtractor[0](pos);\n g = rgbExtractor[1](pos);\n b = rgbExtractor[2](pos);\n if (r > 255 || g > 255 || b > 255) twoByteColor = true;\n }\n }\n\n if (dimensions['Intensity']) {\n intensityBuffer = new ArrayBuffer(numPoints * 4);\n intensity = new Float32Array(intensityBuffer);\n intensityExtractor = getExtractor('Intensity');\n }\n\n if (dimensions['Classification']) {\n classificationBuffer = new ArrayBuffer(numPoints);\n classification = new Uint8Array(classificationBuffer);\n classificationExtractor = getExtractor('Classification');\n }\n\n if (dimensions['ReturnNumber']) {\n returnNumberBuffer = new ArrayBuffer(numPoints);\n returnNumber = new Uint8Array(returnNumberBuffer);\n returnNumberExtractor = getExtractor('ReturnNumber');\n }\n\n if (dimensions['NumberOfReturns']) {\n numberOfReturnsBuffer = new ArrayBuffer(numPoints);\n numberOfReturns = new Uint8Array(numberOfReturnsBuffer);\n numberOfReturnsExtractor = getExtractor('NumberOfReturns');\n }\n\n if (dimensions['PointSourceId']) {\n pointSourceIdBuffer = new ArrayBuffer(numPoints * 2);\n pointSourceId = new Uint16Array(pointSourceIdBuffer);\n pointSourceIdExtractor = getExtractor('PointSourceId');\n }\n\n const mean = [0, 0, 0];\n const bounds = {\n min: [Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE],\n max: [-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE]\n };\n\n let x: number;\n let y: number;\n let z: number;\n let r: number;\n let g: number;\n let b: number;\n\n for (let i = 0; i < numPoints; ++i) {\n const pos = i * pointSize;\n if (xyz) {\n x = xyzExtractor[0](pos) * scale.x + offset.x - mins[0];\n y = xyzExtractor[1](pos) * scale.y + offset.y - mins[1];\n z = xyzExtractor[2](pos) * scale.z + offset.z - mins[2];\n\n mean[0] += x / numPoints;\n mean[1] += y / numPoints;\n mean[2] += z / numPoints;\n\n bounds.min[0] = Math.min(bounds.min[0], x);\n bounds.min[1] = Math.min(bounds.min[1], y);\n bounds.min[2] = Math.min(bounds.min[2], z);\n\n bounds.max[0] = Math.max(bounds.max[0], x);\n bounds.max[1] = Math.max(bounds.max[1], y);\n bounds.max[2] = Math.max(bounds.max[2], z);\n\n xyz[3 * i + 0] = x;\n xyz[3 * i + 1] = y;\n xyz[3 * i + 2] = z;\n }\n\n if (rgb) {\n r = rgbExtractor;\n g = rgbExtractor;\n b = rgbExtractor;\n\n if (twoByteColor) {\n r /= 256;\n g /= 256;\n b /= 256;\n }\n\n rgb[4 * i + 0] = r;\n rgb[4 * i + 1] = g;\n rgb[4 * i + 2] = b;\n }\n\n if (intensity) intensity[i] = intensityExtractor!(pos);\n if (classification) classification[i] = classificationExtractor!(pos);\n if (returnNumber) returnNumber[i] = returnNumberExtractor!(pos);\n if (numberOfReturns) numberOfReturns[i] = numberOfReturnsExtractor!(pos);\n if (pointSourceId) pointSourceId[i] = pointSourceIdExtractor!(pos);\n }\n\n const indicesBuffer = new ArrayBuffer(numPoints * 4);\n const indices = new Uint32Array(indicesBuffer);\n for (let i = 0; i < numPoints; ++i) {\n indices[i] = i;\n }\n\n const message: ParsedEptData = {\n numPoints: numPoints,\n tightBoundingBox: bounds,\n mean: mean,\n\n position: xyzBuffer,\n color: rgbBuffer,\n intensity: intensityBuffer,\n classification: classificationBuffer,\n returnNumber: returnNumberBuffer,\n numberOfReturns: numberOfReturnsBuffer,\n pointSourceId: pointSourceIdBuffer,\n indices: indicesBuffer\n };\n\n function assertDefined(buffer: ArrayBuffer | undefined): buffer is ArrayBuffer {\n return buffer !== undefined;\n }\n\n const transferables = [\n message.position,\n message.color,\n message.intensity,\n message.classification,\n message.returnNumber,\n message.numberOfReturns,\n message.pointSourceId,\n message.indices\n ].filter(assertDefined);\n\n ctx.postMessage(message, transferables);\n}\n\nexport default null as any;\n"],"names":["ctx","self","onmessage","arg0","event","buffer","data","view","DataView","schema","scale","offset","mins","dimensions","reduce","p","c","name","getExtractor","i","length","size","dimOffset","type","getInt8","getInt16","getInt32","Error","getUint8","getUint16","getUint32","getFloat32","getFloat64","str","JSON","stringify","pointSize","numPoints","byteLength","rgbBuffer","intensityBuffer","classificationBuffer","returnNumberBuffer","numberOfReturnsBuffer","pointSourceIdBuffer","rgb","intensity","classification","returnNumber","numberOfReturns","pointSourceId","rgbExtractor","intensityExtractor","classificationExtractor","returnNumberExtractor","numberOfReturnsExtractor","pointSourceIdExtractor","twoByteColor","xyzBuffer","ArrayBuffer","xyz","Float32Array","xyzExtractor","r","g","b","pos","Uint8Array","Uint16Array","mean","bounds","min","Number","MAX_VALUE","max","x","y","z","Math","indicesBuffer","indices","Uint32Array","message","tightBoundingBox","position","color","transferables","filter","undefined","postMessage","parseEpt"],"sourceRoot":""}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2021 Cognite AS
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* @module @cognite/reveal/extensions/datasource
|
|
6
|
-
*/
|
|
7
|
-
export { DataSource } from '../packages/data-source';
|
|
8
|
-
export { NodesApiClient } from '../packages/nodes-api';
|
|
9
|
-
export { ModelIdentifier, CdfModelIdentifier, ModelMetadataProvider, ModelDataProvider, BlobOutputMetadata, File3dFormat } from '../packages/modeldata-api';
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @module @cognite/reveal/extensions/datasource
|
|
6
|
+
*/
|
|
7
|
+
export { DataSource } from '../packages/data-source';
|
|
8
|
+
export { NodesApiClient } from '../packages/nodes-api';
|
|
9
|
+
export { ModelIdentifier, CdfModelIdentifier, ModelMetadataProvider, ModelDataProvider, BlobOutputMetadata, File3dFormat, JsonFileProvider, BinaryFileProvider } from '../packages/modeldata-api';
|
package/extensions/datasource.js
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Copyright 2021 Cognite AS
|
|
4
|
-
*/!function(t){t.EptPointCloud="ept-pointcloud",t.RevealCadModel="reveal-directory",t.GltfCadModel="gltf-directory",t.AnyFormat="all-outputs"}(i||(i={}));
|
|
5
|
-
/*!
|
|
6
|
-
* Copyright 2021 Cognite AS
|
|
7
|
-
*/
|
|
8
|
-
const s=(new a.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1);function c(t,e){switch(e){case i.RevealCadModel:case i.GltfCadModel:case i.EptPointCloud:t.premultiply(s);break;default:throw new Error("Unknown model format '"+e)}}
|
|
9
|
-
/*!
|
|
10
|
-
* Copyright 2021 Cognite AS
|
|
11
|
-
*/class u{constructor(t){this._client=t}async getModelMatrix(t,e){if(!(t instanceof n))throw new Error(`Model must be a ${n.name}, but got ${t.toString()}`);const{modelId:r,revisionId:o}=t,i=await this._client.revisions3D.retrieve(r,o),s=new a.Matrix4;return i.rotation&&s.makeRotationFromEuler(new a.Euler(...i.rotation)),c(s,e),s}async getModelCamera(t){if(!(t instanceof n))throw new Error(`Model must be a ${n.name}, but got ${t.toString()}`);const{modelId:e,revisionId:r}=t,o=await this._client.revisions3D.retrieve(e,r);if(o.camera&&o.camera.position&&o.camera.target){const{position:t,target:e}=o.camera;return{position:new a.Vector3(t[0],t[1],t[2]),target:new a.Vector3(e[0],e[1],e[2])}}}async getModelUri(t,e){if(!(t instanceof n))throw new Error(`Model must be a ${n.name}, but got ${t.toString()}`);return`${this._client.getBaseUrl()}${this.getRequestPath(e.blobId)}`}async getModelOutputs(t){if(!(t instanceof n))throw new Error(`Model must be a ${n.name}, but got ${t.toString()}`);const{modelId:e,revisionId:r}=t,o=`/api/v1/projects/${this._client.project}/3d/models/${e}/revisions/${r}/outputs`,a=await this._client.get(o,{params:{format:i.AnyFormat}});if(200===a.status)return a.data.items.filter(t=>Object.values(i).includes(t.format));throw new Error(`Unexpected response ${a.status} (payload: '${a.data})`)}getRequestPath(t){return`/api/v1/projects/${this._client.project}/3d/files/${t}`}}var l=r(18);
|
|
12
|
-
/*!
|
|
13
|
-
* Copyright 2021 Cognite AS
|
|
14
|
-
*/async function d(t){const e=await fetch(t);if(!e.ok){const t={};throw e.headers.forEach((e,r)=>{t[e]=r}),new l.HttpError(e.status,e.body,t)}return e}
|
|
15
|
-
/*!
|
|
16
|
-
* Copyright 2021 Cognite AS
|
|
17
|
-
*/class f{async getBinaryFile(t,e){return(await d(`${t}/${e}`)).arrayBuffer()}async getJsonFile(t,e){return(await d(`${t}/${e}`)).json()}}
|
|
18
|
-
/*!
|
|
19
|
-
* Copyright 2021 Cognite AS
|
|
20
|
-
*/class h{constructor(t){this.revealInternalId=Symbol(t),this.localPath=t}toString(){return`${h.name} (${this.localPath})`}}
|
|
21
|
-
/*!
|
|
22
|
-
* Copyright 2021 Cognite AS
|
|
23
|
-
*/class m{getModelUri(t){if(!(t instanceof h))throw new Error(`Model must be a ${h.name}, but got ${t.toString()}`);return t.localPath.startsWith("http")?Promise.resolve(t.localPath):Promise.resolve(`${location.origin}/${t.localPath}`)}async getModelMatrix(t,e){if(!(t instanceof h))throw new Error(`Model must be a ${h.name}, but got ${t.toString()}`);const r=new a.Matrix4;return c(r,e),r}getModelCamera(t){if(!(t instanceof h))throw new Error(`Model must be a ${h.name}, but got ${t.toString()}`);return Promise.resolve(void 0)}async getModelOutputs(t){var e;const r=await this.getModelUri(t),o=null!==(e=await async function(t){let e;try{e=(await(await d(t+"/scene.json")).json()).version}catch(t){return}switch(e){case 8:return Promise.resolve({blobId:-1,format:i.RevealCadModel,version:8});case 9:return Promise.resolve({blobId:-1,format:i.GltfCadModel,version:9});default:return}}(r))&&void 0!==e?e:await async function(t){let e;try{e=await(await d(t+"/ept.json")).json()}catch(t){return}return e?Promise.resolve({blobId:-1,format:i.EptPointCloud,version:-1}):void 0}(r);if(o)return[o];throw new Error("Only point cloud or CAD models (version 8 and 9) are supported)")}}
|
|
24
|
-
/*!
|
|
25
|
-
* Copyright 2021 Cognite AS
|
|
26
|
-
*/},73:function(t,e,r){"use strict";r.r(e);var o=r(6);r.d(e,"CdfModelIdentifier",(function(){return o.b})),r.d(e,"File3dFormat",(function(){return o.d}))}})}));
|
|
1
|
+
/*! For license information please see datasource.js.LICENSE.txt */
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@cognite/reveal"]=t():e["@cognite/reveal"]=t()}("undefined"!=typeof self?self:this,(()=>(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{CdfModelIdentifier:()=>o,File3dFormat:()=>n});class o{constructor(e,t){this.revealInternalId=Symbol(`${e}/${t}`),this.modelId=e,this.revisionId=t}toString(){return`${o.name} (${String(this.revealInternalId)})`}}const r=require("three");var n,i;return(i=n||(n={})).EptPointCloud="ept-pointcloud",i.RevealCadModel="reveal-directory",i.GltfCadModel="gltf-directory",i.AnyFormat="all-outputs",(new r.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),require("@cognite/sdk-core"),t})()));
|
|
27
3
|
//# sourceMappingURL=datasource.map
|
package/{core/src/public/migration/RenderController.d.ts → extensions/datasource.js.LICENSE.txt}
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2021 Cognite AS
|
|
3
|
-
*/
|
|
4
|
-
export {};
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 Cognite AS
|
|
3
|
+
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///external \"three\"","webpack:///external \"@cognite/sdk-core\"","webpack:///./packages/modeldata-api/src/CdfModelDataProvider.ts","webpack:///./packages/modeldata-api/src/CdfModelIdentifier.ts","webpack:///./packages/modeldata-api/src/types.ts","webpack:///./packages/modeldata-api/src/applyDefaultModelTransformation.ts","webpack:///./packages/modeldata-api/src/CdfModelMetadataProvider.ts","webpack:///./packages/modeldata-api/src/utilities.ts","webpack:///./packages/modeldata-api/src/LocalModelDataProvider.ts","webpack:///./packages/modeldata-api/src/LocalModelIdentifier.ts","webpack:///./packages/modeldata-api/src/LocalModelMetadataProvider.ts","webpack:///./extensions/datasource.ts"],"names":["root","factory","exports","module","define","amd","a","i","self","this","installedModules","__webpack_require__","moduleId","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","require","CdfModelDataProvider","client","authenticationPromise","authenticate","baseUrl","fileName","url","headers","getDefaultRequestHeaders","Accept","fetchWithRetry","method","catch","_err","Error","arrayBuffer","data","input","options","retries","error","response","fetch","status","err","undefined","CdfModelIdentifier","modelId","revisionId","revealInternalId","String","File3dFormat","cadFromCdfToThreeMatrix","set","applyDefaultModelTransformation","matrix","format","RevealCadModel","GltfCadModel","EptPointCloud","premultiply","_client","modelIdentifier","toString","model","revisions3D","retrieve","modelMatrix","rotation","makeRotationFromEuler","camera","position","target","formatMetadata","getBaseUrl","getRequestPath","blobId","project","params","AnyFormat","items","filter","output","values","includes","directoryId","async","fetchWithStatusCheck","ok","forEach","body","json","LocalModelIdentifier","localPath","startsWith","Promise","resolve","location","origin","modelUri","getModelUri","version","getCadOutput","scene","getPointCloudOutput"],"mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,SACb,GAAqB,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,OACP,CACJ,IAAIK,EAAIL,IACR,IAAI,IAAIM,KAAKD,GAAuB,iBAAZJ,QAAuBA,QAAUF,GAAMO,GAAKD,EAAEC,IAPxE,CASoB,oBAATC,KAAuBA,KAAOC,MAAO,WAChD,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUV,QAGnC,IAAIC,EAASO,EAAiBE,GAAY,CACzCL,EAAGK,EACHC,GAAG,EACHX,QAAS,IAUV,OANAY,EAAQF,GAAUG,KAAKZ,EAAOD,QAASC,EAAQA,EAAOD,QAASS,GAG/DR,EAAOU,GAAI,EAGJV,EAAOD,QA0Df,OArDAS,EAAoBK,EAAIF,EAGxBH,EAAoBM,EAAIP,EAGxBC,EAAoBO,EAAI,SAAShB,EAASiB,EAAMC,GAC3CT,EAAoBU,EAAEnB,EAASiB,IAClCG,OAAOC,eAAerB,EAASiB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhET,EAAoBe,EAAI,SAASxB,GACX,oBAAXyB,QAA0BA,OAAOC,aAC1CN,OAAOC,e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B,G,MACpB,MAAMqC,QAAiBnH,KAAKoH,YAAYtC,GAElCoB,EAAuC,QAA7B,QAQhBI,eAA4Ba,GAC1B,IAAIE,EAEJ,IACEA,eAAwBd,EAAqBY,EAAW,gBAAgBR,QAAQU,QAChF,MAAO7D,GACP,OAEF,OAAQ6D,GACN,KAAK,EACH,OAAON,QAAQC,QAAQ,CACrBpB,QAAS,EACTpB,OAAQL,EAAaM,eACrB4C,QAAS,IAEb,KAAK,EACH,OAAON,QAAQC,QAAQ,CACrBpB,QAAS,EACTpB,OAAQL,EAAaO,aACrB2C,QAAS,IAEb,QACE,QA9BgBC,CAAaH,UAAU,cAkC7Cb,eAAmCa,GACjC,IAAII,EAEJ,IACEA,cAAqBhB,EAAqBY,EAAW,cAAcR,OACnE,MAAOnD,GACP,OAGF,OAAI+D,EACKR,QAAQC,QAAQ,CACrBpB,QAAS,EACTpB,OAAQL,EAAaQ,cACrB0C,SAAU,SAGZ,EAlDoDG,CAAoBL,GAE5E,GAAIjB,EACF,MAAO,CAACA,GAGV,MAAM,IAAIhD,MAAM;;;qCCpDpB","file":"extensions/datasource.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})((typeof self !== 'undefined' ? self : this), function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"https://apps-cdn.cogniteapp.com/@cognite/reveal-parser-worker/1.3.0/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 73);\n","module.exports = require(\"three\");","module.exports = require(\"@cognite/sdk-core\");","/*!\n * Copyright 2021 Cognite AS\n */\nimport { CogniteClient } from '@cognite/sdk';\n\nimport { ModelDataProvider } from './types';\n\n/**\n * Provides 3D V2 specific extensions for the standard CogniteClient used by Reveal.\n */\nexport class CdfModelDataProvider implements ModelDataProvider {\n private readonly client: CogniteClient;\n private authenticationPromise: Promise<string | undefined>;\n\n constructor(client: CogniteClient) {\n this.client = client;\n this.authenticationPromise = client.authenticate();\n }\n\n public async getBinaryFile(baseUrl: string, fileName: string): Promise<ArrayBuffer> {\n const url = `${baseUrl}/${fileName}`;\n const headers = {\n ...this.client.getDefaultRequestHeaders(),\n Accept: '*/*'\n };\n\n const response = await this.fetchWithRetry(url, { headers, method: 'GET' }).catch(_err => {\n throw Error('Could not download binary file');\n });\n return response.arrayBuffer();\n }\n\n async getJsonFile(baseUrl: string, fileName: string): Promise<any> {\n const response = await this.client.get(`${baseUrl}/${fileName}`).catch(_err => {\n throw Error('Could not download Json file');\n });\n return response.data;\n }\n\n private async fetchWithRetry(input: RequestInfo, options: RequestInit, retries: number = 3) {\n let error: Error | undefined;\n for (let i = 0; i < retries; i++) {\n try {\n await this.authenticationPromise;\n\n const response = await fetch(input, options);\n\n // Authentication error\n if (response.status === 401) {\n this.authenticationPromise = this.client.authenticate();\n continue;\n }\n\n return response;\n } catch (err) {\n // Keep first error only\n if (error !== undefined) {\n error = err as Error;\n }\n }\n }\n throw error;\n }\n}\n","/*!\n * Copyright 2021 Cognite AS\n */\nimport { ModelIdentifier } from '..';\n\n/**\n * Identifies a 3D model stored in CDF by the combination of a modelId, a revisionId\n * and a format.\n */\nexport class CdfModelIdentifier implements ModelIdentifier {\n readonly revealInternalId: symbol;\n\n readonly modelId: number;\n readonly revisionId: number;\n\n constructor(modelId: number, revisionId: number) {\n this.revealInternalId = Symbol(`${modelId}/${revisionId}`);\n this.modelId = modelId;\n this.revisionId = revisionId;\n }\n\n public toString(): string {\n return `${CdfModelIdentifier.name} (${String(this.revealInternalId)})`;\n }\n}\n","/*!\n * Copyright 2021 Cognite AS\n */\n\nexport interface JsonFileProvider {\n getJsonFile(baseUrl: string, fileName: string): Promise<any>;\n}\n\nexport interface BinaryFileProvider {\n getBinaryFile(baseUrl: string, fileName: string): Promise<ArrayBuffer>;\n}\n\n/**\n * Provides data for 3D models.\n */\nexport interface ModelDataProvider extends JsonFileProvider, BinaryFileProvider {\n /**\n * Download and parse a JSON file and return the resulting struct.\n * @param baseUrl Base URL of the model.\n * @param fileName Filename of JSON file.\n */\n getJsonFile(baseUrl: string, fileName: string): Promise<any>;\n /**\n * Downloads a binary blob.\n * @param baseUrl Base URL of the model.\n * @param fileName Filename of binary file.\n */\n getBinaryFile(baseUrl: string, fileName: string): Promise<ArrayBuffer>;\n}\n\nexport enum File3dFormat {\n EptPointCloud = 'ept-pointcloud',\n /**\n * V8 models only due to bug for version checks in Reveal <3.0\n */\n RevealCadModel = 'reveal-directory',\n /**\n * Reveal v9 and above (GLTF based output)\n */\n GltfCadModel = 'gltf-directory',\n AnyFormat = 'all-outputs'\n}\n\nexport interface BlobOutputMetadata {\n blobId: number;\n format: File3dFormat | string;\n version: number;\n}\n","/*!\n * Copyright 2021 Cognite AS\n */\n\nimport * as THREE from 'three';\n\nimport { File3dFormat } from './types';\n\n// The below is equal to new THREE.Matrix4().makeRotationFromEuler(new THREE.Euler(-Math.PI / 2, 0, 0));\nconst cadFromCdfToThreeMatrix = new THREE.Matrix4().set(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1);\n\nexport function applyDefaultModelTransformation(matrix: THREE.Matrix4, format: File3dFormat | string): void {\n switch (format) {\n case File3dFormat.RevealCadModel:\n case File3dFormat.GltfCadModel:\n case File3dFormat.EptPointCloud:\n matrix.premultiply(cadFromCdfToThreeMatrix);\n break;\n\n default:\n throw new Error(`Unknown model format '${format}`);\n }\n}\n","/*!\n * Copyright 2021 Cognite AS\n */\nimport * as THREE from 'three';\nimport { BlobOutputMetadata, File3dFormat } from './types';\nimport { ModelMetadataProvider } from './ModelMetadataProvider';\n\nimport { applyDefaultModelTransformation } from './applyDefaultModelTransformation';\n\nimport { CogniteClient } from '@cognite/sdk';\nimport { ItemsResponse } from '@cognite/sdk-core';\nimport { ModelIdentifier } from './ModelIdentifier';\nimport { CdfModelIdentifier } from './CdfModelIdentifier';\n\n// TODO 2020-06-25 larsmoa: Extend CogniteClient.files3d.retrieve() to support subpath instead of\n// using URLs directly. Also add support for listing outputs in the SDK.\nexport class CdfModelMetadataProvider implements ModelMetadataProvider {\n private readonly _client: CogniteClient;\n\n constructor(client: CogniteClient) {\n this._client = client;\n }\n\n public async getModelMatrix(modelIdentifier: ModelIdentifier, format: File3dFormat): Promise<THREE.Matrix4> {\n if (!(modelIdentifier instanceof CdfModelIdentifier)) {\n throw new Error(`Model must be a ${CdfModelIdentifier.name}, but got ${modelIdentifier.toString()}`);\n }\n\n const { modelId, revisionId } = modelIdentifier;\n const model = await this._client.revisions3D.retrieve(modelId, revisionId);\n\n const modelMatrix = new THREE.Matrix4();\n if (model.rotation) {\n modelMatrix.makeRotationFromEuler(new THREE.Euler(...model.rotation));\n }\n applyDefaultModelTransformation(modelMatrix, format);\n return modelMatrix;\n }\n\n public async getModelCamera(\n modelIdentifier: ModelIdentifier\n ): Promise<{ position: THREE.Vector3; target: THREE.Vector3 } | undefined> {\n if (!(modelIdentifier instanceof CdfModelIdentifier)) {\n throw new Error(`Model must be a ${CdfModelIdentifier.name}, but got ${modelIdentifier.toString()}`);\n }\n\n const { modelId, revisionId } = modelIdentifier;\n const model = await this._client.revisions3D.retrieve(modelId, revisionId);\n if (model.camera && model.camera.position && model.camera.target) {\n const { position, target } = model.camera;\n return {\n position: new THREE.Vector3(position[0], position[1], position[2]),\n target: new THREE.Vector3(target[0], target[1], target[2])\n };\n }\n return undefined;\n }\n\n public async getModelUri(modelIdentifier: ModelIdentifier, formatMetadata: BlobOutputMetadata): Promise<string> {\n if (!(modelIdentifier instanceof CdfModelIdentifier)) {\n throw new Error(`Model must be a ${CdfModelIdentifier.name}, but got ${modelIdentifier.toString()}`);\n }\n return `${this._client.getBaseUrl()}${this.getRequestPath(formatMetadata.blobId)}`;\n }\n\n public async getModelOutputs(modelIdentifier: ModelIdentifier): Promise<BlobOutputMetadata[]> {\n if (!(modelIdentifier instanceof CdfModelIdentifier)) {\n throw new Error(`Model must be a ${CdfModelIdentifier.name}, but got ${modelIdentifier.toString()}`);\n }\n\n const { modelId, revisionId } = modelIdentifier;\n\n const url = `/api/v1/projects/${this._client.project}/3d/models/${modelId}/revisions/${revisionId}/outputs`;\n\n const response = await this._client.get<ItemsResponse<BlobOutputMetadata>>(url, {\n params: { format: File3dFormat.AnyFormat }\n });\n\n if (response.status === 200) {\n return response.data.items.filter(output => Object.values<string>(File3dFormat).includes(output.format));\n }\n\n throw new Error(`Unexpected response ${response.status} (payload: '${response.data})`);\n }\n\n private getRequestPath(directoryId: number): string {\n return `/api/v1/projects/${this._client.project}/3d/files/${directoryId}`;\n }\n}\n","/*!\n * Copyright 2021 Cognite AS\n */\n\nimport { Versioned3DFile } from '@cognite/sdk';\n\n// To avoid direct dependency on @cognite/sdk we use sdk-core here for HttpError.\n// that's why it's avoided https://github.com/cognitedata/cdf-hub/pull/687/files#r489204315\nimport { HttpError } from '@cognite/sdk-core';\n\nexport const supportedVersions = [8];\n\nexport function getNewestVersionedFile(files: Versioned3DFile[]): Versioned3DFile {\n return files\n .filter(file => supportedVersions.includes(file.version))\n .reduce((newestFile, file) => (file.version > newestFile.version ? file : newestFile), {\n fileId: -1,\n version: -1\n });\n}\n\nexport async function fetchWithStatusCheck(url: string): Promise<Response> {\n const response = await fetch(url);\n if (!response.ok) {\n const headers: { [key: string]: string } = {};\n response.headers.forEach((key, value) => {\n headers[key] = value;\n });\n throw new HttpError(response.status, response.body, headers);\n }\n return response;\n}\n","/*!\n * Copyright 2021 Cognite AS\n */\n\nimport { ModelDataProvider } from './types';\nimport { fetchWithStatusCheck } from './utilities';\n\nexport class LocalModelDataProvider implements ModelDataProvider {\n async getBinaryFile(baseUrl: string, fileName: string): Promise<ArrayBuffer> {\n const response = await fetchWithStatusCheck(`${baseUrl}/${fileName}`);\n return response.arrayBuffer();\n }\n\n async getJsonFile(baseUrl: string, fileName: string): Promise<any> {\n const response = await fetchWithStatusCheck(`${baseUrl}/${fileName}`);\n return response.json();\n }\n}\n","/*!\n * Copyright 2021 Cognite AS\n */\n\nimport { ModelIdentifier } from './ModelIdentifier';\n\n/**\n * Identifies a 3D model by a URL. This implementation is used for testing\n * purposes.\n */\nexport class LocalModelIdentifier implements ModelIdentifier {\n readonly revealInternalId: symbol;\n readonly localPath: string;\n\n constructor(localPath: string) {\n this.revealInternalId = Symbol(localPath);\n this.localPath = localPath;\n }\n\n public toString(): string {\n return `${LocalModelIdentifier.name} (${this.localPath})`;\n }\n}\n","/*!\n * Copyright 2021 Cognite AS\n */\nimport * as THREE from 'three';\n\nimport { applyDefaultModelTransformation } from './applyDefaultModelTransformation';\nimport { LocalModelIdentifier } from './LocalModelIdentifier';\nimport { ModelIdentifier } from './ModelIdentifier';\nimport { ModelMetadataProvider } from './ModelMetadataProvider';\nimport { BlobOutputMetadata, File3dFormat } from './types';\nimport { fetchWithStatusCheck } from './utilities';\n\nexport class LocalModelMetadataProvider implements ModelMetadataProvider {\n getModelUri(modelIdentifier: ModelIdentifier): Promise<string> {\n if (!(modelIdentifier instanceof LocalModelIdentifier)) {\n throw new Error(`Model must be a ${LocalModelIdentifier.name}, but got ${modelIdentifier.toString()}`);\n }\n if (modelIdentifier.localPath.startsWith('http')) {\n return Promise.resolve(modelIdentifier.localPath);\n }\n return Promise.resolve(`${location.origin}/${modelIdentifier.localPath}`);\n }\n\n async getModelMatrix(modelIdentifier: ModelIdentifier, format: File3dFormat): Promise<THREE.Matrix4> {\n if (!(modelIdentifier instanceof LocalModelIdentifier)) {\n throw new Error(`Model must be a ${LocalModelIdentifier.name}, but got ${modelIdentifier.toString()}`);\n }\n\n const matrix = new THREE.Matrix4();\n applyDefaultModelTransformation(matrix, format);\n return matrix;\n }\n\n getModelCamera(\n modelIdentifier: ModelIdentifier\n ): Promise<{ position: THREE.Vector3; target: THREE.Vector3 } | undefined> {\n if (!(modelIdentifier instanceof LocalModelIdentifier)) {\n throw new Error(`Model must be a ${LocalModelIdentifier.name}, but got ${modelIdentifier.toString()}`);\n }\n\n return Promise.resolve(undefined);\n }\n\n async getModelOutputs(modelIdentifier: ModelIdentifier): Promise<BlobOutputMetadata[]> {\n const modelUri = await this.getModelUri(modelIdentifier);\n\n const output = (await getCadOutput(modelUri)) ?? (await getPointCloudOutput(modelUri));\n\n if (output) {\n return [output];\n }\n\n throw new Error(`Only point cloud or CAD models (version 8 and 9) are supported)`);\n\n async function getCadOutput(modelUri: string): Promise<BlobOutputMetadata | undefined> {\n let version: number;\n\n try {\n version = (await (await fetchWithStatusCheck(modelUri + '/scene.json')).json()).version;\n } catch (error) {\n return undefined;\n }\n switch (version) {\n case 8:\n return Promise.resolve({\n blobId: -1,\n format: File3dFormat.RevealCadModel,\n version: 8\n });\n case 9:\n return Promise.resolve({\n blobId: -1,\n format: File3dFormat.GltfCadModel,\n version: 9\n });\n default:\n return undefined;\n }\n }\n\n async function getPointCloudOutput(modelUri: string): Promise<BlobOutputMetadata | undefined> {\n let scene: any;\n\n try {\n scene = await (await fetchWithStatusCheck(modelUri + '/ept.json')).json();\n } catch (error) {\n return undefined;\n }\n\n if (scene) {\n return Promise.resolve({\n blobId: -1,\n format: File3dFormat.EptPointCloud,\n version: -1\n });\n } else {\n return undefined;\n }\n }\n }\n}\n","/*!\n * Copyright 2021 Cognite AS\n */\n\n/**\n * @module @cognite/reveal/extensions/datasource\n */\n\nexport { DataSource } from '../packages/data-source';\nexport { NodesApiClient } from '../packages/nodes-api';\nexport {\n ModelIdentifier,\n CdfModelIdentifier,\n ModelMetadataProvider,\n ModelDataProvider,\n BlobOutputMetadata,\n File3dFormat\n} from '../packages/modeldata-api';\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"extensions/datasource.js","mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAQ,mBAAqBD,IAE7BD,EAAK,mBAAqBC,IAR5B,CASoB,oBAATK,KAAuBA,KAAOC,MAAO,uBCRhD,IAAIC,EAAsB,CCA1BA,EAAwB,CAACN,EAASO,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAET,EAASQ,IAC5EE,OAAOC,eAAeX,EAASQ,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBN,IACH,oBAAXmB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeX,EAASmB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeX,EAAS,aAAc,CAAEqB,OAAO,uECIhD,MAAM,EAMXC,YAAYC,EAAiBC,GAC3BnB,KAAKoB,iBAAmBN,OAAO,GAAGI,KAAWC,KAC7CnB,KAAKkB,QAAUA,EACflB,KAAKmB,WAAaA,EAGbE,WACL,MAAO,GAAG,EAAmBC,SAASC,OAAOvB,KAAKoB,sBCtBtD,MAAM,EAA+BI,QAAQ,SC8B7C,IAAY,EAAAC,SAAAA,EAAA,MAAY,KACtB,+BAIA,oCAIA,gCACA,2BC/B8B,IAAI,WAAgBC,IAAI,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,GAAI,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,GCTjEF,QAAQ","sources":["webpack://@cognite/reveal/webpack/universalModuleDefinition","webpack://@cognite/reveal/webpack/bootstrap","webpack://@cognite/reveal/webpack/runtime/define property getters","webpack://@cognite/reveal/webpack/runtime/hasOwnProperty shorthand","webpack://@cognite/reveal/webpack/runtime/make namespace object","webpack://@cognite/reveal/./packages/modeldata-api/src/CdfModelIdentifier.ts","webpack://@cognite/reveal/external commonjs \"three\"","webpack://@cognite/reveal/./packages/modeldata-api/src/types.ts","webpack://@cognite/reveal/./packages/modeldata-api/src/applyDefaultModelTransformation.ts","webpack://@cognite/reveal/external commonjs \"@cognite/sdk-core\""],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@cognite/reveal\"] = factory();\n\telse\n\t\troot[\"@cognite/reveal\"] = factory();\n})((typeof self !== 'undefined' ? self : this), () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/*!\n * Copyright 2021 Cognite AS\n */\nimport { ModelIdentifier } from '..';\n\n/**\n * Identifies a 3D model stored in CDF by the combination of a modelId, a revisionId\n * and a format.\n */\nexport class CdfModelIdentifier implements ModelIdentifier {\n readonly revealInternalId: symbol;\n\n readonly modelId: number;\n readonly revisionId: number;\n\n constructor(modelId: number, revisionId: number) {\n this.revealInternalId = Symbol(`${modelId}/${revisionId}`);\n this.modelId = modelId;\n this.revisionId = revisionId;\n }\n\n public toString(): string {\n return `${CdfModelIdentifier.name} (${String(this.revealInternalId)})`;\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"three\");","/*!\n * Copyright 2021 Cognite AS\n */\n\nexport interface JsonFileProvider {\n getJsonFile(baseUrl: string, fileName: string): Promise<any>;\n}\n\nexport interface BinaryFileProvider {\n getBinaryFile(baseUrl: string, fileName: string): Promise<ArrayBuffer>;\n}\n\n/**\n * Provides data for 3D models.\n */\nexport interface ModelDataProvider extends JsonFileProvider, BinaryFileProvider {\n /**\n * Download and parse a JSON file and return the resulting struct.\n * @param baseUrl Base URL of the model.\n * @param fileName Filename of JSON file.\n */\n getJsonFile(baseUrl: string, fileName: string): Promise<any>;\n /**\n * Downloads a binary blob.\n * @param baseUrl Base URL of the model.\n * @param fileName Filename of binary file.\n */\n getBinaryFile(baseUrl: string, fileName: string): Promise<ArrayBuffer>;\n}\n\nexport enum File3dFormat {\n EptPointCloud = 'ept-pointcloud',\n /**\n * V8 models only due to bug for version checks in Reveal <3.0\n */\n RevealCadModel = 'reveal-directory',\n /**\n * Reveal v9 and above (GLTF based output)\n */\n GltfCadModel = 'gltf-directory',\n AnyFormat = 'all-outputs'\n}\n\nexport interface BlobOutputMetadata {\n blobId: number;\n format: File3dFormat | string;\n version: number;\n}\n","/*!\n * Copyright 2021 Cognite AS\n */\n\nimport * as THREE from 'three';\n\nimport { File3dFormat } from './types';\n\n// The below is equal to new THREE.Matrix4().makeRotationFromEuler(new THREE.Euler(-Math.PI / 2, 0, 0));\nconst cadFromCdfToThreeMatrix = new THREE.Matrix4().set(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1);\n\nexport function applyDefaultModelTransformation(matrix: THREE.Matrix4, format: File3dFormat | string): void {\n switch (format) {\n case File3dFormat.RevealCadModel:\n case File3dFormat.GltfCadModel:\n case File3dFormat.EptPointCloud:\n matrix.premultiply(cadFromCdfToThreeMatrix);\n break;\n\n default:\n throw new Error(`Unknown model format '${format}`);\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@cognite/sdk-core\");"],"names":["root","factory","exports","module","define","amd","self","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","constructor","modelId","revisionId","revealInternalId","toString","name","String","require","File3dFormat","set"],"sourceRoot":""}
|
package/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2021 Cognite AS
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* @module @cognite/reveal
|
|
6
|
-
*/
|
|
7
|
-
export * from './
|
|
8
|
-
export { CameraControlsOptions, DefaultCameraManager, CameraManagerHelper, CameraManager, CameraState, ComboControls, CameraChangeDelegate } from './packages/camera-manager';
|
|
9
|
-
export { AreaCollection, ClusteredAreaCollection, NodeAppearanceProvider, NodeAppearance, NodeOutlineColor, DefaultNodeAppearance, NodeCollection, TreeIndexNodeCollection, IntersectionNodeCollection, UnionNodeCollection, SerializedNodeCollection, PropertyFilterNodeCollection, SinglePropertyFilterNodeCollection, AssetNodeCollection, InvertedNodeCollection, registerCustomNodeCollectionType, TypeName, NodeCollectionDescriptor, NodeCollectionSerializationContext, CdfModelNodeCollectionDataProvider } from './packages/cad-styling';
|
|
10
|
-
export { CogniteModelBase, SupportedModelTypes } from './packages/model-base';
|
|
11
|
-
export { revealEnv, IndexSet, NumericRange, SceneRenderedDelegate, PointerEventDelegate, DisposedDelegate } from './packages/utilities';
|
|
12
|
-
export { Cognite3DModel, BoundingBoxClipper, GeometryFilter, WellKnownUnit } from './packages/cad-model';
|
|
13
|
-
export { CognitePointCloudModel } from './packages/pointclouds';
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @module @cognite/reveal
|
|
6
|
+
*/
|
|
7
|
+
export * from './packages/api/';
|
|
8
|
+
export { CameraControlsOptions, DefaultCameraManager, CameraManagerHelper, CameraManager, CameraState, ComboControls, CameraChangeDelegate } from './packages/camera-manager';
|
|
9
|
+
export { AreaCollection, ClusteredAreaCollection, NodeAppearanceProvider, NodeAppearance, NodeOutlineColor, DefaultNodeAppearance, NodeCollection, TreeIndexNodeCollection, IntersectionNodeCollection, UnionNodeCollection, SerializedNodeCollection, PropertyFilterNodeCollection, SinglePropertyFilterNodeCollection, AssetNodeCollection, InvertedNodeCollection, registerCustomNodeCollectionType, TypeName, NodeCollectionDescriptor, NodeCollectionSerializationContext, CdfModelNodeCollectionDataProvider } from './packages/cad-styling';
|
|
10
|
+
export { CogniteModelBase, SupportedModelTypes } from './packages/model-base';
|
|
11
|
+
export { revealEnv, IndexSet, NumericRange, SceneRenderedDelegate, PointerEventDelegate, DisposedDelegate } from './packages/utilities';
|
|
12
|
+
export { Cognite3DModel, BoundingBoxClipper, GeometryFilter, WellKnownUnit } from './packages/cad-model';
|
|
13
|
+
export { CognitePointCloudModel } from './packages/pointclouds';
|