@itwin/core-frontend 5.0.0-dev.70 → 5.0.0-dev.73
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.
|
@@ -102,7 +102,7 @@ class MeshBuilderMap extends core_bentley_1.Dictionary {
|
|
|
102
102
|
const { displayParams, isDisjoint, isPlanar, strokes } = strokePrimitive;
|
|
103
103
|
const type = isDisjoint ? MeshPrimitive_1.MeshPrimitiveType.Point : MeshPrimitive_1.MeshPrimitiveType.Polyline;
|
|
104
104
|
const builder = this.getBuilder(displayParams, type, false, isPlanar);
|
|
105
|
-
builder.addStrokePointLists(strokes, isDisjoint, displayParams.
|
|
105
|
+
builder.addStrokePointLists(strokes, isDisjoint, displayParams.lineColor.tbgr, feature);
|
|
106
106
|
}
|
|
107
107
|
getBuilder(displayParams, type, hasNormals, isPlanar) {
|
|
108
108
|
const { facetAreaTolerance, tolerance, is2d, range } = this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeshBuilderMap.js","sourceRoot":"","sources":["../../../../../src/common/internal/render/MeshBuilderMap.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA8F;AAE9F,oDAA2D;AAE3D,mDAAoD;AAIpD,6CAA+D;AAE/D,+CAAqE;AACrE,qDAAkD;AAElD,gBAAgB;AAChB,MAAa,cAAe,SAAQ,yBAA2C;IAC7D,KAAK,CAAU;IACf,eAAe,CAAS;IACxB,kBAAkB,CAAS;IAC3B,SAAS,CAAS;IAClB,IAAI,CAAU;IACd,QAAQ,CAAgB;IACxB,OAAO,CAAkB;IACxB,mBAAmB,CAAU;IACtC,SAAS,GAAG,CAAC,CAAC;IAEtB,YAAY,SAAiB,EAAE,KAAc,EAAE,IAAa,EAAE,OAAwB,EAAE,QAA4E;QAClK,KAAK,CAAC,CAAC,GAAuB,EAAE,GAAuB,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,C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AAc,CAAC,IAAU;YACrC,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1F,CAAC;QAEM,OAAO,CAAC,GAAQ;YACrB,IAAI,IAAI,GAAG,IAAA,6BAAc,EAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;YACjD,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;gBACf,IAAI,GAAG,IAAA,6BAAc,EAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC3C,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;oBACf,IAAI,GAAG,IAAA,8BAAe,EAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;oBACpD,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;wBACf,IAAI,GAAG,IAAA,8BAAe,EAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;wBACxD,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;4BACf,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;wBACjD,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QAEM,MAAM,CAAC,GAAQ,IAAa,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACrE;IArCY,kBAAG,MAqCf,CAAA;AACH,CAAC,EAvCgB,cAAc,8BAAd,cAAc,QAuC9B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { compareBooleans, compareNumbers, Dictionary, Id64String } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { Feature, FeatureTable } from \"@itwin/core-common\";\nimport { DisplayParams } from \"./DisplayParams\";\nimport { MeshPrimitiveType } from \"./MeshPrimitive\";\nimport { GeometryList } from \"./GeometryList\";\nimport { Geometry } from \"./GeometryPrimitives\";\nimport { PolyfacePrimitive } from \"./Polyface\";\nimport { GeometryOptions, ToleranceRatio } from \"./Primitives\";\nimport { StrokesPrimitive } from \"./Strokes\";\nimport { MeshBuilder, MeshEdgeCreationOptions } from \"./MeshBuilder\";\nimport { Mesh, MeshList } from \"./MeshPrimitives\";\n\n/** @internal */\nexport class MeshBuilderMap extends Dictionary<MeshBuilderMap.Key, MeshBuilder> {\n public readonly range: Range3d;\n public readonly vertexTolerance: number;\n public readonly facetAreaTolerance: number;\n public readonly tolerance: number;\n public readonly is2d: boolean;\n public readonly features?: FeatureTable;\n public readonly options: GeometryOptions;\n private readonly _isVolumeClassifier: boolean;\n private _keyOrder = 0;\n\n constructor(tolerance: number, range: Range3d, is2d: boolean, options: GeometryOptions, pickable: { isVolumeClassifier?: boolean, modelId?: Id64String } | undefined) {\n super((lhs: MeshBuilderMap.Key, rhs: MeshBuilderMap.Key) => lhs.compare(rhs));\n this.tolerance = tolerance;\n this.vertexTolerance = tolerance * ToleranceRatio.vertex;\n this.facetAreaTolerance = tolerance * ToleranceRatio.facetArea;\n this.range = range;\n this.is2d = is2d;\n this.options = options;\n this._isVolumeClassifier = pickable?.isVolumeClassifier ?? false;\n\n if (pickable)\n this.features = new FeatureTable(2048 * 1024, pickable.modelId);\n }\n\n public static createFromGeometries(geometries: GeometryList, tolerance: number, range: Range3d, is2d: boolean, options: GeometryOptions, pickable: { isVolumeClassifier?: boolean, modelId?: Id64String } | undefined): MeshBuilderMap {\n const map = new MeshBuilderMap(tolerance, range, is2d, options, pickable);\n\n for (const geom of geometries)\n map.loadGeometry(geom);\n\n return map;\n }\n\n public toMeshes(): MeshList {\n const meshes = new MeshList(this.features, this.range);\n for (const builder of this._values) {\n if (builder.mesh.points.length > 0)\n meshes.push(builder.mesh);\n }\n return meshes;\n }\n\n /**\n * extract polyfaces and strokes from geometry into MeshBuilder stored in builderMap\n * @param geom Geometry instance to extract polyfaces and strokes from\n */\n public loadGeometry(geom: Geometry): void {\n this.loadPolyfacePrimitiveList(geom);\n this.loadStrokePrimitiveList(geom);\n }\n\n /**\n * extract polyface primitives from geometry in meshBuilder stored in builderMap\n * @param geom Geometry instance to extract polyfaces from\n */\n public loadPolyfacePrimitiveList(geom: Geometry): void {\n const polyfaces = geom.getPolyfaces(this.tolerance);\n\n if (polyfaces !== undefined)\n for (const polyface of polyfaces)\n this.loadIndexedPolyface(polyface, geom.feature);\n }\n\n /**\n * extract indexed polyfaces into meshBuilder stored in builderMap\n * @param polyface PolyfacePrimitive to extract indexed polyfaces from\n */\n public loadIndexedPolyface(polyface: PolyfacePrimitive, feature: Feature | undefined): void {\n const { indexedPolyface, displayParams, isPlanar } = polyface;\n const { pointCount, normalCount } = indexedPolyface;\n const { fillColor, isTextured } = displayParams;\n const textureMapping = displayParams.textureMapping;\n\n if (pointCount === 0)\n return;\n\n const builder = this.getBuilder(displayParams, MeshPrimitiveType.Mesh, normalCount > 0, isPlanar);\n const edgeOptions = new MeshEdgeCreationOptions(polyface.displayEdges && this.options.wantEdges ? MeshEdgeCreationOptions.Type.DefaultEdges : MeshEdgeCreationOptions.Type.NoEdges);\n builder.addFromPolyface(indexedPolyface, { edgeOptions, includeParams: isTextured, fillColor: fillColor.tbgr, mappedTexture: textureMapping }, feature);\n }\n\n /**\n * extract stroke primitives from geometry in meshBuilder stored in builderMap\n * @param geom Geometry instance to extract strokes from\n */\n public loadStrokePrimitiveList(geom: Geometry): void {\n const strokes = geom.getStrokes(this.tolerance);\n\n if (undefined !== strokes)\n for (const stroke of strokes)\n this.loadStrokesPrimitive(stroke, geom.feature);\n }\n\n /**\n * extract strokes primitive into meshBuilder stored in builderMap\n * @param strokePrimitive StrokesPrimitive instance to extractfrom\n */\n public loadStrokesPrimitive(strokePrimitive: StrokesPrimitive, feature: Feature | undefined): void {\n const { displayParams, isDisjoint, isPlanar, strokes } = strokePrimitive;\n\n const type = isDisjoint ? MeshPrimitiveType.Point : MeshPrimitiveType.Polyline;\n const builder = this.getBuilder(displayParams, type, false, isPlanar);\n builder.addStrokePointLists(strokes, isDisjoint, displayParams.fillColor.tbgr, feature);\n }\n\n public getBuilder(displayParams: DisplayParams, type: MeshPrimitiveType, hasNormals: boolean, isPlanar: boolean): MeshBuilder {\n const { facetAreaTolerance, tolerance, is2d, range } = this;\n const key = this.getKey(displayParams, type, hasNormals, isPlanar);\n\n const quantizePositions = false; // ###TODO should this be configurable?\n return this.getBuilderFromKey(key, {\n displayParams,\n type,\n range,\n quantizePositions,\n is2d,\n isPlanar,\n tolerance,\n areaTolerance: facetAreaTolerance,\n features: this.features,\n isVolumeClassifier: this._isVolumeClassifier,\n });\n }\n\n public getKey(displayParams: DisplayParams, type: MeshPrimitiveType, hasNormals: boolean, isPlanar: boolean): MeshBuilderMap.Key {\n const key = new MeshBuilderMap.Key(displayParams, type, hasNormals, isPlanar);\n\n if (this.options.preserveOrder)\n key.order = ++this._keyOrder;\n\n return key;\n }\n\n /**\n * gets builder associated with key if defined, otherwise creates a new builder and sets that with key\n * @param key MeshBuilderMap.Key to associate with builder\n * @param props MeshBuilder.Props required to create builder if it does not already exist\n * @returns builder reference, changes will update instance stored in builderMap\n */\n public getBuilderFromKey(key: MeshBuilderMap.Key, props: MeshBuilder.Props): MeshBuilder {\n let builder = this.get(key);\n if (undefined === builder) {\n builder = MeshBuilder.create(props);\n this.set(key, builder);\n }\n return builder;\n }\n}\n\n/** @internal */\nexport namespace MeshBuilderMap {\n export class Key {\n public order: number = 0;\n public readonly params: DisplayParams;\n public readonly type: MeshPrimitiveType;\n public readonly hasNormals: boolean;\n public readonly isPlanar: boolean;\n\n constructor(params: DisplayParams, type: MeshPrimitiveType, hasNormals: boolean, isPlanar: boolean) {\n this.params = params;\n this.type = type;\n this.hasNormals = hasNormals;\n this.isPlanar = isPlanar;\n }\n\n public static createFromMesh(mesh: Mesh): Key {\n return new Key(mesh.displayParams, mesh.type, mesh.normals.length !== 0, mesh.isPlanar);\n }\n\n public compare(rhs: Key): number {\n let diff = compareNumbers(this.order, rhs.order);\n if (0 === diff) {\n diff = compareNumbers(this.type, rhs.type);\n if (0 === diff) {\n diff = compareBooleans(this.isPlanar, rhs.isPlanar);\n if (0 === diff) {\n diff = compareBooleans(this.hasNormals, rhs.hasNormals);\n if (0 === diff) {\n diff = this.params.compareForMerge(rhs.params);\n }\n }\n }\n }\n\n return diff;\n }\n\n public equals(rhs: Key): boolean { return 0 === this.compare(rhs); }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MeshBuilderMap.js","sourceRoot":"","sources":["../../../../../src/common/internal/render/MeshBuilderMap.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA8F;AAE9F,oDAA2D;AAE3D,mDAAoD;AAIpD,6CAA+D;AAE/D,+CAAqE;AACrE,qDAAkD;AAElD,gBAAgB;AAChB,MAAa,cAAe,SAAQ,yBAA2C;IAC7D,KAAK,CAAU;IACf,eAAe,CAAS;IACxB,kBAAkB,CAAS;IAC3B,SAAS,CAAS;IAClB,IAAI,CAAU;IACd,QAAQ,CAAgB;IACxB,OAAO,CAAkB;IACxB,mBAAmB,CAAU;IACtC,SAAS,GAAG,CAAC,CAAC;IAEtB,YAAY,SAAiB,EAAE,KAAc,EAAE,IAAa,EAAE,OAAwB,EAAE,QAA4E;QAClK,KAAK,CAAC,CAAC,GAAuB,EAAE,GAAuB,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9E,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC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AAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1F,CAAC;QAEM,OAAO,CAAC,GAAQ;YACrB,IAAI,IAAI,GAAG,IAAA,6BAAc,EAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;YACjD,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;gBACf,IAAI,GAAG,IAAA,6BAAc,EAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC3C,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;oBACf,IAAI,GAAG,IAAA,8BAAe,EAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;oBACpD,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;wBACf,IAAI,GAAG,IAAA,8BAAe,EAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;wBACxD,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;4BACf,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;wBACjD,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QAEM,MAAM,CAAC,GAAQ,IAAa,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACrE;IArCY,kBAAG,MAqCf,CAAA;AACH,CAAC,EAvCgB,cAAc,8BAAd,cAAc,QAuC9B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { compareBooleans, compareNumbers, Dictionary, Id64String } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { Feature, FeatureTable } from \"@itwin/core-common\";\nimport { DisplayParams } from \"./DisplayParams\";\nimport { MeshPrimitiveType } from \"./MeshPrimitive\";\nimport { GeometryList } from \"./GeometryList\";\nimport { Geometry } from \"./GeometryPrimitives\";\nimport { PolyfacePrimitive } from \"./Polyface\";\nimport { GeometryOptions, ToleranceRatio } from \"./Primitives\";\nimport { StrokesPrimitive } from \"./Strokes\";\nimport { MeshBuilder, MeshEdgeCreationOptions } from \"./MeshBuilder\";\nimport { Mesh, MeshList } from \"./MeshPrimitives\";\n\n/** @internal */\nexport class MeshBuilderMap extends Dictionary<MeshBuilderMap.Key, MeshBuilder> {\n public readonly range: Range3d;\n public readonly vertexTolerance: number;\n public readonly facetAreaTolerance: number;\n public readonly tolerance: number;\n public readonly is2d: boolean;\n public readonly features?: FeatureTable;\n public readonly options: GeometryOptions;\n private readonly _isVolumeClassifier: boolean;\n private _keyOrder = 0;\n\n constructor(tolerance: number, range: Range3d, is2d: boolean, options: GeometryOptions, pickable: { isVolumeClassifier?: boolean, modelId?: Id64String } | undefined) {\n super((lhs: MeshBuilderMap.Key, rhs: MeshBuilderMap.Key) => lhs.compare(rhs));\n this.tolerance = tolerance;\n this.vertexTolerance = tolerance * ToleranceRatio.vertex;\n this.facetAreaTolerance = tolerance * ToleranceRatio.facetArea;\n this.range = range;\n this.is2d = is2d;\n this.options = options;\n this._isVolumeClassifier = pickable?.isVolumeClassifier ?? false;\n\n if (pickable)\n this.features = new FeatureTable(2048 * 1024, pickable.modelId);\n }\n\n public static createFromGeometries(geometries: GeometryList, tolerance: number, range: Range3d, is2d: boolean, options: GeometryOptions, pickable: { isVolumeClassifier?: boolean, modelId?: Id64String } | undefined): MeshBuilderMap {\n const map = new MeshBuilderMap(tolerance, range, is2d, options, pickable);\n\n for (const geom of geometries)\n map.loadGeometry(geom);\n\n return map;\n }\n\n public toMeshes(): MeshList {\n const meshes = new MeshList(this.features, this.range);\n for (const builder of this._values) {\n if (builder.mesh.points.length > 0)\n meshes.push(builder.mesh);\n }\n return meshes;\n }\n\n /**\n * extract polyfaces and strokes from geometry into MeshBuilder stored in builderMap\n * @param geom Geometry instance to extract polyfaces and strokes from\n */\n public loadGeometry(geom: Geometry): void {\n this.loadPolyfacePrimitiveList(geom);\n this.loadStrokePrimitiveList(geom);\n }\n\n /**\n * extract polyface primitives from geometry in meshBuilder stored in builderMap\n * @param geom Geometry instance to extract polyfaces from\n */\n public loadPolyfacePrimitiveList(geom: Geometry): void {\n const polyfaces = geom.getPolyfaces(this.tolerance);\n\n if (polyfaces !== undefined)\n for (const polyface of polyfaces)\n this.loadIndexedPolyface(polyface, geom.feature);\n }\n\n /**\n * extract indexed polyfaces into meshBuilder stored in builderMap\n * @param polyface PolyfacePrimitive to extract indexed polyfaces from\n */\n public loadIndexedPolyface(polyface: PolyfacePrimitive, feature: Feature | undefined): void {\n const { indexedPolyface, displayParams, isPlanar } = polyface;\n const { pointCount, normalCount } = indexedPolyface;\n const { fillColor, isTextured } = displayParams;\n const textureMapping = displayParams.textureMapping;\n\n if (pointCount === 0)\n return;\n\n const builder = this.getBuilder(displayParams, MeshPrimitiveType.Mesh, normalCount > 0, isPlanar);\n const edgeOptions = new MeshEdgeCreationOptions(polyface.displayEdges && this.options.wantEdges ? MeshEdgeCreationOptions.Type.DefaultEdges : MeshEdgeCreationOptions.Type.NoEdges);\n builder.addFromPolyface(indexedPolyface, { edgeOptions, includeParams: isTextured, fillColor: fillColor.tbgr, mappedTexture: textureMapping }, feature);\n }\n\n /**\n * extract stroke primitives from geometry in meshBuilder stored in builderMap\n * @param geom Geometry instance to extract strokes from\n */\n public loadStrokePrimitiveList(geom: Geometry): void {\n const strokes = geom.getStrokes(this.tolerance);\n\n if (undefined !== strokes)\n for (const stroke of strokes)\n this.loadStrokesPrimitive(stroke, geom.feature);\n }\n\n /**\n * extract strokes primitive into meshBuilder stored in builderMap\n * @param strokePrimitive StrokesPrimitive instance to extractfrom\n */\n public loadStrokesPrimitive(strokePrimitive: StrokesPrimitive, feature: Feature | undefined): void {\n const { displayParams, isDisjoint, isPlanar, strokes } = strokePrimitive;\n\n const type = isDisjoint ? MeshPrimitiveType.Point : MeshPrimitiveType.Polyline;\n const builder = this.getBuilder(displayParams, type, false, isPlanar);\n builder.addStrokePointLists(strokes, isDisjoint, displayParams.lineColor.tbgr, feature);\n }\n\n public getBuilder(displayParams: DisplayParams, type: MeshPrimitiveType, hasNormals: boolean, isPlanar: boolean): MeshBuilder {\n const { facetAreaTolerance, tolerance, is2d, range } = this;\n const key = this.getKey(displayParams, type, hasNormals, isPlanar);\n\n const quantizePositions = false; // ###TODO should this be configurable?\n return this.getBuilderFromKey(key, {\n displayParams,\n type,\n range,\n quantizePositions,\n is2d,\n isPlanar,\n tolerance,\n areaTolerance: facetAreaTolerance,\n features: this.features,\n isVolumeClassifier: this._isVolumeClassifier,\n });\n }\n\n public getKey(displayParams: DisplayParams, type: MeshPrimitiveType, hasNormals: boolean, isPlanar: boolean): MeshBuilderMap.Key {\n const key = new MeshBuilderMap.Key(displayParams, type, hasNormals, isPlanar);\n\n if (this.options.preserveOrder)\n key.order = ++this._keyOrder;\n\n return key;\n }\n\n /**\n * gets builder associated with key if defined, otherwise creates a new builder and sets that with key\n * @param key MeshBuilderMap.Key to associate with builder\n * @param props MeshBuilder.Props required to create builder if it does not already exist\n * @returns builder reference, changes will update instance stored in builderMap\n */\n public getBuilderFromKey(key: MeshBuilderMap.Key, props: MeshBuilder.Props): MeshBuilder {\n let builder = this.get(key);\n if (undefined === builder) {\n builder = MeshBuilder.create(props);\n this.set(key, builder);\n }\n return builder;\n }\n}\n\n/** @internal */\nexport namespace MeshBuilderMap {\n export class Key {\n public order: number = 0;\n public readonly params: DisplayParams;\n public readonly type: MeshPrimitiveType;\n public readonly hasNormals: boolean;\n public readonly isPlanar: boolean;\n\n constructor(params: DisplayParams, type: MeshPrimitiveType, hasNormals: boolean, isPlanar: boolean) {\n this.params = params;\n this.type = type;\n this.hasNormals = hasNormals;\n this.isPlanar = isPlanar;\n }\n\n public static createFromMesh(mesh: Mesh): Key {\n return new Key(mesh.displayParams, mesh.type, mesh.normals.length !== 0, mesh.isPlanar);\n }\n\n public compare(rhs: Key): number {\n let diff = compareNumbers(this.order, rhs.order);\n if (0 === diff) {\n diff = compareNumbers(this.type, rhs.type);\n if (0 === diff) {\n diff = compareBooleans(this.isPlanar, rhs.isPlanar);\n if (0 === diff) {\n diff = compareBooleans(this.hasNormals, rhs.hasNormals);\n if (0 === diff) {\n diff = this.params.compareForMerge(rhs.params);\n }\n }\n }\n }\n\n return diff;\n }\n\n public equals(rhs: Key): boolean { return 0 === this.compare(rhs); }\n }\n}\n"]}
|
|
@@ -99,7 +99,7 @@ export class MeshBuilderMap extends Dictionary {
|
|
|
99
99
|
const { displayParams, isDisjoint, isPlanar, strokes } = strokePrimitive;
|
|
100
100
|
const type = isDisjoint ? MeshPrimitiveType.Point : MeshPrimitiveType.Polyline;
|
|
101
101
|
const builder = this.getBuilder(displayParams, type, false, isPlanar);
|
|
102
|
-
builder.addStrokePointLists(strokes, isDisjoint, displayParams.
|
|
102
|
+
builder.addStrokePointLists(strokes, isDisjoint, displayParams.lineColor.tbgr, feature);
|
|
103
103
|
}
|
|
104
104
|
getBuilder(displayParams, type, hasNormals, isPlanar) {
|
|
105
105
|
const { facetAreaTolerance, tolerance, is2d, range } = this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeshBuilderMap.js","sourceRoot":"","sources":["../../../../../src/common/internal/render/MeshBuilderMap.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAc,MAAM,qBAAqB,CAAC;AAE9F,OAAO,EAAW,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIpD,OAAO,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xD,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;4BACf,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;wBACjD,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QAEM,MAAM,CAAC,GAAQ,IAAa,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACrE;IArCY,kBAAG,MAqCf,CAAA;AACH,CAAC,EAvCgB,cAAc,KAAd,cAAc,QAuC9B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { compareBooleans, compareNumbers, Dictionary, Id64String } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { Feature, FeatureTable } from \"@itwin/core-common\";\nimport { DisplayParams } from \"./DisplayParams\";\nimport { MeshPrimitiveType } from \"./MeshPrimitive\";\nimport { GeometryList } from \"./GeometryList\";\nimport { Geometry } from \"./GeometryPrimitives\";\nimport { PolyfacePrimitive } from \"./Polyface\";\nimport { GeometryOptions, ToleranceRatio } from \"./Primitives\";\nimport { StrokesPrimitive } from \"./Strokes\";\nimport { MeshBuilder, MeshEdgeCreationOptions } from \"./MeshBuilder\";\nimport { Mesh, MeshList } from \"./MeshPrimitives\";\n\n/** @internal */\nexport class MeshBuilderMap extends Dictionary<MeshBuilderMap.Key, MeshBuilder> {\n public readonly range: Range3d;\n public readonly vertexTolerance: number;\n public readonly facetAreaTolerance: number;\n public readonly tolerance: number;\n public readonly is2d: boolean;\n public readonly features?: FeatureTable;\n public readonly options: GeometryOptions;\n private readonly _isVolumeClassifier: boolean;\n private _keyOrder = 0;\n\n constructor(tolerance: number, range: Range3d, is2d: boolean, options: GeometryOptions, pickable: { isVolumeClassifier?: boolean, modelId?: Id64String } | undefined) {\n super((lhs: MeshBuilderMap.Key, rhs: MeshBuilderMap.Key) => lhs.compare(rhs));\n this.tolerance = tolerance;\n this.vertexTolerance = tolerance * ToleranceRatio.vertex;\n this.facetAreaTolerance = tolerance * ToleranceRatio.facetArea;\n this.range = range;\n this.is2d = is2d;\n this.options = options;\n this._isVolumeClassifier = pickable?.isVolumeClassifier ?? false;\n\n if (pickable)\n this.features = new FeatureTable(2048 * 1024, pickable.modelId);\n }\n\n public static createFromGeometries(geometries: GeometryList, tolerance: number, range: Range3d, is2d: boolean, options: GeometryOptions, pickable: { isVolumeClassifier?: boolean, modelId?: Id64String } | undefined): MeshBuilderMap {\n const map = new MeshBuilderMap(tolerance, range, is2d, options, pickable);\n\n for (const geom of geometries)\n map.loadGeometry(geom);\n\n return map;\n }\n\n public toMeshes(): MeshList {\n const meshes = new MeshList(this.features, this.range);\n for (const builder of this._values) {\n if (builder.mesh.points.length > 0)\n meshes.push(builder.mesh);\n }\n return meshes;\n }\n\n /**\n * extract polyfaces and strokes from geometry into MeshBuilder stored in builderMap\n * @param geom Geometry instance to extract polyfaces and strokes from\n */\n public loadGeometry(geom: Geometry): void {\n this.loadPolyfacePrimitiveList(geom);\n this.loadStrokePrimitiveList(geom);\n }\n\n /**\n * extract polyface primitives from geometry in meshBuilder stored in builderMap\n * @param geom Geometry instance to extract polyfaces from\n */\n public loadPolyfacePrimitiveList(geom: Geometry): void {\n const polyfaces = geom.getPolyfaces(this.tolerance);\n\n if (polyfaces !== undefined)\n for (const polyface of polyfaces)\n this.loadIndexedPolyface(polyface, geom.feature);\n }\n\n /**\n * extract indexed polyfaces into meshBuilder stored in builderMap\n * @param polyface PolyfacePrimitive to extract indexed polyfaces from\n */\n public loadIndexedPolyface(polyface: PolyfacePrimitive, feature: Feature | undefined): void {\n const { indexedPolyface, displayParams, isPlanar } = polyface;\n const { pointCount, normalCount } = indexedPolyface;\n const { fillColor, isTextured } = displayParams;\n const textureMapping = displayParams.textureMapping;\n\n if (pointCount === 0)\n return;\n\n const builder = this.getBuilder(displayParams, MeshPrimitiveType.Mesh, normalCount > 0, isPlanar);\n const edgeOptions = new MeshEdgeCreationOptions(polyface.displayEdges && this.options.wantEdges ? MeshEdgeCreationOptions.Type.DefaultEdges : MeshEdgeCreationOptions.Type.NoEdges);\n builder.addFromPolyface(indexedPolyface, { edgeOptions, includeParams: isTextured, fillColor: fillColor.tbgr, mappedTexture: textureMapping }, feature);\n }\n\n /**\n * extract stroke primitives from geometry in meshBuilder stored in builderMap\n * @param geom Geometry instance to extract strokes from\n */\n public loadStrokePrimitiveList(geom: Geometry): void {\n const strokes = geom.getStrokes(this.tolerance);\n\n if (undefined !== strokes)\n for (const stroke of strokes)\n this.loadStrokesPrimitive(stroke, geom.feature);\n }\n\n /**\n * extract strokes primitive into meshBuilder stored in builderMap\n * @param strokePrimitive StrokesPrimitive instance to extractfrom\n */\n public loadStrokesPrimitive(strokePrimitive: StrokesPrimitive, feature: Feature | undefined): void {\n const { displayParams, isDisjoint, isPlanar, strokes } = strokePrimitive;\n\n const type = isDisjoint ? MeshPrimitiveType.Point : MeshPrimitiveType.Polyline;\n const builder = this.getBuilder(displayParams, type, false, isPlanar);\n builder.addStrokePointLists(strokes, isDisjoint, displayParams.fillColor.tbgr, feature);\n }\n\n public getBuilder(displayParams: DisplayParams, type: MeshPrimitiveType, hasNormals: boolean, isPlanar: boolean): MeshBuilder {\n const { facetAreaTolerance, tolerance, is2d, range } = this;\n const key = this.getKey(displayParams, type, hasNormals, isPlanar);\n\n const quantizePositions = false; // ###TODO should this be configurable?\n return this.getBuilderFromKey(key, {\n displayParams,\n type,\n range,\n quantizePositions,\n is2d,\n isPlanar,\n tolerance,\n areaTolerance: facetAreaTolerance,\n features: this.features,\n isVolumeClassifier: this._isVolumeClassifier,\n });\n }\n\n public getKey(displayParams: DisplayParams, type: MeshPrimitiveType, hasNormals: boolean, isPlanar: boolean): MeshBuilderMap.Key {\n const key = new MeshBuilderMap.Key(displayParams, type, hasNormals, isPlanar);\n\n if (this.options.preserveOrder)\n key.order = ++this._keyOrder;\n\n return key;\n }\n\n /**\n * gets builder associated with key if defined, otherwise creates a new builder and sets that with key\n * @param key MeshBuilderMap.Key to associate with builder\n * @param props MeshBuilder.Props required to create builder if it does not already exist\n * @returns builder reference, changes will update instance stored in builderMap\n */\n public getBuilderFromKey(key: MeshBuilderMap.Key, props: MeshBuilder.Props): MeshBuilder {\n let builder = this.get(key);\n if (undefined === builder) {\n builder = MeshBuilder.create(props);\n this.set(key, builder);\n }\n return builder;\n }\n}\n\n/** @internal */\nexport namespace MeshBuilderMap {\n export class Key {\n public order: number = 0;\n public readonly params: DisplayParams;\n public readonly type: MeshPrimitiveType;\n public readonly hasNormals: boolean;\n public readonly isPlanar: boolean;\n\n constructor(params: DisplayParams, type: MeshPrimitiveType, hasNormals: boolean, isPlanar: boolean) {\n this.params = params;\n this.type = type;\n this.hasNormals = hasNormals;\n this.isPlanar = isPlanar;\n }\n\n public static createFromMesh(mesh: Mesh): Key {\n return new Key(mesh.displayParams, mesh.type, mesh.normals.length !== 0, mesh.isPlanar);\n }\n\n public compare(rhs: Key): number {\n let diff = compareNumbers(this.order, rhs.order);\n if (0 === diff) {\n diff = compareNumbers(this.type, rhs.type);\n if (0 === diff) {\n diff = compareBooleans(this.isPlanar, rhs.isPlanar);\n if (0 === diff) {\n diff = compareBooleans(this.hasNormals, rhs.hasNormals);\n if (0 === diff) {\n diff = this.params.compareForMerge(rhs.params);\n }\n }\n }\n }\n\n return diff;\n }\n\n public equals(rhs: Key): boolean { return 0 === this.compare(rhs); }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MeshBuilderMap.js","sourceRoot":"","sources":["../../../../../src/common/internal/render/MeshBuilderMap.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAc,MAA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AAC;oBACpD,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;wBACf,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;wBACxD,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;4BACf,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;wBACjD,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QAEM,MAAM,CAAC,GAAQ,IAAa,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACrE;IArCY,kBAAG,MAqCf,CAAA;AACH,CAAC,EAvCgB,cAAc,KAAd,cAAc,QAuC9B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { compareBooleans, compareNumbers, Dictionary, Id64String } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { Feature, FeatureTable } from \"@itwin/core-common\";\nimport { DisplayParams } from \"./DisplayParams\";\nimport { MeshPrimitiveType } from \"./MeshPrimitive\";\nimport { GeometryList } from \"./GeometryList\";\nimport { Geometry } from \"./GeometryPrimitives\";\nimport { PolyfacePrimitive } from \"./Polyface\";\nimport { GeometryOptions, ToleranceRatio } from \"./Primitives\";\nimport { StrokesPrimitive } from \"./Strokes\";\nimport { MeshBuilder, MeshEdgeCreationOptions } from \"./MeshBuilder\";\nimport { Mesh, MeshList } from \"./MeshPrimitives\";\n\n/** @internal */\nexport class MeshBuilderMap extends Dictionary<MeshBuilderMap.Key, MeshBuilder> {\n public readonly range: Range3d;\n public readonly vertexTolerance: number;\n public readonly facetAreaTolerance: number;\n public readonly tolerance: number;\n public readonly is2d: boolean;\n public readonly features?: FeatureTable;\n public readonly options: GeometryOptions;\n private readonly _isVolumeClassifier: boolean;\n private _keyOrder = 0;\n\n constructor(tolerance: number, range: Range3d, is2d: boolean, options: GeometryOptions, pickable: { isVolumeClassifier?: boolean, modelId?: Id64String } | undefined) {\n super((lhs: MeshBuilderMap.Key, rhs: MeshBuilderMap.Key) => lhs.compare(rhs));\n this.tolerance = tolerance;\n this.vertexTolerance = tolerance * ToleranceRatio.vertex;\n this.facetAreaTolerance = tolerance * ToleranceRatio.facetArea;\n this.range = range;\n this.is2d = is2d;\n this.options = options;\n this._isVolumeClassifier = pickable?.isVolumeClassifier ?? false;\n\n if (pickable)\n this.features = new FeatureTable(2048 * 1024, pickable.modelId);\n }\n\n public static createFromGeometries(geometries: GeometryList, tolerance: number, range: Range3d, is2d: boolean, options: GeometryOptions, pickable: { isVolumeClassifier?: boolean, modelId?: Id64String } | undefined): MeshBuilderMap {\n const map = new MeshBuilderMap(tolerance, range, is2d, options, pickable);\n\n for (const geom of geometries)\n map.loadGeometry(geom);\n\n return map;\n }\n\n public toMeshes(): MeshList {\n const meshes = new MeshList(this.features, this.range);\n for (const builder of this._values) {\n if (builder.mesh.points.length > 0)\n meshes.push(builder.mesh);\n }\n return meshes;\n }\n\n /**\n * extract polyfaces and strokes from geometry into MeshBuilder stored in builderMap\n * @param geom Geometry instance to extract polyfaces and strokes from\n */\n public loadGeometry(geom: Geometry): void {\n this.loadPolyfacePrimitiveList(geom);\n this.loadStrokePrimitiveList(geom);\n }\n\n /**\n * extract polyface primitives from geometry in meshBuilder stored in builderMap\n * @param geom Geometry instance to extract polyfaces from\n */\n public loadPolyfacePrimitiveList(geom: Geometry): void {\n const polyfaces = geom.getPolyfaces(this.tolerance);\n\n if (polyfaces !== undefined)\n for (const polyface of polyfaces)\n this.loadIndexedPolyface(polyface, geom.feature);\n }\n\n /**\n * extract indexed polyfaces into meshBuilder stored in builderMap\n * @param polyface PolyfacePrimitive to extract indexed polyfaces from\n */\n public loadIndexedPolyface(polyface: PolyfacePrimitive, feature: Feature | undefined): void {\n const { indexedPolyface, displayParams, isPlanar } = polyface;\n const { pointCount, normalCount } = indexedPolyface;\n const { fillColor, isTextured } = displayParams;\n const textureMapping = displayParams.textureMapping;\n\n if (pointCount === 0)\n return;\n\n const builder = this.getBuilder(displayParams, MeshPrimitiveType.Mesh, normalCount > 0, isPlanar);\n const edgeOptions = new MeshEdgeCreationOptions(polyface.displayEdges && this.options.wantEdges ? MeshEdgeCreationOptions.Type.DefaultEdges : MeshEdgeCreationOptions.Type.NoEdges);\n builder.addFromPolyface(indexedPolyface, { edgeOptions, includeParams: isTextured, fillColor: fillColor.tbgr, mappedTexture: textureMapping }, feature);\n }\n\n /**\n * extract stroke primitives from geometry in meshBuilder stored in builderMap\n * @param geom Geometry instance to extract strokes from\n */\n public loadStrokePrimitiveList(geom: Geometry): void {\n const strokes = geom.getStrokes(this.tolerance);\n\n if (undefined !== strokes)\n for (const stroke of strokes)\n this.loadStrokesPrimitive(stroke, geom.feature);\n }\n\n /**\n * extract strokes primitive into meshBuilder stored in builderMap\n * @param strokePrimitive StrokesPrimitive instance to extractfrom\n */\n public loadStrokesPrimitive(strokePrimitive: StrokesPrimitive, feature: Feature | undefined): void {\n const { displayParams, isDisjoint, isPlanar, strokes } = strokePrimitive;\n\n const type = isDisjoint ? MeshPrimitiveType.Point : MeshPrimitiveType.Polyline;\n const builder = this.getBuilder(displayParams, type, false, isPlanar);\n builder.addStrokePointLists(strokes, isDisjoint, displayParams.lineColor.tbgr, feature);\n }\n\n public getBuilder(displayParams: DisplayParams, type: MeshPrimitiveType, hasNormals: boolean, isPlanar: boolean): MeshBuilder {\n const { facetAreaTolerance, tolerance, is2d, range } = this;\n const key = this.getKey(displayParams, type, hasNormals, isPlanar);\n\n const quantizePositions = false; // ###TODO should this be configurable?\n return this.getBuilderFromKey(key, {\n displayParams,\n type,\n range,\n quantizePositions,\n is2d,\n isPlanar,\n tolerance,\n areaTolerance: facetAreaTolerance,\n features: this.features,\n isVolumeClassifier: this._isVolumeClassifier,\n });\n }\n\n public getKey(displayParams: DisplayParams, type: MeshPrimitiveType, hasNormals: boolean, isPlanar: boolean): MeshBuilderMap.Key {\n const key = new MeshBuilderMap.Key(displayParams, type, hasNormals, isPlanar);\n\n if (this.options.preserveOrder)\n key.order = ++this._keyOrder;\n\n return key;\n }\n\n /**\n * gets builder associated with key if defined, otherwise creates a new builder and sets that with key\n * @param key MeshBuilderMap.Key to associate with builder\n * @param props MeshBuilder.Props required to create builder if it does not already exist\n * @returns builder reference, changes will update instance stored in builderMap\n */\n public getBuilderFromKey(key: MeshBuilderMap.Key, props: MeshBuilder.Props): MeshBuilder {\n let builder = this.get(key);\n if (undefined === builder) {\n builder = MeshBuilder.create(props);\n this.set(key, builder);\n }\n return builder;\n }\n}\n\n/** @internal */\nexport namespace MeshBuilderMap {\n export class Key {\n public order: number = 0;\n public readonly params: DisplayParams;\n public readonly type: MeshPrimitiveType;\n public readonly hasNormals: boolean;\n public readonly isPlanar: boolean;\n\n constructor(params: DisplayParams, type: MeshPrimitiveType, hasNormals: boolean, isPlanar: boolean) {\n this.params = params;\n this.type = type;\n this.hasNormals = hasNormals;\n this.isPlanar = isPlanar;\n }\n\n public static createFromMesh(mesh: Mesh): Key {\n return new Key(mesh.displayParams, mesh.type, mesh.normals.length !== 0, mesh.isPlanar);\n }\n\n public compare(rhs: Key): number {\n let diff = compareNumbers(this.order, rhs.order);\n if (0 === diff) {\n diff = compareNumbers(this.type, rhs.type);\n if (0 === diff) {\n diff = compareBooleans(this.isPlanar, rhs.isPlanar);\n if (0 === diff) {\n diff = compareBooleans(this.hasNormals, rhs.hasNormals);\n if (0 === diff) {\n diff = this.params.compareForMerge(rhs.params);\n }\n }\n }\n }\n\n return diff;\n }\n\n public equals(rhs: Key): boolean { return 0 === this.compare(rhs); }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-frontend",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.73",
|
|
4
4
|
"description": "iTwin.js frontend components",
|
|
5
5
|
"main": "lib/cjs/core-frontend.js",
|
|
6
6
|
"module": "lib/esm/core-frontend.js",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"url": "http://www.bentley.com"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@itwin/
|
|
27
|
-
"@itwin/core-common": "5.0.0-dev.
|
|
28
|
-
"@itwin/
|
|
29
|
-
"@itwin/core-
|
|
30
|
-
"@itwin/core-orbitgt": "5.0.0-dev.
|
|
31
|
-
"@itwin/core-quantity": "5.0.0-dev.
|
|
26
|
+
"@itwin/appui-abstract": "5.0.0-dev.73",
|
|
27
|
+
"@itwin/core-common": "5.0.0-dev.73",
|
|
28
|
+
"@itwin/core-geometry": "5.0.0-dev.73",
|
|
29
|
+
"@itwin/core-bentley": "5.0.0-dev.73",
|
|
30
|
+
"@itwin/core-orbitgt": "5.0.0-dev.73",
|
|
31
|
+
"@itwin/core-quantity": "5.0.0-dev.73"
|
|
32
32
|
},
|
|
33
33
|
"//devDependencies": [
|
|
34
34
|
"NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"vite-multiple-assets": "^1.3.1",
|
|
52
52
|
"vite-plugin-static-copy": "1.0.6",
|
|
53
53
|
"webpack": "^5.97.1",
|
|
54
|
-
"@itwin/
|
|
55
|
-
"@itwin/
|
|
56
|
-
"@itwin/
|
|
57
|
-
"@itwin/core-
|
|
58
|
-
"@itwin/core-geometry": "5.0.0-dev.
|
|
59
|
-
"@itwin/core-
|
|
60
|
-
"@itwin/core-
|
|
54
|
+
"@itwin/build-tools": "5.0.0-dev.73",
|
|
55
|
+
"@itwin/appui-abstract": "5.0.0-dev.73",
|
|
56
|
+
"@itwin/core-common": "5.0.0-dev.73",
|
|
57
|
+
"@itwin/core-bentley": "5.0.0-dev.73",
|
|
58
|
+
"@itwin/core-geometry": "5.0.0-dev.73",
|
|
59
|
+
"@itwin/core-orbitgt": "5.0.0-dev.73",
|
|
60
|
+
"@itwin/core-quantity": "5.0.0-dev.73"
|
|
61
61
|
},
|
|
62
62
|
"//dependencies": [
|
|
63
63
|
"NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"@loaders.gl/draco": "^3.1.6",
|
|
71
71
|
"fuse.js": "^3.3.0",
|
|
72
72
|
"wms-capabilities": "0.4.0",
|
|
73
|
-
"@itwin/
|
|
74
|
-
"@itwin/
|
|
73
|
+
"@itwin/core-i18n": "5.0.0-dev.73",
|
|
74
|
+
"@itwin/webgl-compatibility": "5.0.0-dev.73"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"build": "npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers",
|
|
@@ -90,7 +90,6 @@
|
|
|
90
90
|
"pseudolocalize": "betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO",
|
|
91
91
|
"test": "npm run webpackTestWorker && vitest --run",
|
|
92
92
|
"cover": "npm run webpackTestWorker && vitest --run",
|
|
93
|
-
"test:debug": "vitest --run",
|
|
94
93
|
"webpackTests": "webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker",
|
|
95
94
|
"webpackTestWorker": "webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \"./lib/test/test-worker.js\" ./lib/test",
|
|
96
95
|
"webpackWorkers": "webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"
|