@itwin/core-backend 3.4.0-dev.50 → 3.4.0-dev.55
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/lib/cjs/AliCloudStorageService.d.ts +8 -2
- package/lib/cjs/AliCloudStorageService.d.ts.map +1 -1
- package/lib/cjs/AliCloudStorageService.js +4 -1
- package/lib/cjs/AliCloudStorageService.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.d.ts +4 -0
- package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js +4 -0
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts +0 -2
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +1 -12
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.d.ts.map +1 -1
- package/lib/cjs/ClassRegistry.js +3 -1
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudStorageBackend.d.ts +16 -4
- package/lib/cjs/CloudStorageBackend.d.ts.map +1 -1
- package/lib/cjs/CloudStorageBackend.js +12 -3
- package/lib/cjs/CloudStorageBackend.js.map +1 -1
- package/lib/cjs/CodeService.d.ts.map +1 -1
- package/lib/cjs/CodeService.js +3 -1
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.d.ts.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.js +8 -2
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.d.ts.map +1 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +16 -17
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/ExportGraphics.d.ts.map +1 -1
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/ExternalSource.d.ts.map +1 -1
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/GeometrySummary.js +1 -1
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +17 -14
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +17 -3
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +46 -12
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +5 -2
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.d.ts.map +1 -1
- package/lib/cjs/PromiseMemoizer.js +10 -4
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/TileStorage.d.ts +19 -0
- package/lib/cjs/TileStorage.d.ts.map +1 -0
- package/lib/cjs/TileStorage.js +91 -0
- package/lib/cjs/TileStorage.js.map +1 -0
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +4 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +8 -2
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/core-backend.d.ts +4 -0
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +4 -0
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +2 -0
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +11 -2
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +3 -0
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/workspace/Settings.d.ts.map +1 -1
- package/lib/cjs/workspace/Settings.js +4 -1
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/package.json +17 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementTreeWalker.js","sourceRoot":"","sources":["../../src/ElementTreeWalker.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAgG;AAChG,oDAA4C;AAC5C,mEAAgE;AAChE,uCAAqF;AACrF,yCAAsC;AACtC,mCAAiD;AAEjD,MAAM,cAAc,GAAG,GAAG,6CAAqB,CAAC,QAAQ,oBAAoB,CAAC;AAK7E,SAAS,yBAAyB,CAAC,MAAgB,EAAE,GAAc;IACjE,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAc,EAAE,CAAC;IAC9B,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE;QACrB,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,QAAQ,KAAK,SAAS,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAClD,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;YAEnB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACrB;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QACvB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnB,OAAO,CAAC,GAAG,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,YAAY,CAAC,MAAgB,EAAE,OAAmB;IACzD,OAAO,MAAM,CAAC,qBAAqB,CAAC,wBAAwB,iBAAO,CAAC,aAAa,qBAAqB,EAAE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GAAG,CAAC,4BAA4B,EAAE,CAAC;AACrC,CAAC;AAJD,sDAIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\nimport { assert, DbResult, Id64Array, Id64String, Logger, LogLevel } from \"@itwin/core-bentley\";\r\nimport { IModel } from \"@itwin/core-common\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { DefinitionElement, DefinitionPartition, Element, Subject } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { DefinitionModel, Model } from \"./Model\";\r\n\r\nconst loggerCategory = `${BackendLoggerCategory.IModelDb}.ElementTreeWalker`;\r\n\r\n/** @beta */\r\nexport interface ElementTreeWalkerModelInfo { model: Model, isDefinitionModel: boolean }\r\n\r\nfunction sortChildrenBeforeParents(iModel: IModelDb, ids: Id64Array): Array<Id64Array> {\r\n const children: Id64Array = [];\r\n const parents: Id64Array = [];\r\n for (const eid of ids) {\r\n const parentId = iModel.elements.queryParent(eid);\r\n if (parentId !== undefined && ids.includes(parentId))\r\n children.push(eid);\r\n else\r\n parents.push(eid);\r\n }\r\n\r\n if (children.length === 0)\r\n return [parents];\r\n\r\n return [...sortChildrenBeforeParents(iModel, children), parents];\r\n}\r\n\r\nfunction isModelEmpty(iModel: IModelDb, modelId: Id64String): boolean {\r\n return iModel.withPreparedStatement(`select count(*) from ${Element.classFullName} where Model.Id = ?`, (stmt) => {\r\n stmt.bindId(1, modelId);\r\n stmt.step();\r\n return stmt.getValue(0).getInteger() === 0;\r\n });\r\n}\r\n\r\nfunction isDefinitionModel(model: Model): boolean {\r\n return (model.id !== IModel.repositoryModelId) && (model instanceof DefinitionModel);\r\n}\r\n\r\nenum ElementPruningClassification { PRUNING_CLASS_Normal = 0, PRUNING_CLASS_Subject = 1, PRUNING_CLASS_Definition = 2, PRUNING_CLASS_DefinitionPartition = 3, }\r\n\r\nfunction classifyElementForPruning(iModel: IModelDb, elementId: Id64String): ElementPruningClassification {\r\n const el = iModel.elements.getElement(elementId);\r\n return (el instanceof Subject) ? ElementPruningClassification.PRUNING_CLASS_Subject :\r\n (el instanceof DefinitionElement) ? ElementPruningClassification.PRUNING_CLASS_Definition :\r\n (el instanceof DefinitionPartition) ? ElementPruningClassification.PRUNING_CLASS_DefinitionPartition :\r\n ElementPruningClassification.PRUNING_CLASS_Normal;\r\n}\r\n\r\n/** Records the path that a tree search took to reach an element or model. This object is immutable.\r\n * @beta\r\n */\r\nexport class ElementTreeWalkerScope {\r\n public readonly topElement: Id64String = \"\";\r\n /** path of parent elements and enclosing models */\r\n public readonly path: Array<Id64String | ElementTreeWalkerModelInfo> = [];\r\n /** cached info about the immediately enclosing model (i.e., the last model in path) */\r\n public readonly enclosingModelInfo: ElementTreeWalkerModelInfo;\r\n\r\n constructor(topElement: Id64String, model: Model);\r\n constructor(enclosingScope: ElementTreeWalkerScope, newScope: Id64String | Model);\r\n constructor(arg1: Id64String | ElementTreeWalkerScope, arg2: Model | Id64String) {\r\n if (typeof arg1 === \"string\") {\r\n // normal constructor\r\n assert(arg2 instanceof Model);\r\n this.topElement = arg1;\r\n this.path.push(this.enclosingModelInfo = { model: arg2, isDefinitionModel: isDefinitionModel(arg2) });\r\n } else if (arg1 instanceof ElementTreeWalkerScope) {\r\n // copy-like constructor\r\n this.topElement = arg1.topElement;\r\n this.path = [...arg1.path];\r\n if (typeof arg2 === \"string\") {\r\n // with new parent\r\n this.path.push(arg2);\r\n this.enclosingModelInfo = arg1.enclosingModelInfo;\r\n } else {\r\n // with new enclosing model\r\n this.path.push(this.enclosingModelInfo = { model: arg2, isDefinitionModel: isDefinitionModel(arg2) });\r\n }\r\n } else {\r\n throw new Error(\"invalid constructor signature\");\r\n }\r\n }\r\n\r\n public get enclosingModel(): Model { return this.enclosingModelInfo.model; }\r\n public get inDefinitionModel(): boolean { return this.enclosingModelInfo.isDefinitionModel; } // NB: this will return false for the RepositoryModel!\r\n public get inRepositoryModel(): boolean { return this.enclosingModelInfo.model.id === IModelDb.repositoryModelId; }\r\n\r\n public static createTopScope(iModel: IModelDb, topElementId: Id64String) {\r\n const topElement = iModel.elements.getElement(topElementId);\r\n const topElementModel = iModel.models.getModel(topElement.model);\r\n return new ElementTreeWalkerScope(topElementId, topElementModel);\r\n }\r\n\r\n private fmtItem(v: Id64String | ElementTreeWalkerModelInfo): string {\r\n if (typeof v === \"string\")\r\n return `element ${v}`;\r\n return `model ${v.model.id} ${v.isDefinitionModel ? \"(DEFN)\" : \"\"}`;\r\n }\r\n\r\n public toString(): string {\r\n return `[ ${this.path.map((v) => this.fmtItem(v)).join(\" / \")} ]`;\r\n }\r\n}\r\n\r\nfunction fmtElement(iModel: IModelDb, elementId: Id64String): string {\r\n const el = iModel.elements.getElement(elementId);\r\n return `${el.id} ${el.classFullName} ${el.getDisplayLabel()}`;\r\n}\r\n\r\nfunction fmtModel(model: Model): string {\r\n return `${model.id} ${model.classFullName} ${model.name}`;\r\n}\r\n\r\nlet isTraceEnabledChecked = -1;\r\n\r\nfunction isTraceEnabled(): boolean {\r\n if (isTraceEnabledChecked === -1)\r\n isTraceEnabledChecked = Logger.isEnabled(loggerCategory, LogLevel.Trace) ? 1 : 0;\r\n return isTraceEnabledChecked === 1;\r\n}\r\n\r\nfunction logElement(op: string, iModel: IModelDb, elementId: Id64String, scope?: ElementTreeWalkerScope, logChildren?: boolean): void {\r\n if (!isTraceEnabled())\r\n return;\r\n\r\n Logger.logTrace(loggerCategory, `${op} ${fmtElement(iModel, elementId)} ${scope ? scope.toString() : \"\"}`);\r\n\r\n if (logChildren)\r\n iModel.elements.queryChildren(elementId).forEach((c) => logElement(\" - \", iModel, c, undefined, true));\r\n}\r\n\r\nfunction logModel(op: string, iModel: IModelDb, modelId: Id64String, scope?: ElementTreeWalkerScope, logElements?: boolean): void {\r\n if (!isTraceEnabled())\r\n return;\r\n const model: Model = iModel.models.getModel(modelId);\r\n Logger.logTrace(loggerCategory, `${op} ${fmtModel(model)} ${scope ? scope.toString() : \"\"}`);\r\n\r\n if (logElements) {\r\n iModel.withPreparedStatement(`select ecinstanceid from ${Element.classFullName} where Model.Id = ?`, (stmt) => {\r\n stmt.bindId(1, modelId);\r\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\r\n logElement(\" - \", iModel, stmt.getValue(0).getId());\r\n }\r\n });\r\n }\r\n}\r\n\r\n/** Does a depth-first search on the tree defined by an element and its sub-models and children.\r\n * Sub-models are visited before their modeled elements, and children are visited before their parents.\r\n *\r\n * The following callbacks allow the subclass to exclude elements and sub-trees from the search:\r\n * * [[ElementTreeBottomUp.shouldExploreModel]], [[ElementTreeBottomUp.shouldExploreChildren]]\r\n * * [[ElementTreeBottomUp.shouldVisitElement]], [[ElementTreeBottomUp.shouldVisitModel]]\r\n *\r\n * The [[ElementTreeBottomUp.visitElement]] and [[ElementTreeBottomUp.visitModel]] callbacks allow\r\n * the subclass to process the elements and models that are encountered in the search.\r\n * @beta\r\n */\r\nexport abstract class ElementTreeBottomUp {\r\n constructor(protected _iModel: IModelDb) { }\r\n\r\n /** Return true if the search should recurse into this model */\r\n protected shouldExploreModel(_model: Model, _scope: ElementTreeWalkerScope): boolean { return true; }\r\n /** Return true if the search should recurse into the children (if any) of this element */\r\n protected shouldExploreChildren(_parentId: Id64String, _scope: ElementTreeWalkerScope): boolean { return true; }\r\n /** Return true if the search should visit this element */\r\n protected shouldVisitElement(_elementId: Id64String, _scope: ElementTreeWalkerScope): boolean { return true; }\r\n /** Return true if the search should visit this model */\r\n protected shouldVisitModel(_model: Model, _scope: ElementTreeWalkerScope): boolean { return true; }\r\n\r\n /** Called to visit a model */\r\n protected abstract visitModel(model: Model, scope: ElementTreeWalkerScope): void;\r\n\r\n /** Called to visit an element */\r\n protected abstract visitElement(elementId: Id64String, scope: ElementTreeWalkerScope): void;\r\n\r\n /** The main tree-walking function */\r\n protected processElementTree(element: Id64String, scope: ElementTreeWalkerScope) {\r\n const subModel = this._iModel.models.tryGetModel<Model>(element);\r\n if (subModel !== undefined) {\r\n if (this.shouldExploreModel(subModel, scope))\r\n this._processSubModel(subModel, scope);\r\n\r\n if (this.shouldVisitModel(subModel, scope))\r\n this.visitModel(subModel, scope);\r\n }\r\n\r\n if (this.shouldExploreChildren(element, scope))\r\n this._processChildren(element, scope);\r\n\r\n if (this.shouldVisitElement(element, scope))\r\n this.visitElement(element, scope);\r\n }\r\n\r\n /** process the children of the specified parent element */\r\n private _processChildren(parentElement: Id64String, parentScope: ElementTreeWalkerScope): void {\r\n const children = this._iModel.elements.queryChildren(parentElement);\r\n if (children.length === 0)\r\n return;\r\n\r\n const childrenScope = new ElementTreeWalkerScope(parentScope, parentElement);\r\n\r\n for (const childElement of children)\r\n this.processElementTree(childElement, childrenScope);\r\n }\r\n\r\n /** process the elements in the specified model */\r\n private _processSubModel(model: Model, parenScope: ElementTreeWalkerScope): void {\r\n const scope = new ElementTreeWalkerScope(parenScope, model);\r\n // Visit only the top-level parents. processElementTree will visit their children (bottom-up).\r\n model.iModel.withPreparedStatement(`select ECInstanceId from bis:Element where Model.id=? and Parent.Id is null`, (stmt) => {\r\n stmt.bindId(1, model.id);\r\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\r\n const elementId = stmt.getValue(0).getId();\r\n this.processElementTree(elementId, scope);\r\n }\r\n });\r\n }\r\n}\r\n\r\n/** Helper class that manages the deletion of definitions and subjects */\r\nclass SpecialElements {\r\n public definitionModels: Id64Array = [];\r\n public definitions: Id64Array = [];\r\n public subjects: Id64Array = [];\r\n\r\n public recordSpecialElement(iModel: IModelDb, elementId: Id64String): boolean {\r\n // Defer Definitions and Subjects\r\n const cls = classifyElementForPruning(iModel, elementId);\r\n if (cls === ElementPruningClassification.PRUNING_CLASS_Subject) {\r\n this.subjects.push(elementId);\r\n return true;\r\n } else if (cls === ElementPruningClassification.PRUNING_CLASS_Definition) {\r\n this.definitions.push(elementId);\r\n return true;\r\n } else if (cls === ElementPruningClassification.PRUNING_CLASS_DefinitionPartition) {\r\n this.definitionModels.push(elementId);\r\n return true;\r\n }\r\n return false; // not a special element\r\n }\r\n\r\n /** Delete special elements - This calls Elements.deleteDefinitionElements to process the collected definition elements as a group and then\r\n * calls Models.deleteModel on collected definition models. It then deletes all collected Subjects by calling Element.deleteElement on them.\r\n * @note Caller must ensure that the special elements were recorded in a depth-first search.\r\n */\r\n public deleteSpecialElements(iModel: IModelDb) {\r\n // It's dangerous to pass a mixture of SubCategories and Categories to deleteDefinitionElements.\r\n // That function will delete the Categories first, which automatically deletes all their child\r\n // SubCategories (in native code). If a SubCategory in the list is one of those children, then\r\n // deleteDefinitionElements will try and fail with an exception to delete that SubCategory in a subsequent step.\r\n // To work around this, we delete the SubCategories first, then everything else.\r\n // A similar problem occurs when you pass other kinds of elements to deleteDefinitionElements, where some are\r\n // children and others are parents. deleteDefinitionElements does not preserve the order that you specify,\r\n // and it does not process children before parents.\r\n for (const definitions of sortChildrenBeforeParents(iModel, this.definitions)) {\r\n if (isTraceEnabled()) definitions.forEach((e) => logElement(\"try delete\", iModel, e));\r\n iModel.elements.deleteDefinitionElements(definitions); // will not delete definitions that are still in use.\r\n }\r\n\r\n for (const m of this.definitionModels) {\r\n if (!isModelEmpty(iModel, m)) {\r\n logModel(\"Model not empty - cannot delete - may contain Definitions that are still in use\", iModel, m, undefined, true);\r\n } else {\r\n logModel(\"delete\", iModel, m);\r\n iModel.models.deleteModel(m);\r\n iModel.elements.deleteElement(m);\r\n }\r\n }\r\n\r\n for (const e of this.subjects) {\r\n if (iModel.elements.queryChildren(e).length !== 0) {\r\n logElement(\"Subject still has children - cannot delete - may have child DefinitionModels\", iModel, e, undefined, true);\r\n } else {\r\n logElement(\"delete\", iModel, e);\r\n iModel.elements.deleteElement(e);\r\n }\r\n }\r\n }\r\n\r\n}\r\n\r\n/** Deletes an entire element tree, including sub-models and child elements.\r\n * Items are deleted in bottom-up order. Definitions and Subjects are deleted after normal elements.\r\n * Call deleteNormalElements on each tree. Then call deleteSpecialElements.\r\n * @see deleteElementTree for a simple way to use this class.\r\n * @beta\r\n */\r\nexport class ElementTreeDeleter extends ElementTreeBottomUp {\r\n protected _special: SpecialElements = new SpecialElements();\r\n\r\n protected override shouldExploreModel(_model: Model): boolean { return true; }\r\n protected override shouldVisitElement(_elementId: Id64String): boolean { return true; }\r\n\r\n protected override visitModel(model: Model, _scope: ElementTreeWalkerScope): void {\r\n if (isDefinitionModel(model))\r\n return; // we recorded definition models in visitElement when we encountered the DefinitionPartition elements.\r\n\r\n // visitElement has already deleted the elements in the model. So, now it's safe to delete the model itself.\r\n logModel(\"delete\", this._iModel, model.id, _scope);\r\n model.delete();\r\n }\r\n\r\n protected override visitElement(elementId: Id64String, _scope: ElementTreeWalkerScope): void {\r\n if (!this._special.recordSpecialElement(this._iModel, elementId)) {\r\n logElement(\"delete\", this._iModel, elementId, _scope);\r\n this._iModel.elements.deleteElement(elementId);\r\n }\r\n }\r\n\r\n /**\r\n * Delete the \"normal\" elements and record the special elements for deferred processing.\r\n * @param topElement The parent of the sub-tree to be deleted. Top element itself is also deleted.\r\n * @param scope How the parent was found\r\n * @see deleteSpecialElements\r\n */\r\n public deleteNormalElements(topElement: Id64String, scope?: ElementTreeWalkerScope): void {\r\n const topScope = scope ?? ElementTreeWalkerScope.createTopScope(this._iModel, topElement);\r\n this.processElementTree(topElement, topScope); //\r\n }\r\n\r\n /** Delete all special elements that were found and deferred by deleteNormalElements. Call this\r\n * function once after all element trees are processed by deleteNormalElements.\r\n */\r\n public deleteSpecialElements(): void {\r\n this._special.deleteSpecialElements(this._iModel);\r\n }\r\n\r\n}\r\n\r\n/** Does a breadth-first search on the tree defined by an element and its sub-models and children.\r\n * Parents are visited first, then children, then sub-models.\r\n * The subclass can \"prune\" sub-trees from the search. When a sub-tree is \"pruned\" the search does *not* recurse into it.\r\n * If a sub-tree is not pruned, then the search does recurse into it.\r\n * @beta\r\n */\r\nabstract class ElementTreeTopDown {\r\n constructor(protected _iModel: IModelDb) { }\r\n\r\n /** Should the search *not* recurse into this sub-tree? */\r\n protected shouldPrune(_elementId: Id64String, _scope: ElementTreeWalkerScope): boolean { return false; }\r\n\r\n protected abstract prune(_elementId: Id64String, _scope: ElementTreeWalkerScope): void;\r\n\r\n protected processElementTree(element: Id64String, scope: ElementTreeWalkerScope) {\r\n\r\n if (this.shouldPrune(element, scope)) {\r\n this.prune(element, scope);\r\n return;\r\n }\r\n\r\n this._processChildren(element, scope);\r\n\r\n const subModel = this._iModel.models.tryGetModel<Model>(element);\r\n if (subModel !== undefined) {\r\n this._processSubModel(subModel, scope);\r\n }\r\n }\r\n\r\n private _processChildren(element: Id64String, scope: ElementTreeWalkerScope) {\r\n let parentScope: ElementTreeWalkerScope | undefined;\r\n for (const childElement of this._iModel.elements.queryChildren(element)) {\r\n if (parentScope === undefined)\r\n parentScope = new ElementTreeWalkerScope(scope, element);\r\n this.processElementTree(childElement, parentScope);\r\n }\r\n }\r\n\r\n private _processSubModel(subModel: Model, scope: ElementTreeWalkerScope) {\r\n const subModelScope = new ElementTreeWalkerScope(scope, subModel);\r\n // Visit only the top-level parents. processElementTree will recurse into their children.\r\n this._iModel.withPreparedStatement(`select ECInstanceId from bis:Element where Model.id=? and Parent.Id is null`, (stmt) => {\r\n stmt.bindId(1, subModel.id);\r\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\r\n const elementId = stmt.getValue(0).getId();\r\n this.processElementTree(elementId, subModelScope);\r\n }\r\n });\r\n }\r\n\r\n}\r\n\r\n/** Signature of the filter function used by ElementSubTreeDeleter.\r\n * @param elementId The sub-tree parent element.\r\n * @param scope The path followed by the top-down search to the element\r\n * @return true if the element and its children and sub-models should be deleted.\r\n * @beta\r\n */\r\nexport type ElementSubTreeDeleteFilter = (elementId: Id64String, scope: ElementTreeWalkerScope) => boolean;\r\n\r\n/** Performs a breadth-first search to visit elements in top-down order.\r\n * When the supplied filter function chooses an element, ElementTreeDeleter is used to delete it and its sub-tree.\r\n * @beta\r\n */\r\nexport class ElementSubTreeDeleter extends ElementTreeTopDown {\r\n private _treeDeleter: ElementTreeDeleter;\r\n private _shouldPruneCb: ElementSubTreeDeleteFilter;\r\n\r\n /** Construct an ElementSubTreeDeleter.\r\n * @param iModel The iModel\r\n * @param topElement Where to start the search.\r\n * @param shouldPruneCb Callback that selects sub-trees that should be deleted.\r\n * @see deleteElementSubTrees for a simple way to use this class.\r\n */\r\n public constructor(iModel: IModelDb, shouldPruneCb: ElementSubTreeDeleteFilter) {\r\n super(iModel);\r\n this._treeDeleter = new ElementTreeDeleter(this._iModel);\r\n this._shouldPruneCb = shouldPruneCb;\r\n }\r\n\r\n protected override shouldPrune(elementId: Id64String, scope: ElementTreeWalkerScope): boolean { return this._shouldPruneCb(elementId, scope); }\r\n\r\n protected prune(elementId: Id64String, scope: ElementTreeWalkerScope): void {\r\n this._treeDeleter.deleteNormalElements(elementId, scope);\r\n }\r\n\r\n /** Traverses the tree of elements beginning with the top element, and deletes all selected sub-trees.\r\n * Normal elements are deleted. Any special elements that are encountered are deferred.\r\n * Call deleteSpecialElementSubTrees after all top elements have been processed. */\r\n public deleteNormalElementSubTrees(topElement: Id64String, scope?: ElementTreeWalkerScope) {\r\n const topScope = scope ?? ElementTreeWalkerScope.createTopScope(this._iModel, topElement);\r\n this.processElementTree(topElement, topScope); // deletes normal elements and their sub-trees, defers special elements\r\n }\r\n\r\n /** Delete all special elements and their sub-trees that were found in the course of processing.\r\n * The sub-trees were already expanded by ElementTreeDeleter.deleteNormalElements.\r\n */\r\n public deleteSpecialElementSubTrees() {\r\n this._treeDeleter.deleteSpecialElements();\r\n }\r\n}\r\n\r\n/** Deletes an element tree starting with the specified top element. The top element is also deleted. Uses ElementTreeDeleter.\r\n * @param iModel The iModel\r\n * @param topElement The parent of the sub-tree\r\n * @beta\r\n */\r\nexport function deleteElementTree(iModel: IModelDb, topElement: Id64String): void {\r\n const del = new ElementTreeDeleter(iModel);\r\n del.deleteNormalElements(topElement);\r\n del.deleteSpecialElements();\r\n}\r\n\r\n/** Deletes all element sub-trees that are selected by the supplied filter. Uses ElementSubTreeDeleter.\r\n * If the filter selects the top element itself, then the entire tree (including the top element) is deleted.\r\n * That has the same effect as calling [[deleteElementTree]] on the top element.\r\n * @param iModel The iModel\r\n * @param topElement Where to start the search.\r\n * @param filter Callback that selects sub-trees that should be deleted.\r\n * @beta\r\n */\r\nexport function deleteElementSubTrees(iModel: IModelDb, topElement: Id64String, filter: ElementSubTreeDeleteFilter): void {\r\n const del = new ElementSubTreeDeleter(iModel, filter);\r\n del.deleteNormalElementSubTrees(topElement);\r\n del.deleteSpecialElementSubTrees();\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ElementTreeWalker.js","sourceRoot":"","sources":["../../src/ElementTreeWalker.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAgG;AAChG,oDAA4C;AAC5C,mEAAgE;AAChE,uCAAqF;AACrF,yCAAsC;AACtC,mCAAiD;AAEjD,MAAM,cAAc,GAAG,GAAG,6CAAqB,CAAC,QAAQ,oBAAoB,CAAC;AAK7E,SAAS,yBAAyB,CAAC,MAAgB,EAAE,GAAc;IACjE,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAc,EAAE,CAAC;IAC9B,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE;QACrB,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,QAAQ,KAAK,SAAS,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAClD,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;YAEnB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACrB;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QACvB,OAAO,CAAC,OAAO,CAAC,CAAC;IA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JD,8CAIC;AAED;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CAAC,MAAgB,EAAE,UAAsB,EAAE,MAAkC;IAChH,MAAM,GAAG,GAAG,IAAI,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,GAAG,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;IAC5C,GAAG,CAAC,4BAA4B,EAAE,CAAC;AACrC,CAAC;AAJD,sDAIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\nimport { assert, DbResult, Id64Array, Id64String, Logger, LogLevel } from \"@itwin/core-bentley\";\r\nimport { IModel } from \"@itwin/core-common\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { DefinitionElement, DefinitionPartition, Element, Subject } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { DefinitionModel, Model } from \"./Model\";\r\n\r\nconst loggerCategory = `${BackendLoggerCategory.IModelDb}.ElementTreeWalker`;\r\n\r\n/** @beta */\r\nexport interface ElementTreeWalkerModelInfo { model: Model, isDefinitionModel: boolean }\r\n\r\nfunction sortChildrenBeforeParents(iModel: IModelDb, ids: Id64Array): Array<Id64Array> {\r\n const children: Id64Array = [];\r\n const parents: Id64Array = [];\r\n for (const eid of ids) {\r\n const parentId = iModel.elements.queryParent(eid);\r\n if (parentId !== undefined && ids.includes(parentId))\r\n children.push(eid);\r\n else\r\n parents.push(eid);\r\n }\r\n\r\n if (children.length === 0)\r\n return [parents];\r\n\r\n return [...sortChildrenBeforeParents(iModel, children), parents];\r\n}\r\n\r\nfunction isModelEmpty(iModel: IModelDb, modelId: Id64String): boolean {\r\n return iModel.withPreparedStatement(`select count(*) from ${Element.classFullName} where Model.Id = ?`, (stmt) => {\r\n stmt.bindId(1, modelId);\r\n stmt.step();\r\n return stmt.getValue(0).getInteger() === 0;\r\n });\r\n}\r\n\r\nfunction isDefinitionModel(model: Model): boolean {\r\n return (model.id !== IModel.repositoryModelId) && (model instanceof DefinitionModel);\r\n}\r\n\r\nenum ElementPruningClassification { PRUNING_CLASS_Normal = 0, PRUNING_CLASS_Subject = 1, PRUNING_CLASS_Definition = 2, PRUNING_CLASS_DefinitionPartition = 3, }\r\n\r\nfunction classifyElementForPruning(iModel: IModelDb, elementId: Id64String): ElementPruningClassification {\r\n const el = iModel.elements.getElement(elementId);\r\n return (el instanceof Subject) ? ElementPruningClassification.PRUNING_CLASS_Subject :\r\n (el instanceof DefinitionElement) ? ElementPruningClassification.PRUNING_CLASS_Definition :\r\n (el instanceof DefinitionPartition) ? ElementPruningClassification.PRUNING_CLASS_DefinitionPartition :\r\n ElementPruningClassification.PRUNING_CLASS_Normal;\r\n}\r\n\r\n/** Records the path that a tree search took to reach an element or model. This object is immutable.\r\n * @beta\r\n */\r\nexport class ElementTreeWalkerScope {\r\n public readonly topElement: Id64String = \"\";\r\n /** path of parent elements and enclosing models */\r\n public readonly path: Array<Id64String | ElementTreeWalkerModelInfo> = [];\r\n /** cached info about the immediately enclosing model (i.e., the last model in path) */\r\n public readonly enclosingModelInfo: ElementTreeWalkerModelInfo;\r\n\r\n constructor(topElement: Id64String, model: Model);\r\n constructor(enclosingScope: ElementTreeWalkerScope, newScope: Id64String | Model);\r\n constructor(arg1: Id64String | ElementTreeWalkerScope, arg2: Model | Id64String) {\r\n if (typeof arg1 === \"string\") {\r\n // normal constructor\r\n assert(arg2 instanceof Model);\r\n this.topElement = arg1;\r\n this.path.push(this.enclosingModelInfo = { model: arg2, isDefinitionModel: isDefinitionModel(arg2) });\r\n } else if (arg1 instanceof ElementTreeWalkerScope) {\r\n // copy-like constructor\r\n this.topElement = arg1.topElement;\r\n this.path = [...arg1.path];\r\n if (typeof arg2 === \"string\") {\r\n // with new parent\r\n this.path.push(arg2);\r\n this.enclosingModelInfo = arg1.enclosingModelInfo;\r\n } else {\r\n // with new enclosing model\r\n this.path.push(this.enclosingModelInfo = { model: arg2, isDefinitionModel: isDefinitionModel(arg2) });\r\n }\r\n } else {\r\n throw new Error(\"invalid constructor signature\");\r\n }\r\n }\r\n\r\n public get enclosingModel(): Model { return this.enclosingModelInfo.model; }\r\n public get inDefinitionModel(): boolean { return this.enclosingModelInfo.isDefinitionModel; } // NB: this will return false for the RepositoryModel!\r\n public get inRepositoryModel(): boolean { return this.enclosingModelInfo.model.id === IModelDb.repositoryModelId; }\r\n\r\n public static createTopScope(iModel: IModelDb, topElementId: Id64String) {\r\n const topElement = iModel.elements.getElement(topElementId);\r\n const topElementModel = iModel.models.getModel(topElement.model);\r\n return new ElementTreeWalkerScope(topElementId, topElementModel);\r\n }\r\n\r\n private fmtItem(v: Id64String | ElementTreeWalkerModelInfo): string {\r\n if (typeof v === \"string\")\r\n return `element ${v}`;\r\n return `model ${v.model.id} ${v.isDefinitionModel ? \"(DEFN)\" : \"\"}`;\r\n }\r\n\r\n public toString(): string {\r\n return `[ ${this.path.map((v) => this.fmtItem(v)).join(\" / \")} ]`;\r\n }\r\n}\r\n\r\nfunction fmtElement(iModel: IModelDb, elementId: Id64String): string {\r\n const el = iModel.elements.getElement(elementId);\r\n return `${el.id} ${el.classFullName} ${el.getDisplayLabel()}`;\r\n}\r\n\r\nfunction fmtModel(model: Model): string {\r\n return `${model.id} ${model.classFullName} ${model.name}`;\r\n}\r\n\r\nlet isTraceEnabledChecked = -1;\r\n\r\nfunction isTraceEnabled(): boolean {\r\n if (isTraceEnabledChecked === -1)\r\n isTraceEnabledChecked = Logger.isEnabled(loggerCategory, LogLevel.Trace) ? 1 : 0;\r\n return isTraceEnabledChecked === 1;\r\n}\r\n\r\nfunction logElement(op: string, iModel: IModelDb, elementId: Id64String, scope?: ElementTreeWalkerScope, logChildren?: boolean): void {\r\n if (!isTraceEnabled())\r\n return;\r\n\r\n Logger.logTrace(loggerCategory, `${op} ${fmtElement(iModel, elementId)} ${scope ? scope.toString() : \"\"}`);\r\n\r\n if (logChildren)\r\n iModel.elements.queryChildren(elementId).forEach((c) => logElement(\" - \", iModel, c, undefined, true));\r\n}\r\n\r\nfunction logModel(op: string, iModel: IModelDb, modelId: Id64String, scope?: ElementTreeWalkerScope, logElements?: boolean): void {\r\n if (!isTraceEnabled())\r\n return;\r\n const model: Model = iModel.models.getModel(modelId);\r\n Logger.logTrace(loggerCategory, `${op} ${fmtModel(model)} ${scope ? scope.toString() : \"\"}`);\r\n\r\n if (logElements) {\r\n iModel.withPreparedStatement(`select ecinstanceid from ${Element.classFullName} where Model.Id = ?`, (stmt) => {\r\n stmt.bindId(1, modelId);\r\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\r\n logElement(\" - \", iModel, stmt.getValue(0).getId());\r\n }\r\n });\r\n }\r\n}\r\n\r\n/** Does a depth-first search on the tree defined by an element and its sub-models and children.\r\n * Sub-models are visited before their modeled elements, and children are visited before their parents.\r\n *\r\n * The following callbacks allow the subclass to exclude elements and sub-trees from the search:\r\n * * [[ElementTreeBottomUp.shouldExploreModel]], [[ElementTreeBottomUp.shouldExploreChildren]]\r\n * * [[ElementTreeBottomUp.shouldVisitElement]], [[ElementTreeBottomUp.shouldVisitModel]]\r\n *\r\n * The [[ElementTreeBottomUp.visitElement]] and [[ElementTreeBottomUp.visitModel]] callbacks allow\r\n * the subclass to process the elements and models that are encountered in the search.\r\n * @beta\r\n */\r\nexport abstract class ElementTreeBottomUp {\r\n constructor(protected _iModel: IModelDb) { }\r\n\r\n /** Return true if the search should recurse into this model */\r\n protected shouldExploreModel(_model: Model, _scope: ElementTreeWalkerScope): boolean { return true; }\r\n /** Return true if the search should recurse into the children (if any) of this element */\r\n protected shouldExploreChildren(_parentId: Id64String, _scope: ElementTreeWalkerScope): boolean { return true; }\r\n /** Return true if the search should visit this element */\r\n protected shouldVisitElement(_elementId: Id64String, _scope: ElementTreeWalkerScope): boolean { return true; }\r\n /** Return true if the search should visit this model */\r\n protected shouldVisitModel(_model: Model, _scope: ElementTreeWalkerScope): boolean { return true; }\r\n\r\n /** Called to visit a model */\r\n protected abstract visitModel(model: Model, scope: ElementTreeWalkerScope): void;\r\n\r\n /** Called to visit an element */\r\n protected abstract visitElement(elementId: Id64String, scope: ElementTreeWalkerScope): void;\r\n\r\n /** The main tree-walking function */\r\n protected processElementTree(element: Id64String, scope: ElementTreeWalkerScope) {\r\n const subModel = this._iModel.models.tryGetModel<Model>(element);\r\n if (subModel !== undefined) {\r\n if (this.shouldExploreModel(subModel, scope))\r\n this._processSubModel(subModel, scope);\r\n\r\n if (this.shouldVisitModel(subModel, scope))\r\n this.visitModel(subModel, scope);\r\n }\r\n\r\n if (this.shouldExploreChildren(element, scope))\r\n this._processChildren(element, scope);\r\n\r\n if (this.shouldVisitElement(element, scope))\r\n this.visitElement(element, scope);\r\n }\r\n\r\n /** process the children of the specified parent element */\r\n private _processChildren(parentElement: Id64String, parentScope: ElementTreeWalkerScope): void {\r\n const children = this._iModel.elements.queryChildren(parentElement);\r\n if (children.length === 0)\r\n return;\r\n\r\n const childrenScope = new ElementTreeWalkerScope(parentScope, parentElement);\r\n\r\n for (const childElement of children)\r\n this.processElementTree(childElement, childrenScope);\r\n }\r\n\r\n /** process the elements in the specified model */\r\n private _processSubModel(model: Model, parenScope: ElementTreeWalkerScope): void {\r\n const scope = new ElementTreeWalkerScope(parenScope, model);\r\n // Visit only the top-level parents. processElementTree will visit their children (bottom-up).\r\n model.iModel.withPreparedStatement(`select ECInstanceId from bis:Element where Model.id=? and Parent.Id is null`, (stmt) => {\r\n stmt.bindId(1, model.id);\r\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\r\n const elementId = stmt.getValue(0).getId();\r\n this.processElementTree(elementId, scope);\r\n }\r\n });\r\n }\r\n}\r\n\r\n/** Helper class that manages the deletion of definitions and subjects */\r\nclass SpecialElements {\r\n public definitionModels: Id64Array = [];\r\n public definitions: Id64Array = [];\r\n public subjects: Id64Array = [];\r\n\r\n public recordSpecialElement(iModel: IModelDb, elementId: Id64String): boolean {\r\n // Defer Definitions and Subjects\r\n const cls = classifyElementForPruning(iModel, elementId);\r\n if (cls === ElementPruningClassification.PRUNING_CLASS_Subject) {\r\n this.subjects.push(elementId);\r\n return true;\r\n } else if (cls === ElementPruningClassification.PRUNING_CLASS_Definition) {\r\n this.definitions.push(elementId);\r\n return true;\r\n } else if (cls === ElementPruningClassification.PRUNING_CLASS_DefinitionPartition) {\r\n this.definitionModels.push(elementId);\r\n return true;\r\n }\r\n return false; // not a special element\r\n }\r\n\r\n /** Delete special elements - This calls Elements.deleteDefinitionElements to process the collected definition elements as a group and then\r\n * calls Models.deleteModel on collected definition models. It then deletes all collected Subjects by calling Element.deleteElement on them.\r\n * @note Caller must ensure that the special elements were recorded in a depth-first search.\r\n */\r\n public deleteSpecialElements(iModel: IModelDb) {\r\n // It's dangerous to pass a mixture of SubCategories and Categories to deleteDefinitionElements.\r\n // That function will delete the Categories first, which automatically deletes all their child\r\n // SubCategories (in native code). If a SubCategory in the list is one of those children, then\r\n // deleteDefinitionElements will try and fail with an exception to delete that SubCategory in a subsequent step.\r\n // To work around this, we delete the SubCategories first, then everything else.\r\n // A similar problem occurs when you pass other kinds of elements to deleteDefinitionElements, where some are\r\n // children and others are parents. deleteDefinitionElements does not preserve the order that you specify,\r\n // and it does not process children before parents.\r\n for (const definitions of sortChildrenBeforeParents(iModel, this.definitions)) {\r\n if (isTraceEnabled())\r\n definitions.forEach((e) => logElement(\"try delete\", iModel, e));\r\n\r\n iModel.elements.deleteDefinitionElements(definitions); // will not delete definitions that are still in use.\r\n }\r\n\r\n for (const m of this.definitionModels) {\r\n if (!isModelEmpty(iModel, m)) {\r\n logModel(\"Model not empty - cannot delete - may contain Definitions that are still in use\", iModel, m, undefined, true);\r\n } else {\r\n logModel(\"delete\", iModel, m);\r\n iModel.models.deleteModel(m);\r\n iModel.elements.deleteElement(m);\r\n }\r\n }\r\n\r\n for (const e of this.subjects) {\r\n if (iModel.elements.queryChildren(e).length !== 0) {\r\n logElement(\"Subject still has children - cannot delete - may have child DefinitionModels\", iModel, e, undefined, true);\r\n } else {\r\n logElement(\"delete\", iModel, e);\r\n iModel.elements.deleteElement(e);\r\n }\r\n }\r\n }\r\n\r\n}\r\n\r\n/** Deletes an entire element tree, including sub-models and child elements.\r\n * Items are deleted in bottom-up order. Definitions and Subjects are deleted after normal elements.\r\n * Call deleteNormalElements on each tree. Then call deleteSpecialElements.\r\n * @see deleteElementTree for a simple way to use this class.\r\n * @beta\r\n */\r\nexport class ElementTreeDeleter extends ElementTreeBottomUp {\r\n protected _special: SpecialElements = new SpecialElements();\r\n\r\n protected override shouldExploreModel(_model: Model): boolean { return true; }\r\n protected override shouldVisitElement(_elementId: Id64String): boolean { return true; }\r\n\r\n protected override visitModel(model: Model, _scope: ElementTreeWalkerScope): void {\r\n if (isDefinitionModel(model))\r\n return; // we recorded definition models in visitElement when we encountered the DefinitionPartition elements.\r\n\r\n // visitElement has already deleted the elements in the model. So, now it's safe to delete the model itself.\r\n logModel(\"delete\", this._iModel, model.id, _scope);\r\n model.delete();\r\n }\r\n\r\n protected override visitElement(elementId: Id64String, _scope: ElementTreeWalkerScope): void {\r\n if (!this._special.recordSpecialElement(this._iModel, elementId)) {\r\n logElement(\"delete\", this._iModel, elementId, _scope);\r\n this._iModel.elements.deleteElement(elementId);\r\n }\r\n }\r\n\r\n /**\r\n * Delete the \"normal\" elements and record the special elements for deferred processing.\r\n * @param topElement The parent of the sub-tree to be deleted. Top element itself is also deleted.\r\n * @param scope How the parent was found\r\n * @see deleteSpecialElements\r\n */\r\n public deleteNormalElements(topElement: Id64String, scope?: ElementTreeWalkerScope): void {\r\n const topScope = scope ?? ElementTreeWalkerScope.createTopScope(this._iModel, topElement);\r\n this.processElementTree(topElement, topScope); //\r\n }\r\n\r\n /** Delete all special elements that were found and deferred by deleteNormalElements. Call this\r\n * function once after all element trees are processed by deleteNormalElements.\r\n */\r\n public deleteSpecialElements(): void {\r\n this._special.deleteSpecialElements(this._iModel);\r\n }\r\n\r\n}\r\n\r\n/** Does a breadth-first search on the tree defined by an element and its sub-models and children.\r\n * Parents are visited first, then children, then sub-models.\r\n * The subclass can \"prune\" sub-trees from the search. When a sub-tree is \"pruned\" the search does *not* recurse into it.\r\n * If a sub-tree is not pruned, then the search does recurse into it.\r\n * @beta\r\n */\r\nabstract class ElementTreeTopDown {\r\n constructor(protected _iModel: IModelDb) { }\r\n\r\n /** Should the search *not* recurse into this sub-tree? */\r\n protected shouldPrune(_elementId: Id64String, _scope: ElementTreeWalkerScope): boolean { return false; }\r\n\r\n protected abstract prune(_elementId: Id64String, _scope: ElementTreeWalkerScope): void;\r\n\r\n protected processElementTree(element: Id64String, scope: ElementTreeWalkerScope) {\r\n\r\n if (this.shouldPrune(element, scope)) {\r\n this.prune(element, scope);\r\n return;\r\n }\r\n\r\n this._processChildren(element, scope);\r\n\r\n const subModel = this._iModel.models.tryGetModel<Model>(element);\r\n if (subModel !== undefined) {\r\n this._processSubModel(subModel, scope);\r\n }\r\n }\r\n\r\n private _processChildren(element: Id64String, scope: ElementTreeWalkerScope) {\r\n let parentScope: ElementTreeWalkerScope | undefined;\r\n for (const childElement of this._iModel.elements.queryChildren(element)) {\r\n if (parentScope === undefined)\r\n parentScope = new ElementTreeWalkerScope(scope, element);\r\n this.processElementTree(childElement, parentScope);\r\n }\r\n }\r\n\r\n private _processSubModel(subModel: Model, scope: ElementTreeWalkerScope) {\r\n const subModelScope = new ElementTreeWalkerScope(scope, subModel);\r\n // Visit only the top-level parents. processElementTree will recurse into their children.\r\n this._iModel.withPreparedStatement(`select ECInstanceId from bis:Element where Model.id=? and Parent.Id is null`, (stmt) => {\r\n stmt.bindId(1, subModel.id);\r\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\r\n const elementId = stmt.getValue(0).getId();\r\n this.processElementTree(elementId, subModelScope);\r\n }\r\n });\r\n }\r\n\r\n}\r\n\r\n/** Signature of the filter function used by ElementSubTreeDeleter.\r\n * @param elementId The sub-tree parent element.\r\n * @param scope The path followed by the top-down search to the element\r\n * @return true if the element and its children and sub-models should be deleted.\r\n * @beta\r\n */\r\nexport type ElementSubTreeDeleteFilter = (elementId: Id64String, scope: ElementTreeWalkerScope) => boolean;\r\n\r\n/** Performs a breadth-first search to visit elements in top-down order.\r\n * When the supplied filter function chooses an element, ElementTreeDeleter is used to delete it and its sub-tree.\r\n * @beta\r\n */\r\nexport class ElementSubTreeDeleter extends ElementTreeTopDown {\r\n private _treeDeleter: ElementTreeDeleter;\r\n private _shouldPruneCb: ElementSubTreeDeleteFilter;\r\n\r\n /** Construct an ElementSubTreeDeleter.\r\n * @param iModel The iModel\r\n * @param topElement Where to start the search.\r\n * @param shouldPruneCb Callback that selects sub-trees that should be deleted.\r\n * @see deleteElementSubTrees for a simple way to use this class.\r\n */\r\n public constructor(iModel: IModelDb, shouldPruneCb: ElementSubTreeDeleteFilter) {\r\n super(iModel);\r\n this._treeDeleter = new ElementTreeDeleter(this._iModel);\r\n this._shouldPruneCb = shouldPruneCb;\r\n }\r\n\r\n protected override shouldPrune(elementId: Id64String, scope: ElementTreeWalkerScope): boolean { return this._shouldPruneCb(elementId, scope); }\r\n\r\n protected prune(elementId: Id64String, scope: ElementTreeWalkerScope): void {\r\n this._treeDeleter.deleteNormalElements(elementId, scope);\r\n }\r\n\r\n /** Traverses the tree of elements beginning with the top element, and deletes all selected sub-trees.\r\n * Normal elements are deleted. Any special elements that are encountered are deferred.\r\n * Call deleteSpecialElementSubTrees after all top elements have been processed. */\r\n public deleteNormalElementSubTrees(topElement: Id64String, scope?: ElementTreeWalkerScope) {\r\n const topScope = scope ?? ElementTreeWalkerScope.createTopScope(this._iModel, topElement);\r\n this.processElementTree(topElement, topScope); // deletes normal elements and their sub-trees, defers special elements\r\n }\r\n\r\n /** Delete all special elements and their sub-trees that were found in the course of processing.\r\n * The sub-trees were already expanded by ElementTreeDeleter.deleteNormalElements.\r\n */\r\n public deleteSpecialElementSubTrees() {\r\n this._treeDeleter.deleteSpecialElements();\r\n }\r\n}\r\n\r\n/** Deletes an element tree starting with the specified top element. The top element is also deleted. Uses ElementTreeDeleter.\r\n * @param iModel The iModel\r\n * @param topElement The parent of the sub-tree\r\n * @beta\r\n */\r\nexport function deleteElementTree(iModel: IModelDb, topElement: Id64String): void {\r\n const del = new ElementTreeDeleter(iModel);\r\n del.deleteNormalElements(topElement);\r\n del.deleteSpecialElements();\r\n}\r\n\r\n/** Deletes all element sub-trees that are selected by the supplied filter. Uses ElementSubTreeDeleter.\r\n * If the filter selects the top element itself, then the entire tree (including the top element) is deleted.\r\n * That has the same effect as calling [[deleteElementTree]] on the top element.\r\n * @param iModel The iModel\r\n * @param topElement Where to start the search.\r\n * @param filter Callback that selects sub-trees that should be deleted.\r\n * @beta\r\n */\r\nexport function deleteElementSubTrees(iModel: IModelDb, topElement: Id64String, filter: ElementSubTreeDeleteFilter): void {\r\n const del = new ElementSubTreeDeleter(iModel, filter);\r\n del.deleteNormalElementSubTrees(topElement);\r\n del.deleteSpecialElementSubTrees();\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportGraphics.d.ts","sourceRoot":"","sources":["../../src/ExportGraphics.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAElE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,4EAA4E;IAC5E,OAAO,EAAE,UAAU,CAAC;IACpB,+DAA+D;IAC/D,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,SAAS,EAAE,UAAU,CAAC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;IACD,6FAA6F;IACtF,YAAY,CAAC,KAAsB,EAAE,KAAa;QACvD,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACxD,IAAI,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM;YACzD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACtC,IAAI,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM;YACzD,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACzD,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM;YAC5D,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;CAEF;AA5ID,8DA4IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { assert, Id64Array, Id64String } from \"@itwin/core-bentley\";\r\nimport { IndexedPolyface, Polyface, PolyfaceData, PolyfaceVisitor } from \"@itwin/core-geometry\";\r\nimport { ColorDefProps, GeometryClass } from \"@itwin/core-common\";\r\n\r\n/** A collection of line segments, suitable for direct use with graphics APIs.\r\n * The structure of this data matches GL_LINES in OpenGL.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsLines {\r\n /** Zero-based vertex indices, every two indices represent a line segment */\r\n indices: Int32Array;\r\n /** Vertices for these lines, laid out in the pattern XYZXYZ */\r\n points: Float64Array;\r\n}\r\n\r\n/** Info provided to ExportLinesFunction about linework graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportLinesInfo {\r\n /** The element ID for the element the graphics originated from */\r\n elementId: Id64String;\r\n /** ID for the [SubCategory]($core-backend) for these graphics */\r\n subCategory: Id64String;\r\n /** The color and transparency for these graphics */\r\n color: ColorDefProps;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** The linework for these graphics */\r\n lines: ExportGraphicsLines;\r\n}\r\n\r\n/** A callback function that receives generated line graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportLinesFunction = (info: ExportLinesInfo) => void;\r\n\r\n/** A triangulated mesh with unified indices, suitable for direct use with graphics APIs.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsMesh {\r\n /** Zero-based vertex indices, every three indices represent a triangle */\r\n indices: Int32Array;\r\n /** Vertices for this mesh, laid out in the pattern XYZXYZ */\r\n points: Float64Array;\r\n /** Normals for this mesh, laid out in the pattern XYZXYZ */\r\n normals: Float32Array;\r\n /** Parameters (uvs) for this mesh, laid out in the pattern XYXY */\r\n params: Float32Array;\r\n /** If true, clients should assume both sides of the mesh are visible and not cull backfaces. */\r\n isTwoSided: boolean;\r\n}\r\n\r\n/** Info provided to ExportGraphicsFunction about graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsInfo {\r\n /** The element ID for the element the graphics originated from */\r\n elementId: Id64String;\r\n /** ID for the [SubCategory]($core-backend) for these graphics */\r\n subCategory: Id64String;\r\n /** The color and transparency for these graphics */\r\n color: ColorDefProps;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\r\n materialId?: Id64String;\r\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\r\n textureId?: Id64String;\r\n /** The mesh for these graphics */\r\n mesh: ExportGraphicsMesh;\r\n}\r\n\r\n/** Information about the base display properties when a [GeometryPart]($core-backend) was\r\n * referenced. This is intended to be used with [IModelDb.exportPartGraphics]($core-backend).\r\n * * If two ExportPartInstanceInfo have the same ExportPartDisplayInfos, they will result in the\r\n * same graphics (with a different transform).\r\n * * If two ExportPartInstanceInfo have different ExportPartDisplayInfos, they may result in different\r\n * graphics.\r\n * @public\r\n */\r\nexport interface ExportPartDisplayInfo {\r\n categoryId: Id64String;\r\n subCategoryId: Id64String;\r\n geometryClass: GeometryClass;\r\n materialId: Id64String;\r\n elmTransparency: number;\r\n lineColor: number;\r\n}\r\n\r\n/** Information about references to [GeometryPart]($core-backend) elements found during\r\n * a call to [IModelDb.exportGraphics]($core-backend).\r\n * See [IModelDb.exportPartGraphics]($core-backend) for the intended use case.\r\n * @public\r\n */\r\nexport interface ExportPartInstanceInfo {\r\n /** ID for the [GeometryPart]($core-backend) */\r\n partId: Id64String;\r\n /** ID for the element that contained the reference to the [GeometryPart]($core-backend) */\r\n partInstanceId: Id64String;\r\n /** The base display properties when the [GeometryPart]($core-backend) was referenced. */\r\n displayProps: ExportPartDisplayInfo;\r\n /** A row-major storage 4x3 transform for this instance.\r\n * See export-gltf under test-apps in the iTwin.js monorepo for a working reference.\r\n */\r\n transform?: Float64Array;\r\n}\r\n\r\n/** A callback function that receives generated graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportGraphicsFunction = (info: ExportGraphicsInfo) => void;\r\n\r\n/** Parameters for [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsOptions {\r\n /** The source elements for the exported graphics */\r\n elementIdArray: Id64Array;\r\n /** A function to call for each unique element ID, color and texture combination */\r\n onGraphics: ExportGraphicsFunction;\r\n /** An optional function to call if line graphics are desired. */\r\n onLineGraphics?: ExportLinesFunction;\r\n /** If supplied, any references to [GeometryPart]($core-backend) elements found will be\r\n * recorded in this array. In this case, graphics that would result from the GeometryPart\r\n * will not be supplied via onGraphics. See [IModelDb.exportPartGraphics]($core-backend)\r\n */\r\n partInstanceArray?: ExportPartInstanceInfo[];\r\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry).\r\n * If not supplied, defaults to zero and angleTol will control the quality of the resulting mesh.\r\n */\r\n chordTol?: number;\r\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry).\r\n * If not supplied, defaults to PI/12 (15 degrees).\r\n */\r\n angleTol?: number;\r\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry).\r\n * If not supplied, there is no maximum length of an edge. Supplying this value can greatly increase the\r\n * size of the resulting geometry, and should only be done in cases where necessary (if you don't know\r\n * that it's necessary, it's almost certainly not!)\r\n */\r\n maxEdgeLength?: number;\r\n /** The longest dimension of a line style's largest component must be at least this size in order for\r\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\r\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\r\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\r\n * line strings.\r\n */\r\n minLineStyleComponentSize?: number;\r\n /** Max distance between mesh vertices for them to be collapsed.\r\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\r\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\r\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\r\n * anomalies so it is important to choose an appropriate setting for your use case.\r\n */\r\n decimationTol?: number;\r\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\r\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\r\n * like screws and screw holes.\r\n */\r\n minBRepFeatureSize?: number;\r\n}\r\n\r\n/** Info provided to ExportPartFunction about graphics.\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportPartInfo {\r\n /** The color and transparency for these graphics */\r\n color: ColorDefProps;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\r\n materialId?: Id64String;\r\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\r\n textureId?: Id64String;\r\n /** The mesh for these graphics */\r\n mesh: ExportGraphicsMesh;\r\n}\r\n\r\n/** A callback function that receives generated graphics for a [GeometryPart]($core-backend).\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportPartFunction = (info: ExportPartInfo) => void;\r\n\r\n/** Info provided to ExportPartFunction about line graphics.\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportPartLinesInfo {\r\n /** The color and transparency for these graphics */\r\n color: ColorDefProps;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** The linework for these graphics */\r\n lines: ExportGraphicsLines;\r\n}\r\n\r\n/** A callback function that receives generated line graphics for a [GeometryPart]($core-backend).\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportPartLinesFunction = (info: ExportPartLinesInfo) => void;\r\n\r\n/** Parameters for [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportPartGraphicsOptions {\r\n /** The ID for the source [GeometryPart]($core-backend) */\r\n elementId: Id64String;\r\n /** The base display properties to use for generating the graphics. This should come from an\r\n * ExportPartInstanceProps generated by [IModelDb.exportGraphics]($core-backend)\r\n */\r\n displayProps: ExportPartDisplayInfo;\r\n /** A function to call for each unique color and texture combination. */\r\n onPartGraphics: ExportPartFunction;\r\n /** An optional function to call if line graphics are desired. */\r\n onPartLineGraphics?: ExportPartLinesFunction;\r\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry).\r\n * If not supplied, defaults to zero and angleTol will control the quality of the resulting mesh.\r\n */\r\n chordTol?: number;\r\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry).\r\n * If not supplied, defaults to PI/12 (15 degrees).\r\n */\r\n angleTol?: number;\r\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry)\r\n * If not supplied, there is no maximum length of an edge. Supplying this value can greatly increase the\r\n * size of the resulting geometry, and should only be done in cases where necessary (if you don't know\r\n * that it's necessary, it's almost certainly not!)\r\n */\r\n maxEdgeLength?: number;\r\n /** The longest dimension of a line style's largest component must be at least this size in order for\r\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\r\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\r\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\r\n * line strings.\r\n */\r\n minLineStyleComponentSize?: number;\r\n /** Max distance between mesh vertices for them to be collapsed.\r\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\r\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\r\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\r\n * anomalies so it is important to choose an appropriate setting for your use case.\r\n */\r\n decimationTol?: number;\r\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\r\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\r\n * like screws and screw holes.\r\n */\r\n minBRepFeatureSize?: number;\r\n}\r\n\r\n/** Provides utility functions for working with data generated by [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport namespace ExportGraphics {\r\n /** Test if ExportPartDisplayInfos have exactly the same values.\r\n * @public\r\n */\r\n export function arePartDisplayInfosEqual(lhs: ExportPartDisplayInfo, rhs: ExportPartDisplayInfo): boolean {\r\n if (lhs.categoryId !== rhs.categoryId) return false;\r\n if (lhs.subCategoryId !== rhs.subCategoryId) return false;\r\n if (lhs.materialId !== rhs.materialId) return false;\r\n if (lhs.elmTransparency !== rhs.elmTransparency) return false;\r\n if (lhs.lineColor !== rhs.lineColor) return false;\r\n return true;\r\n }\r\n\r\n /**\r\n * Convert an ExportGraphicsMesh to an IndexedPolyface usable by the geometry API.\r\n * @note The resulting IndexedPolyface may have duplicate points, normals and params. If problematic, call [PolyfaceData.compress]($core-geometry)\r\n * @public\r\n */\r\n export function convertToIndexedPolyface(mesh: ExportGraphicsMesh): IndexedPolyface {\r\n const polyface = IndexedPolyface.create(true, true, false, mesh.isTwoSided);\r\n\r\n const p: Float64Array = mesh.points;\r\n for (let i = 0; i < p.length; i += 3)\r\n polyface.data.point.pushXYZ(p[i], p[i + 1], p[i + 2]);\r\n\r\n const n: Float32Array = mesh.normals;\r\n assert(undefined !== polyface.data.normal);\r\n for (let i = 0; i < n.length; i += 3)\r\n polyface.data.normal.pushXYZ(n[i], n[i + 1], n[i + 2]);\r\n\r\n const uv: Float32Array = mesh.params;\r\n assert(undefined !== polyface.data.param);\r\n for (let i = 0; i < uv.length; i += 2)\r\n polyface.data.param.pushXY(uv[i], uv[i + 1]);\r\n\r\n const indices = mesh.indices;\r\n const addIndex = (idx: number) => {\r\n polyface.addPointIndex(idx, true);\r\n polyface.addNormalIndex(idx);\r\n polyface.addParamIndex(idx);\r\n };\r\n for (let i = 0; i < indices.length; i += 3) {\r\n addIndex(indices[i]);\r\n addIndex(indices[i + 1]);\r\n addIndex(indices[i + 2]);\r\n polyface.terminateFacet(false);\r\n }\r\n\r\n return polyface;\r\n }\r\n}\r\n/**\r\n * * Iterator to walk the facets of an ExportGraphicsMesh and present them to the world as if visiting a Polyface.\r\n * * Because the ExportGraphicsMesh has limited data:\r\n * * There is no auxData in this visitor.\r\n * * There is no color in this visitor.\r\n * * All edgeVisible are true.\r\n * @public\r\n */\r\nexport class ExportGraphicsMeshVisitor extends PolyfaceData implements PolyfaceVisitor {\r\n private _currentFacetIndex: number;\r\n private _nextFacetIndex: number;\r\n private _numWrap: number;\r\n private _polyface: ExportGraphicsMesh;\r\n // to be called from static factory method that validates the polyface ...\r\n private constructor(facets: ExportGraphicsMesh, numWrap: number) {\r\n super(facets.normals.length > 0, facets.params.length > 0, false, facets.isTwoSided);\r\n this._polyface = facets;\r\n this._numWrap = numWrap;\r\n\r\n this._nextFacetIndex = 0;\r\n this._currentFacetIndex = -1;\r\n this.twoSided = facets.isTwoSided;\r\n this.reset();\r\n }\r\n /** Create a visitor for iterating the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays\r\n * Typical wrap counts are:\r\n * * 0 -- leave the point arrays with \"missing final edge\"\r\n * * 1 -- add point 0 as closure point\r\n * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.\r\n */\r\n public static create(polyface: ExportGraphicsMesh, numWrap: number): ExportGraphicsMeshVisitor {\r\n return new ExportGraphicsMeshVisitor(polyface, numWrap);\r\n }\r\n /** Reset the iterator to start at the first facet of the polyface. */\r\n public reset(): void {\r\n this.moveToReadIndex(0);\r\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\r\n }\r\n /** Select a facet by simple index. */\r\n public moveToReadIndex(facetIndex: number): boolean {\r\n if (facetIndex < 0 || 2 + facetIndex * 3 >= this._polyface.indices.length)\r\n return false;\r\n this._currentFacetIndex = facetIndex;\r\n this._nextFacetIndex = facetIndex + 1;\r\n this.point.length = 0;\r\n const points = this.point;\r\n points.length = 0;\r\n this.pointIndex.length = 0;\r\n this.point.length = 0;\r\n this.edgeVisible.length = 0;\r\n const sourcePoints = this._polyface.points;\r\n const indices = this._polyface.indices;\r\n const i0 = 3 * facetIndex;\r\n for (let i = i0; i < i0 + 3; i++) {\r\n const k = 3 * indices[i];\r\n this.pointIndex.push(indices[i]);\r\n this.point.pushXYZ(sourcePoints[k], sourcePoints[k + 1], sourcePoints[k + 2]);\r\n this.edgeVisible.push(true);\r\n }\r\n for (let i = 0; i < this._numWrap; i++) {\r\n this.point.pushFromGrowableXYZArray(this.point, i);\r\n }\r\n\r\n const sourceParams = this._polyface.params;\r\n if (sourceParams.length > 0 && this.paramIndex && this.param) {\r\n this.paramIndex.length = 0;\r\n this.param.length = 0;\r\n for (let i = i0; i < i0 + 3; i++) {\r\n const k = 2 * indices[i];\r\n this.paramIndex.push(indices[i]);\r\n this.param.pushXY(sourceParams[k], sourceParams[k + 1]);\r\n }\r\n for (let i = 0; i < this._numWrap; i++) {\r\n this.param.pushFromGrowableXYArray(this.param, i);\r\n }\r\n }\r\n\r\n const sourceNormals = this._polyface.normals;\r\n if (sourceNormals.length > 0 && this.normalIndex && this.normal) {\r\n this.normalIndex.length = 0;\r\n this.normal.length = 0;\r\n for (let i = i0; i < i0 + 3; i++) {\r\n const k = 3 * indices[i];\r\n this.normalIndex.push(indices[i]);\r\n this.normal.pushXYZ(sourceNormals[k], sourceNormals[k + 1], sourceNormals[k + 2]);\r\n }\r\n for (let i = 0; i < this._numWrap; i++) {\r\n this.normal.pushFromGrowableXYZArray(this.normal, i);\r\n }\r\n }\r\n return true;\r\n }\r\n public moveToNextFacet(): boolean {\r\n return this.moveToReadIndex(this._nextFacetIndex);\r\n }\r\n /** Set the number of vertices to replicate in visitor arrays. */\r\n public setNumWrap(numWrap: number): void { this._numWrap = numWrap; }\r\n\r\n /** Return the index (in the client polyface) of the current facet */\r\n public currentReadIndex(): number { return this._currentFacetIndex; }\r\n /** Return the point index of vertex i within the currently loaded facet */\r\n public clientPointIndex(i: number): number { return this.pointIndex[i]; }\r\n /** Return the param index of vertex i within the currently loaded facet.\r\n * Use the artificial paramIndex, which matches pointIndex.\r\n */\r\n public clientParamIndex(i: number): number { return this.paramIndex ? this.paramIndex[i] : -1; }\r\n /** Return the normal index of vertex i within the currently loaded facet.\r\n * Use the artificial paramIndex, which matches pointIndex.\r\n */\r\n public clientNormalIndex(i: number): number { return this.normalIndex ? this.normalIndex[i] : -1; }\r\n /** Return the color index of vertex i within the currently loaded facet */\r\n public clientColorIndex(_i: number): number { return 1; }\r\n /** Return the aux data index of vertex i within the currently loaded facet */\r\n public clientAuxIndex(_i: number): number { return -1; }\r\n\r\n /** return the client polyface */\r\n public clientPolyface(): Polyface { return (undefined as unknown) as Polyface; }\r\n /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */\r\n public clearArrays(): void {\r\n if (this.point !== undefined)\r\n this.point.length = 0;\r\n if (this.param !== undefined)\r\n this.param.length = 0;\r\n if (this.normal !== undefined)\r\n this.normal.length = 0;\r\n // ignore color and aux -- they never exist.\r\n }\r\n /** transfer interpolated data from the other visitor.\r\n * * all data values are interpolated at `fraction` between `other` values at index0 and index1.\r\n */\r\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\r\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\r\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\r\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\r\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\r\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\r\n }\r\n /** transfer data from a specified index of the other visitor as new data in this visitor. */\r\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\r\n this.point.pushFromGrowableXYZArray(other.point, index);\r\n if (this.color && other.color && index < other.color.length)\r\n this.color.push(other.color[index]);\r\n if (this.param && other.param && index < other.param.length)\r\n this.param.pushFromGrowableXYArray(other.param, index);\r\n if (this.normal && other.normal && index < other.normal.length)\r\n this.normal.pushFromGrowableXYZArray(other.normal, index);\r\n }\r\n\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ExportGraphics.js","sourceRoot":"","sources":["../../src/ExportGraphics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoE;AACpE,wDAAgG;AAkQhG;;GAEG;AACH,IAAiB,cAAc,CAuD9B;AAvDD,WAAiB,cAAc;IAC7B;;OAEG;IACH,SAAgB,wBAAwB,CAAC,GAA0B,EAAE,GAA0B;QAC7F,IAAI,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU;YACnC,OAAO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;YACzD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACtC,IAAI,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM;YACzD,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACzD,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM;YAC5D,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;CAEF;AA5ID,8DA4IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { assert, Id64Array, Id64String } from \"@itwin/core-bentley\";\r\nimport { IndexedPolyface, Polyface, PolyfaceData, PolyfaceVisitor } from \"@itwin/core-geometry\";\r\nimport { ColorDefProps, GeometryClass } from \"@itwin/core-common\";\r\n\r\n/** A collection of line segments, suitable for direct use with graphics APIs.\r\n * The structure of this data matches GL_LINES in OpenGL.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsLines {\r\n /** Zero-based vertex indices, every two indices represent a line segment */\r\n indices: Int32Array;\r\n /** Vertices for these lines, laid out in the pattern XYZXYZ */\r\n points: Float64Array;\r\n}\r\n\r\n/** Info provided to ExportLinesFunction about linework graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportLinesInfo {\r\n /** The element ID for the element the graphics originated from */\r\n elementId: Id64String;\r\n /** ID for the [SubCategory]($core-backend) for these graphics */\r\n subCategory: Id64String;\r\n /** The color and transparency for these graphics */\r\n color: ColorDefProps;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** The linework for these graphics */\r\n lines: ExportGraphicsLines;\r\n}\r\n\r\n/** A callback function that receives generated line graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportLinesFunction = (info: ExportLinesInfo) => void;\r\n\r\n/** A triangulated mesh with unified indices, suitable for direct use with graphics APIs.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsMesh {\r\n /** Zero-based vertex indices, every three indices represent a triangle */\r\n indices: Int32Array;\r\n /** Vertices for this mesh, laid out in the pattern XYZXYZ */\r\n points: Float64Array;\r\n /** Normals for this mesh, laid out in the pattern XYZXYZ */\r\n normals: Float32Array;\r\n /** Parameters (uvs) for this mesh, laid out in the pattern XYXY */\r\n params: Float32Array;\r\n /** If true, clients should assume both sides of the mesh are visible and not cull backfaces. */\r\n isTwoSided: boolean;\r\n}\r\n\r\n/** Info provided to ExportGraphicsFunction about graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsInfo {\r\n /** The element ID for the element the graphics originated from */\r\n elementId: Id64String;\r\n /** ID for the [SubCategory]($core-backend) for these graphics */\r\n subCategory: Id64String;\r\n /** The color and transparency for these graphics */\r\n color: ColorDefProps;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\r\n materialId?: Id64String;\r\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\r\n textureId?: Id64String;\r\n /** The mesh for these graphics */\r\n mesh: ExportGraphicsMesh;\r\n}\r\n\r\n/** Information about the base display properties when a [GeometryPart]($core-backend) was\r\n * referenced. This is intended to be used with [IModelDb.exportPartGraphics]($core-backend).\r\n * * If two ExportPartInstanceInfo have the same ExportPartDisplayInfos, they will result in the\r\n * same graphics (with a different transform).\r\n * * If two ExportPartInstanceInfo have different ExportPartDisplayInfos, they may result in different\r\n * graphics.\r\n * @public\r\n */\r\nexport interface ExportPartDisplayInfo {\r\n categoryId: Id64String;\r\n subCategoryId: Id64String;\r\n geometryClass: GeometryClass;\r\n materialId: Id64String;\r\n elmTransparency: number;\r\n lineColor: number;\r\n}\r\n\r\n/** Information about references to [GeometryPart]($core-backend) elements found during\r\n * a call to [IModelDb.exportGraphics]($core-backend).\r\n * See [IModelDb.exportPartGraphics]($core-backend) for the intended use case.\r\n * @public\r\n */\r\nexport interface ExportPartInstanceInfo {\r\n /** ID for the [GeometryPart]($core-backend) */\r\n partId: Id64String;\r\n /** ID for the element that contained the reference to the [GeometryPart]($core-backend) */\r\n partInstanceId: Id64String;\r\n /** The base display properties when the [GeometryPart]($core-backend) was referenced. */\r\n displayProps: ExportPartDisplayInfo;\r\n /** A row-major storage 4x3 transform for this instance.\r\n * See export-gltf under test-apps in the iTwin.js monorepo for a working reference.\r\n */\r\n transform?: Float64Array;\r\n}\r\n\r\n/** A callback function that receives generated graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportGraphicsFunction = (info: ExportGraphicsInfo) => void;\r\n\r\n/** Parameters for [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsOptions {\r\n /** The source elements for the exported graphics */\r\n elementIdArray: Id64Array;\r\n /** A function to call for each unique element ID, color and texture combination */\r\n onGraphics: ExportGraphicsFunction;\r\n /** An optional function to call if line graphics are desired. */\r\n onLineGraphics?: ExportLinesFunction;\r\n /** If supplied, any references to [GeometryPart]($core-backend) elements found will be\r\n * recorded in this array. In this case, graphics that would result from the GeometryPart\r\n * will not be supplied via onGraphics. See [IModelDb.exportPartGraphics]($core-backend)\r\n */\r\n partInstanceArray?: ExportPartInstanceInfo[];\r\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry).\r\n * If not supplied, defaults to zero and angleTol will control the quality of the resulting mesh.\r\n */\r\n chordTol?: number;\r\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry).\r\n * If not supplied, defaults to PI/12 (15 degrees).\r\n */\r\n angleTol?: number;\r\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry).\r\n * If not supplied, there is no maximum length of an edge. Supplying this value can greatly increase the\r\n * size of the resulting geometry, and should only be done in cases where necessary (if you don't know\r\n * that it's necessary, it's almost certainly not!)\r\n */\r\n maxEdgeLength?: number;\r\n /** The longest dimension of a line style's largest component must be at least this size in order for\r\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\r\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\r\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\r\n * line strings.\r\n */\r\n minLineStyleComponentSize?: number;\r\n /** Max distance between mesh vertices for them to be collapsed.\r\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\r\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\r\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\r\n * anomalies so it is important to choose an appropriate setting for your use case.\r\n */\r\n decimationTol?: number;\r\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\r\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\r\n * like screws and screw holes.\r\n */\r\n minBRepFeatureSize?: number;\r\n}\r\n\r\n/** Info provided to ExportPartFunction about graphics.\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportPartInfo {\r\n /** The color and transparency for these graphics */\r\n color: ColorDefProps;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\r\n materialId?: Id64String;\r\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\r\n textureId?: Id64String;\r\n /** The mesh for these graphics */\r\n mesh: ExportGraphicsMesh;\r\n}\r\n\r\n/** A callback function that receives generated graphics for a [GeometryPart]($core-backend).\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportPartFunction = (info: ExportPartInfo) => void;\r\n\r\n/** Info provided to ExportPartFunction about line graphics.\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportPartLinesInfo {\r\n /** The color and transparency for these graphics */\r\n color: ColorDefProps;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** The linework for these graphics */\r\n lines: ExportGraphicsLines;\r\n}\r\n\r\n/** A callback function that receives generated line graphics for a [GeometryPart]($core-backend).\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportPartLinesFunction = (info: ExportPartLinesInfo) => void;\r\n\r\n/** Parameters for [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportPartGraphicsOptions {\r\n /** The ID for the source [GeometryPart]($core-backend) */\r\n elementId: Id64String;\r\n /** The base display properties to use for generating the graphics. This should come from an\r\n * ExportPartInstanceProps generated by [IModelDb.exportGraphics]($core-backend)\r\n */\r\n displayProps: ExportPartDisplayInfo;\r\n /** A function to call for each unique color and texture combination. */\r\n onPartGraphics: ExportPartFunction;\r\n /** An optional function to call if line graphics are desired. */\r\n onPartLineGraphics?: ExportPartLinesFunction;\r\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry).\r\n * If not supplied, defaults to zero and angleTol will control the quality of the resulting mesh.\r\n */\r\n chordTol?: number;\r\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry).\r\n * If not supplied, defaults to PI/12 (15 degrees).\r\n */\r\n angleTol?: number;\r\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry)\r\n * If not supplied, there is no maximum length of an edge. Supplying this value can greatly increase the\r\n * size of the resulting geometry, and should only be done in cases where necessary (if you don't know\r\n * that it's necessary, it's almost certainly not!)\r\n */\r\n maxEdgeLength?: number;\r\n /** The longest dimension of a line style's largest component must be at least this size in order for\r\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\r\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\r\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\r\n * line strings.\r\n */\r\n minLineStyleComponentSize?: number;\r\n /** Max distance between mesh vertices for them to be collapsed.\r\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\r\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\r\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\r\n * anomalies so it is important to choose an appropriate setting for your use case.\r\n */\r\n decimationTol?: number;\r\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\r\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\r\n * like screws and screw holes.\r\n */\r\n minBRepFeatureSize?: number;\r\n}\r\n\r\n/** Provides utility functions for working with data generated by [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport namespace ExportGraphics {\r\n /** Test if ExportPartDisplayInfos have exactly the same values.\r\n * @public\r\n */\r\n export function arePartDisplayInfosEqual(lhs: ExportPartDisplayInfo, rhs: ExportPartDisplayInfo): boolean {\r\n if (lhs.categoryId !== rhs.categoryId)\r\n return false;\r\n if (lhs.subCategoryId !== rhs.subCategoryId)\r\n return false;\r\n if (lhs.materialId !== rhs.materialId)\r\n return false;\r\n if (lhs.elmTransparency !== rhs.elmTransparency)\r\n return false;\r\n if (lhs.lineColor !== rhs.lineColor)\r\n return false;\r\n return true;\r\n }\r\n\r\n /**\r\n * Convert an ExportGraphicsMesh to an IndexedPolyface usable by the geometry API.\r\n * @note The resulting IndexedPolyface may have duplicate points, normals and params. If problematic, call [PolyfaceData.compress]($core-geometry)\r\n * @public\r\n */\r\n export function convertToIndexedPolyface(mesh: ExportGraphicsMesh): IndexedPolyface {\r\n const polyface = IndexedPolyface.create(true, true, false, mesh.isTwoSided);\r\n\r\n const p: Float64Array = mesh.points;\r\n for (let i = 0; i < p.length; i += 3)\r\n polyface.data.point.pushXYZ(p[i], p[i + 1], p[i + 2]);\r\n\r\n const n: Float32Array = mesh.normals;\r\n assert(undefined !== polyface.data.normal);\r\n for (let i = 0; i < n.length; i += 3)\r\n polyface.data.normal.pushXYZ(n[i], n[i + 1], n[i + 2]);\r\n\r\n const uv: Float32Array = mesh.params;\r\n assert(undefined !== polyface.data.param);\r\n for (let i = 0; i < uv.length; i += 2)\r\n polyface.data.param.pushXY(uv[i], uv[i + 1]);\r\n\r\n const indices = mesh.indices;\r\n const addIndex = (idx: number) => {\r\n polyface.addPointIndex(idx, true);\r\n polyface.addNormalIndex(idx);\r\n polyface.addParamIndex(idx);\r\n };\r\n for (let i = 0; i < indices.length; i += 3) {\r\n addIndex(indices[i]);\r\n addIndex(indices[i + 1]);\r\n addIndex(indices[i + 2]);\r\n polyface.terminateFacet(false);\r\n }\r\n\r\n return polyface;\r\n }\r\n}\r\n/**\r\n * * Iterator to walk the facets of an ExportGraphicsMesh and present them to the world as if visiting a Polyface.\r\n * * Because the ExportGraphicsMesh has limited data:\r\n * * There is no auxData in this visitor.\r\n * * There is no color in this visitor.\r\n * * All edgeVisible are true.\r\n * @public\r\n */\r\nexport class ExportGraphicsMeshVisitor extends PolyfaceData implements PolyfaceVisitor {\r\n private _currentFacetIndex: number;\r\n private _nextFacetIndex: number;\r\n private _numWrap: number;\r\n private _polyface: ExportGraphicsMesh;\r\n // to be called from static factory method that validates the polyface ...\r\n private constructor(facets: ExportGraphicsMesh, numWrap: number) {\r\n super(facets.normals.length > 0, facets.params.length > 0, false, facets.isTwoSided);\r\n this._polyface = facets;\r\n this._numWrap = numWrap;\r\n\r\n this._nextFacetIndex = 0;\r\n this._currentFacetIndex = -1;\r\n this.twoSided = facets.isTwoSided;\r\n this.reset();\r\n }\r\n /** Create a visitor for iterating the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays\r\n * Typical wrap counts are:\r\n * * 0 -- leave the point arrays with \"missing final edge\"\r\n * * 1 -- add point 0 as closure point\r\n * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.\r\n */\r\n public static create(polyface: ExportGraphicsMesh, numWrap: number): ExportGraphicsMeshVisitor {\r\n return new ExportGraphicsMeshVisitor(polyface, numWrap);\r\n }\r\n /** Reset the iterator to start at the first facet of the polyface. */\r\n public reset(): void {\r\n this.moveToReadIndex(0);\r\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\r\n }\r\n /** Select a facet by simple index. */\r\n public moveToReadIndex(facetIndex: number): boolean {\r\n if (facetIndex < 0 || 2 + facetIndex * 3 >= this._polyface.indices.length)\r\n return false;\r\n this._currentFacetIndex = facetIndex;\r\n this._nextFacetIndex = facetIndex + 1;\r\n this.point.length = 0;\r\n const points = this.point;\r\n points.length = 0;\r\n this.pointIndex.length = 0;\r\n this.point.length = 0;\r\n this.edgeVisible.length = 0;\r\n const sourcePoints = this._polyface.points;\r\n const indices = this._polyface.indices;\r\n const i0 = 3 * facetIndex;\r\n for (let i = i0; i < i0 + 3; i++) {\r\n const k = 3 * indices[i];\r\n this.pointIndex.push(indices[i]);\r\n this.point.pushXYZ(sourcePoints[k], sourcePoints[k + 1], sourcePoints[k + 2]);\r\n this.edgeVisible.push(true);\r\n }\r\n for (let i = 0; i < this._numWrap; i++) {\r\n this.point.pushFromGrowableXYZArray(this.point, i);\r\n }\r\n\r\n const sourceParams = this._polyface.params;\r\n if (sourceParams.length > 0 && this.paramIndex && this.param) {\r\n this.paramIndex.length = 0;\r\n this.param.length = 0;\r\n for (let i = i0; i < i0 + 3; i++) {\r\n const k = 2 * indices[i];\r\n this.paramIndex.push(indices[i]);\r\n this.param.pushXY(sourceParams[k], sourceParams[k + 1]);\r\n }\r\n for (let i = 0; i < this._numWrap; i++) {\r\n this.param.pushFromGrowableXYArray(this.param, i);\r\n }\r\n }\r\n\r\n const sourceNormals = this._polyface.normals;\r\n if (sourceNormals.length > 0 && this.normalIndex && this.normal) {\r\n this.normalIndex.length = 0;\r\n this.normal.length = 0;\r\n for (let i = i0; i < i0 + 3; i++) {\r\n const k = 3 * indices[i];\r\n this.normalIndex.push(indices[i]);\r\n this.normal.pushXYZ(sourceNormals[k], sourceNormals[k + 1], sourceNormals[k + 2]);\r\n }\r\n for (let i = 0; i < this._numWrap; i++) {\r\n this.normal.pushFromGrowableXYZArray(this.normal, i);\r\n }\r\n }\r\n return true;\r\n }\r\n public moveToNextFacet(): boolean {\r\n return this.moveToReadIndex(this._nextFacetIndex);\r\n }\r\n /** Set the number of vertices to replicate in visitor arrays. */\r\n public setNumWrap(numWrap: number): void { this._numWrap = numWrap; }\r\n\r\n /** Return the index (in the client polyface) of the current facet */\r\n public currentReadIndex(): number { return this._currentFacetIndex; }\r\n /** Return the point index of vertex i within the currently loaded facet */\r\n public clientPointIndex(i: number): number { return this.pointIndex[i]; }\r\n /** Return the param index of vertex i within the currently loaded facet.\r\n * Use the artificial paramIndex, which matches pointIndex.\r\n */\r\n public clientParamIndex(i: number): number { return this.paramIndex ? this.paramIndex[i] : -1; }\r\n /** Return the normal index of vertex i within the currently loaded facet.\r\n * Use the artificial paramIndex, which matches pointIndex.\r\n */\r\n public clientNormalIndex(i: number): number { return this.normalIndex ? this.normalIndex[i] : -1; }\r\n /** Return the color index of vertex i within the currently loaded facet */\r\n public clientColorIndex(_i: number): number { return 1; }\r\n /** Return the aux data index of vertex i within the currently loaded facet */\r\n public clientAuxIndex(_i: number): number { return -1; }\r\n\r\n /** return the client polyface */\r\n public clientPolyface(): Polyface { return (undefined as unknown) as Polyface; }\r\n /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */\r\n public clearArrays(): void {\r\n if (this.point !== undefined)\r\n this.point.length = 0;\r\n if (this.param !== undefined)\r\n this.param.length = 0;\r\n if (this.normal !== undefined)\r\n this.normal.length = 0;\r\n // ignore color and aux -- they never exist.\r\n }\r\n /** transfer interpolated data from the other visitor.\r\n * * all data values are interpolated at `fraction` between `other` values at index0 and index1.\r\n */\r\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\r\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\r\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\r\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\r\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\r\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\r\n }\r\n /** transfer data from a specified index of the other visitor as new data in this visitor. */\r\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\r\n this.point.pushFromGrowableXYZArray(other.point, index);\r\n if (this.color && other.color && index < other.color.length)\r\n this.color.push(other.color[index]);\r\n if (this.param && other.param && index < other.param.length)\r\n this.param.pushFromGrowableXYArray(other.param, index);\r\n if (this.normal && other.normal && index < other.normal.length)\r\n this.normal.pushFromGrowableXYZArray(other.normal, index);\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalSource.d.ts","sourceRoot":"","sources":["../../src/ExternalSource.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EACQ,IAAI,EAAiB,6BAA6B,EAAE,4BAA4B,EAAE,mBAAmB,EAClH,8BAA8B,EAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,2BAA2B,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,sCAAsC,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAEhH;;;GAGG;AACH,qBAAa,cAAe,SAAQ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CAAC,aAAa,CAAC,CAAC;SAC1G;IACH,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,UAAU,CAAC,QAAkB,EAAE,cAA0B,EAAE,SAAiB;QACxF,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,yBAAW,CAAC,wBAAwB,CAAC,CAAC;QACpF,OAAO,IAAI,kBAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAClF,CAAC;CACF;AA/CD,4DA+CC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,cAAc;IACrD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAChF,gBAAgB;IAChB,YAAmB,KAA0B,EAAE,MAAgB;QAC7D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAPD,kDAOC;AAED;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,iBAAO;IAKpD,gBAAgB;IAChB,YAAmB,KAAqC,EAAE,MAAgB;QACxE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;IALD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,2BAA2B,CAAC,CAAC,CAAC;IAKtF,gBAAgB;IACA,MAAM;QACpB,OAAO,KAAK,CAAC,MAAM,EAAoC,CAAC,CAAC,sDAAsD;IACjH,CAAC;CACF;AAbD,8DAaC","sourcesContent":["\r\n/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { Point3d } from \"@itwin/core-geometry\";\r\nimport {\r\n BisCodeSpec, Code, CodeScopeSpec, ExternalSourceAttachmentProps, ExternalSourceAttachmentRole, ExternalSourceProps, IModel, RelatedElement,\r\n SynchronizationConfigLinkProps,\r\n} from \"@itwin/core-common\";\r\nimport { InformationReferenceElement, UrlLink } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { ExternalSourceAttachmentAttachesSource, ExternalSourceIsInRepository } from \"./NavigationRelationship\";\r\n\r\n/** An ExternalSource refers to an 'information container' found in a repository. In some cases, the container is the entire repository.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSource extends InformationReferenceElement {\r\n /** The repository that contains this ExternalSource. */\r\n public repository?: ExternalSourceIsInRepository;\r\n /** The name of the iModel Connecter that processed this ExternalSource. */\r\n public connectorName?: string;\r\n /** The version of the iModel Connecter that processed this ExternalSource. */\r\n public connectorVersion?: string;\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSource\"; }\r\n /** @internal */\r\n public constructor(props: ExternalSourceProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n if (props.repository) this.repository = new ExternalSourceIsInRepository(RelatedElement.idFromJson(props.repository));\r\n }\r\n /** @internal */\r\n public override toJSON(): ExternalSourceProps { // This override only specializes the return type\r\n return super.toJSON() as ExternalSourceProps; // Entity.toJSON takes care of auto-handled properties\r\n }\r\n /** The [[CodeSpec]] for ExternalSource elements is not automatically created, so this method ensures that it exists. */\r\n public static ensureCodeSpec(iModelDb: IModelDb): Id64String {\r\n try {\r\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSource);\r\n return codeSpec.id;\r\n } catch (e) {\r\n return iModelDb.codeSpecs.insert(BisCodeSpec.externalSource, CodeScopeSpec.Type.Repository);\r\n }\r\n }\r\n /** Create a Code for an ExternalSource element given a name that is meant to be unique within the scope of the iModel.\r\n * @param iModelDb The IModelDb\r\n * @param codeValue The ExternalSource name\r\n * @see [[ensureCodeSpec]]\r\n */\r\n public static createCode(iModelDb: IModelDb, codeValue: string): Code {\r\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSource);\r\n return new Code({ spec: codeSpec.id, scope: IModel.rootSubjectId, value: codeValue });\r\n }\r\n}\r\n\r\n/** Attachment of an ExternalSource\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceAttachment extends InformationReferenceElement {\r\n /** The [[ExternalSource]] that is attached by this ExternalSourceAttachment. */\r\n public attaches?: ExternalSourceAttachmentAttachesSource;\r\n /** Specifies whether the attached [[ExternalSource]] provides context or models a part of the whole. */\r\n public role?: ExternalSourceAttachmentRole;\r\n /** The translation or offset in global coordinates of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public translation?: Point3d;\r\n /** The Yaw angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public yaw?: number;\r\n /** The Pitch angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public pitch?: number;\r\n /** The Roll angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public roll?: number;\r\n /** The scale of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public scale?: Point3d;\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSourceAttachment\"; }\r\n /** @internal */\r\n public constructor(props: ExternalSourceAttachmentProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n if (props.attaches) this.attaches = new ExternalSourceAttachmentAttachesSource(RelatedElement.idFromJson(props.attaches));\r\n if (props.translation) this.translation = Point3d.fromJSON(props.translation);\r\n if (props.scale) this.scale = Point3d.fromJSON(props.scale);\r\n }\r\n /** @internal */\r\n public override toJSON(): ExternalSourceAttachmentProps { // This override only specializes the return type\r\n return super.toJSON() as ExternalSourceAttachmentProps; // Entity.toJSON takes care of auto-handled properties\r\n }\r\n /** The [[CodeSpec]] for ExternalSourceAttachment elements is not automatically created, so this method ensures that it exists. */\r\n public static ensureCodeSpec(iModelDb: IModelDb): Id64String {\r\n try {\r\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSourceAttachment);\r\n return codeSpec.id;\r\n } catch (e) {\r\n return iModelDb.codeSpecs.insert(BisCodeSpec.externalSourceAttachment, CodeScopeSpec.Type.ParentElement);\r\n }\r\n }\r\n /** Create a Code for an ExternalSourceAttachment element given a name that is meant to be unique within the scope of its parent [[ExternalSource]].\r\n * @param iModelDb The IModelDb\r\n * @param scopeElementId The parent ExternalSource\r\n * @param codeValue The ExternalSourceAttachment name\r\n * @see [[ensureCodeSpec]]\r\n */\r\n public static createCode(iModelDb: IModelDb, scopeElementId: Id64String, codeValue: string): Code {\r\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSourceAttachment);\r\n return new Code({ spec: codeSpec.id, scope: scopeElementId, value: codeValue });\r\n }\r\n}\r\n\r\n/** A group of ExternalSources that are collectively a source of information for one or more elements.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceGroup extends ExternalSource {\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSourceGroup\"; }\r\n /** @internal */\r\n public constructor(props: ExternalSourceProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** Link to the Configuration for an iModel Synchronization Job\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class SynchronizationConfigLink extends UrlLink {\r\n /** Date/Time of last successful run of this synchronization configuration */\r\n public lastSuccessfulRun?: string;\r\n /** @internal */\r\n public static override get className(): string { return \"SynchronizationConfigLink\"; }\r\n /** @internal */\r\n public constructor(props: SynchronizationConfigLinkProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n /** @internal */\r\n public override toJSON(): SynchronizationConfigLinkProps { // This override only specializes the return type\r\n return super.toJSON() as SynchronizationConfigLinkProps; // Entity.toJSON takes care of auto-handled properties\r\n }\r\n}\r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C,UAAU,CAAC,QAAkB,EAAE,cAA0B,EAAE,SAAiB;QACxF,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,yBAAW,CAAC,wBAAwB,CAAC,CAAC;QACpF,OAAO,IAAI,kBAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAClF,CAAC;CACF;AApDD,4DAoDC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,cAAc;IACrD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAChF,gBAAgB;IAChB,YAAmB,KAA0B,EAAE,MAAgB;QAC7D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAPD,kDAOC;AAED;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,iBAAO;IAKpD,gBAAgB;IAChB,YAAmB,KAAqC,EAAE,MAAgB;QACxE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;IALD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,2BAA2B,CAAC,CAAC,CAAC;IAKtF,gBAAgB;IACA,MAAM;QACpB,OAAO,KAAK,CAAC,MAAM,EAAoC,CAAC,CAAC,sDAAsD;IACjH,CAAC;CACF;AAbD,8DAaC","sourcesContent":["\r\n/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { Point3d } from \"@itwin/core-geometry\";\r\nimport {\r\n BisCodeSpec, Code, CodeScopeSpec, ExternalSourceAttachmentProps, ExternalSourceAttachmentRole, ExternalSourceProps, IModel, RelatedElement,\r\n SynchronizationConfigLinkProps,\r\n} from \"@itwin/core-common\";\r\nimport { InformationReferenceElement, UrlLink } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { ExternalSourceAttachmentAttachesSource, ExternalSourceIsInRepository } from \"./NavigationRelationship\";\r\n\r\n/** An ExternalSource refers to an 'information container' found in a repository. In some cases, the container is the entire repository.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSource extends InformationReferenceElement {\r\n /** The repository that contains this ExternalSource. */\r\n public repository?: ExternalSourceIsInRepository;\r\n /** The name of the iModel Connecter that processed this ExternalSource. */\r\n public connectorName?: string;\r\n /** The version of the iModel Connecter that processed this ExternalSource. */\r\n public connectorVersion?: string;\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSource\"; }\r\n /** @internal */\r\n public constructor(props: ExternalSourceProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n if (props.repository)\r\n this.repository = new ExternalSourceIsInRepository(RelatedElement.idFromJson(props.repository));\r\n }\r\n /** @internal */\r\n public override toJSON(): ExternalSourceProps { // This override only specializes the return type\r\n return super.toJSON() as ExternalSourceProps; // Entity.toJSON takes care of auto-handled properties\r\n }\r\n /** The [[CodeSpec]] for ExternalSource elements is not automatically created, so this method ensures that it exists. */\r\n public static ensureCodeSpec(iModelDb: IModelDb): Id64String {\r\n try {\r\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSource);\r\n return codeSpec.id;\r\n } catch (e) {\r\n return iModelDb.codeSpecs.insert(BisCodeSpec.externalSource, CodeScopeSpec.Type.Repository);\r\n }\r\n }\r\n /** Create a Code for an ExternalSource element given a name that is meant to be unique within the scope of the iModel.\r\n * @param iModelDb The IModelDb\r\n * @param codeValue The ExternalSource name\r\n * @see [[ensureCodeSpec]]\r\n */\r\n public static createCode(iModelDb: IModelDb, codeValue: string): Code {\r\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSource);\r\n return new Code({ spec: codeSpec.id, scope: IModel.rootSubjectId, value: codeValue });\r\n }\r\n}\r\n\r\n/** Attachment of an ExternalSource\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceAttachment extends InformationReferenceElement {\r\n /** The [[ExternalSource]] that is attached by this ExternalSourceAttachment. */\r\n public attaches?: ExternalSourceAttachmentAttachesSource;\r\n /** Specifies whether the attached [[ExternalSource]] provides context or models a part of the whole. */\r\n public role?: ExternalSourceAttachmentRole;\r\n /** The translation or offset in global coordinates of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public translation?: Point3d;\r\n /** The Yaw angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public yaw?: number;\r\n /** The Pitch angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public pitch?: number;\r\n /** The Roll angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public roll?: number;\r\n /** The scale of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public scale?: Point3d;\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSourceAttachment\"; }\r\n /** @internal */\r\n public constructor(props: ExternalSourceAttachmentProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n if (props.attaches)\r\n this.attaches = new ExternalSourceAttachmentAttachesSource(RelatedElement.idFromJson(props.attaches));\r\n\r\n if (props.translation)\r\n this.translation = Point3d.fromJSON(props.translation);\r\n\r\n if (props.scale)\r\n this.scale = Point3d.fromJSON(props.scale);\r\n }\r\n /** @internal */\r\n public override toJSON(): ExternalSourceAttachmentProps { // This override only specializes the return type\r\n return super.toJSON() as ExternalSourceAttachmentProps; // Entity.toJSON takes care of auto-handled properties\r\n }\r\n /** The [[CodeSpec]] for ExternalSourceAttachment elements is not automatically created, so this method ensures that it exists. */\r\n public static ensureCodeSpec(iModelDb: IModelDb): Id64String {\r\n try {\r\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSourceAttachment);\r\n return codeSpec.id;\r\n } catch (e) {\r\n return iModelDb.codeSpecs.insert(BisCodeSpec.externalSourceAttachment, CodeScopeSpec.Type.ParentElement);\r\n }\r\n }\r\n /** Create a Code for an ExternalSourceAttachment element given a name that is meant to be unique within the scope of its parent [[ExternalSource]].\r\n * @param iModelDb The IModelDb\r\n * @param scopeElementId The parent ExternalSource\r\n * @param codeValue The ExternalSourceAttachment name\r\n * @see [[ensureCodeSpec]]\r\n */\r\n public static createCode(iModelDb: IModelDb, scopeElementId: Id64String, codeValue: string): Code {\r\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSourceAttachment);\r\n return new Code({ spec: codeSpec.id, scope: scopeElementId, value: codeValue });\r\n }\r\n}\r\n\r\n/** A group of ExternalSources that are collectively a source of information for one or more elements.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceGroup extends ExternalSource {\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSourceGroup\"; }\r\n /** @internal */\r\n public constructor(props: ExternalSourceProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** Link to the Configuration for an iModel Synchronization Job\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class SynchronizationConfigLink extends UrlLink {\r\n /** Date/Time of last successful run of this synchronization configuration */\r\n public lastSuccessfulRun?: string;\r\n /** @internal */\r\n public static override get className(): string { return \"SynchronizationConfigLink\"; }\r\n /** @internal */\r\n public constructor(props: SynchronizationConfigLinkProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n /** @internal */\r\n public override toJSON(): SynchronizationConfigLinkProps { // This override only specializes the return type\r\n return super.toJSON() as SynchronizationConfigLinkProps; // Entity.toJSON takes care of auto-handled properties\r\n }\r\n}\r\n\r\n"]}
|
|
@@ -238,7 +238,7 @@ class ResponseGenerator {
|
|
|
238
238
|
case "box":
|
|
239
239
|
const box = solid;
|
|
240
240
|
return `${summary}'
|
|
241
|
-
'
|
|
241
|
+
' origin: ${JSON.stringify(box.getBaseOrigin().toJSON())}'
|
|
242
242
|
' topOrigin: ${JSON.stringify(box.getTopOrigin().toJSON())}'
|
|
243
243
|
' baseX: ${box.getBaseX()}'
|
|
244
244
|
' baseY: ${box.getBaseY()}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeometrySummary.js","sourceRoot":"","sources":["../../src/GeometrySummary.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAgG;AAChG,wDAK8B;AAC9B,oDAG4B;AAC5B,uCAAoE;AAQpE,uBAAuB;AAEvB,yDAAyD;AACzD,MAAM,iBAAiB;IAUrB,YAAmB,OAAoC,EAAE,MAAgB;QATlE,cAAS,GAAG,sCAAwB,CAAC,KAAK,CAAC;QAC3C,qBAAgB,GAAG,KAAK,CAAC;QAEzB,qBAAgB,GAAG,KAAK,CAAC;QAO9B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;QAC7B,IAAI,SAAS,KAAK,IAAI,EAAE;YACtB,IAAI,CAAC,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,sCAAwB,CAAC,KAAK,CAAC;YAChH,IAAI,CAAC,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAC,gBAAgB,CAAC;YACvD,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACxD,IAAI,CAAC,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAC,gBAAgB,CAAC;SACxD;IACH,CAAC;IAZD,IAAW,UAAU,KAAK,OAAO,sCAAwB,CAAC,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,CAAC;IAEM,wBAAwB,CAAC,MAAuB;QACrD,IAAI,OAAO,GAAW,EAAE,CAAC;QACzB,QAAQ,MAAM,CAAC,mBAAmB,EAAE;YAClC,KAAK,MAAM;gBACT,MAAM,IAAI,GAAS,MAAc,CAAC;gBAClC,OAAO,GAAG,GAAG,OAAO,aAAa,IAAI,CAAC,OAAO,EAAE,CAAC;gBAChD,MAAM;YACR,KAAK,MAAM;gBACT,MAAM,IAAI,GAAS,MAAc,CAAC;gBAClC,OAAO,GAAG,GAAG,OAAO,YAAY,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClD,MAAM;SACT;QAED,OAAO,GAAG,OAAO;mBACF,MAAM,CAAC,sBAAsB,EAAE,CAAC,MAAM;kBACvC,MAAM,CAAC,eAAe,EAAE,EAAE,CAAC;IAC3C,CAAC;CACF;AAED,gBAAgB;AAChB,SAAgB,yBAAyB,CAAC,OAAoC,EAAE,MAAgB;IAC9F,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC,iBAAiB,EAAE,CAAC;AACvC,CAAC;AAHD,8DAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { assert, BentleyError, Id64Array, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport {\r\n AkimaCurve3d, AnyGeometryQuery, Arc3d, BezierCurveBase, Box, BSplineCurve3d, Cone, CurveChainWithDistanceIndex, CurveCollection, CurvePrimitive, IModelJson,\r\n InterpolationCurve3d,\r\n LinearSweep, LineSegment3d, LineString3d, Loop, Path, Range3d, RotationalSweep, RuledSweep, SolidPrimitive, Sphere, TorusPipe, Transform,\r\n TransitionSpiral3d, UVSelect,\r\n} from \"@itwin/core-geometry\";\r\nimport {\r\n BRepEntity, GeometryParams, GeometryStreamIterator, GeometrySummaryRequestProps, GeometrySummaryVerbosity, ImagePrimitive,\r\n IModelError, TextStringPrimitive,\r\n} from \"@itwin/core-common\";\r\nimport { Element, GeometricElement, GeometryPart } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\ninterface ElementGeom {\r\n iterator: GeometryStreamIterator;\r\n geometricElement?: GeometricElement;\r\n}\r\n\r\n// cspell:ignore earlin\r\n\r\n/** Generates an array of GeometryStreamResponseProps. */\r\nclass ResponseGenerator {\r\n public verbosity = GeometrySummaryVerbosity.Basic;\r\n public includePlacement = false;\r\n public includePartReferences?: \"2d\" | \"3d\";\r\n public verboseSymbology = false;\r\n public elementIds: Id64Array;\r\n public iModel: IModelDb;\r\n\r\n public get wantSquish() { return GeometrySummaryVerbosity.Full !== this.verbosity; }\r\n\r\n public constructor(request: GeometrySummaryRequestProps, iModel: IModelDb) {\r\n this.elementIds = request.elementIds;\r\n this.iModel = iModel;\r\n const opts = request.options;\r\n if (undefined !== opts) {\r\n this.verbosity = undefined !== opts.geometryVerbosity ? opts.geometryVerbosity : GeometrySummaryVerbosity.Basic;\r\n this.includePlacement = true === opts.includePlacement;\r\n this.includePartReferences = opts.includePartReferences;\r\n this.verboseSymbology = true === opts.verboseSymbology;\r\n }\r\n }\r\n\r\n public generateSummaries(): string {\r\n const summaries: string[] = [];\r\n for (const elementId of this.elementIds)\r\n summaries.push(this.generateSummary(elementId));\r\n\r\n return summaries.join(\"\\n\");\r\n }\r\n\r\n public generateSummary(id: Id64String): string {\r\n let lines = [`[Geometry Summary for Element ${id}]`];\r\n try {\r\n const geom = this.getElementGeom(id);\r\n if (undefined === geom)\r\n throw new IModelError(IModelStatus.NoGeometry, \"Element is neither a geometric element nor a geometry part\");\r\n\r\n if (undefined !== geom.geometricElement)\r\n lines.push(this.summarizeElement(geom.geometricElement));\r\n else if (undefined !== this.includePartReferences)\r\n lines.push(this.summarizePartReferences(id, \"2d\" === this.includePartReferences)); // NB: Hideously inefficient if more than one element's summary was requested.\r\n\r\n let curGeomParams: GeometryParams | undefined;\r\n let curLocalRange: Range3d | undefined;\r\n for (const entry of geom.iterator) {\r\n if (this.verboseSymbology && (undefined === curGeomParams || !curGeomParams.isEquivalent(entry.geomParams))) {\r\n lines.push(`Symbology: ${this.stringify(entry.geomParams)}`);\r\n curGeomParams = entry.geomParams.clone();\r\n }\r\n\r\n if (undefined !== entry.localRange && (undefined === curLocalRange || !curLocalRange.isAlmostEqual(entry.localRange))) {\r\n lines.push(this.summarizeRange3d(entry.localRange));\r\n curLocalRange = entry.localRange;\r\n }\r\n\r\n const prim = entry.primitive;\r\n switch (prim.type) {\r\n case \"textString\":\r\n case \"image\":\r\n this.summarizePrimitive(lines, prim);\r\n break;\r\n case \"brep\":\r\n this.summarizeBRep(lines, prim.brep);\r\n break;\r\n case \"geometryQuery\":\r\n this.summarizeGeometryQuery(lines, prim.geometry);\r\n break;\r\n case \"partReference\":\r\n lines.push(this.summarizePartReference(prim.part.id, prim.part.toLocal));\r\n break;\r\n }\r\n }\r\n } catch (err) {\r\n lines = lines.slice(0, 1);\r\n lines.push(`ERROR: ${BentleyError.getErrorMessage(err)}`);\r\n }\r\n\r\n return lines.filter((line) => line !== \"\").join(\"\\n\");\r\n }\r\n\r\n public summarizeElement(elem: GeometricElement): string {\r\n const lines: string[] = [];\r\n lines.push(`(${elem.is2d() ? \"2D\" : \"3D\"}) Category: ${elem.category}`);\r\n lines.push(`Model: ${elem.model}`);\r\n if (this.includePlacement) {\r\n lines.push(`Range: ${this.stringify(elem.calculateRange3d())}`);\r\n lines.push(`Transform: ${this.stringify(elem.getPlacementTransform())}`);\r\n }\r\n\r\n return lines.join(\"\\n\");\r\n }\r\n\r\n public summarizePartReferences(id: Id64String, is2d: boolean): string {\r\n const refIds = this.iModel.nativeDb.findGeometryPartReferences([id], is2d);\r\n return `Part references (${refIds.length}): ${refIds.join()}`;\r\n }\r\n\r\n public getElementGeom(id: Id64String): ElementGeom | undefined {\r\n const elem = this.iModel.elements.getElement<Element>({ id, wantGeometry: true });\r\n let iterator: GeometryStreamIterator | undefined;\r\n let geometricElement: GeometricElement | undefined;\r\n if (elem instanceof GeometricElement) {\r\n geometricElement = elem;\r\n if (geometricElement.is2d()) {\r\n iterator = GeometryStreamIterator.fromGeometricElement2d(geometricElement);\r\n } else {\r\n assert(geometricElement.is3d());\r\n iterator = GeometryStreamIterator.fromGeometricElement3d(geometricElement);\r\n }\r\n } else if (elem instanceof GeometryPart) {\r\n iterator = GeometryStreamIterator.fromGeometryPart(elem);\r\n }\r\n\r\n return undefined !== iterator ? { iterator, geometricElement } : undefined;\r\n }\r\n\r\n public summarizeRange3d(range: Range3d): string {\r\n return `SubGraphicRange: ${this.stringify(range)}`;\r\n }\r\n\r\n public summarizePrimitive(lines: string[], primitive: TextStringPrimitive | ImagePrimitive): void {\r\n const summary = primitive.type;\r\n if (GeometrySummaryVerbosity.Basic >= this.verbosity) {\r\n lines.push(summary);\r\n return;\r\n }\r\n\r\n const json = this.stringify(primitive.type === \"textString\" ? primitive.textString : primitive.image);\r\n if (GeometrySummaryVerbosity.Detailed >= this.verbosity) {\r\n lines.push(`${summary}: ${json}`);\r\n return;\r\n }\r\n\r\n lines.push(`${summary}:`);\r\n lines.push(json);\r\n }\r\n\r\n public summarizeBRep(lines: string[], brep: BRepEntity.DataProps): void {\r\n const summary = \"brep\";\r\n if (GeometrySummaryVerbosity.Basic >= this.verbosity) {\r\n lines.push(summary);\r\n return;\r\n }\r\n\r\n const json = this.stringify({ type: brep.type, transform: brep.transform, faceSymbology: brep.faceSymbology });\r\n if (GeometrySummaryVerbosity.Detailed >= this.verbosity) {\r\n lines.push(`${summary}: ${json}`);\r\n return;\r\n }\r\n\r\n lines.push(`${summary}:`);\r\n lines.push(json);\r\n }\r\n\r\n public summarizePartReference(partId: string, partToLocal?: Transform): string {\r\n let line = `part id: ${partId}`;\r\n if (undefined !== partToLocal)\r\n line = `${line} transform: ${this.stringify(partToLocal)}`;\r\n\r\n return line;\r\n }\r\n\r\n public summarizeGeometryQuery(lines: string[], query: AnyGeometryQuery): void {\r\n switch (this.verbosity) {\r\n case GeometrySummaryVerbosity.Detailed:\r\n lines.push(this.summarizeGeometryQueryDetailed(query));\r\n break;\r\n case GeometrySummaryVerbosity.Full:\r\n lines.push(this.summarizeGeometryQueryFull(query));\r\n break;\r\n default:\r\n lines.push(this.summarizeGeometryQueryBasic(query));\r\n break;\r\n }\r\n }\r\n\r\n public summarizeGeometryQueryBasic(query: AnyGeometryQuery): string {\r\n switch (query.geometryCategory) {\r\n case \"solid\":\r\n return query.solidPrimitiveType;\r\n case \"curvePrimitive\":\r\n return query.curvePrimitiveType;\r\n case \"curveCollection\":\r\n return query.curveCollectionType;\r\n default:\r\n return query.geometryCategory;\r\n }\r\n }\r\n\r\n public summarizeGeometryQueryFull(query: AnyGeometryQuery): string {\r\n return this.geometryQueryToJson(query);\r\n }\r\n\r\n public geometryQueryToJson(query: AnyGeometryQuery): string {\r\n try {\r\n const json = IModelJson.Writer.toIModelJson(query);\r\n const str = JSON.stringify(json);\r\n return this.wantSquish ? this.squish(str) : str;\r\n } catch (err) {\r\n return BentleyError.getErrorMessage(err);\r\n }\r\n }\r\n\r\n // Earlin likes to put tons of whitespace + newlines into his JSON. Remove it.\r\n public squish(str: string): string {\r\n return str.replace(/\\s+/g, \"\");\r\n }\r\n\r\n public stringify(obj: object): string {\r\n const json = JSON.stringify(obj);\r\n return this.wantSquish ? this.squish(json) : json;\r\n }\r\n\r\n public summarizeGeometryQueryDetailed(query: AnyGeometryQuery): string {\r\n let summary = `${this.summarizeGeometryQueryBasic(query)}: `;\r\n switch (query.geometryCategory) {\r\n case \"solid\":\r\n return summary + this.summarizeSolidPrimitive(query);\r\n case \"curvePrimitive\":\r\n return summary + this.summarizeCurvePrimitive(query);\r\n case \"curveCollection\":\r\n return summary + this.summarizeCurveCollection(query);\r\n case \"pointCollection\":\r\n return `${summary} numPoints: ${query.points.length}`;\r\n case \"bsurf\":\r\n return `${summary}'\r\n ' poleDimension: ${query.poleDimension}'\r\n ' numPolesTotal: ${query.numPolesTotal()}'\r\n ' degree[U,V]: ${JSON.stringify([query.degreeUV(UVSelect.uDirection), query.degreeUV(UVSelect.VDirection)])}'\r\n ' order[U,V]: ${JSON.stringify([query.orderUV(UVSelect.uDirection), query.orderUV(UVSelect.VDirection)])}'\r\n ' numSpan[U,V]: ${JSON.stringify([query.numSpanUV(UVSelect.uDirection), query.numSpanUV(UVSelect.VDirection)])}'\r\n ' numPoles[U,V]: ${JSON.stringify([query.numPolesUV(UVSelect.uDirection), query.numPolesUV(UVSelect.VDirection)])}'\r\n ' poleStep[U,V]: ${JSON.stringify([query.poleStepUV(UVSelect.uDirection), query.poleStepUV(UVSelect.VDirection)])}`;\r\n case \"polyface\": {\r\n const data = query.data;\r\n summary = `${summary} pointCount: ${data.point.length}'\r\n ' pointIndexCount: ${data.pointIndex.length}`;\r\n if (query.twoSided)\r\n summary = `${summary} (two-sided)`;\r\n if (undefined !== data.normal)\r\n summary = `${summary} normalCount: ${data.normal.length}`;\r\n if (undefined !== data.param)\r\n summary = `${summary} paramCount: ${data.param.length}`;\r\n if (undefined !== data.color)\r\n summary = `${summary} colorCount: ${data.color.length}`;\r\n\r\n return summary;\r\n }\r\n case \"point\":\r\n return summary + this.geometryQueryToJson(query);\r\n }\r\n }\r\n\r\n public summarizeSolidPrimitive(solid: SolidPrimitive): string {\r\n const summary: string = solid.capped ? \" capped\" : \" uncapped\";\r\n switch (solid.solidPrimitiveType) {\r\n case \"box\":\r\n const box: Box = (solid as Box);\r\n return `${summary}'\r\n ' baseOrigin: ${JSON.stringify(box.getBaseOrigin().toJSON())}'\r\n ' topOrigin: ${JSON.stringify(box.getTopOrigin().toJSON())}'\r\n ' baseX: ${box.getBaseX()}'\r\n ' baseY: ${box.getBaseY()}`;\r\n case \"cone\":\r\n const cone: Cone = solid as Cone;\r\n return `${summary}'\r\n ' baseCenterPoint: ${JSON.stringify(cone.getCenterA())}'\r\n ' topCenterPoint: ${JSON.stringify(cone.getCenterB())}'\r\n ' baseCenterRadius: ${JSON.stringify(cone.getRadiusA())}'\r\n ' topCenterRadius: ${JSON.stringify(cone.getRadiusB())}`;\r\n case \"sphere\":\r\n const sphere: Sphere = solid as Sphere;\r\n return `${summary}'\r\n ' centerPoint: ${JSON.stringify(sphere.cloneCenter().toJSON())}'\r\n ' radius: ${JSON.stringify(sphere.trueSphereRadius())}`;\r\n case \"linearSweep\":\r\n const linearSweep: LinearSweep = solid as LinearSweep;\r\n return `${summary}'\r\n ' vector: ${linearSweep.cloneSweepVector().toJSON()}'\r\n ' curves${this.summarizeCurveCollection(linearSweep.getCurvesRef())}`;\r\n case \"rotationalSweep\":\r\n const rotationalSweep: RotationalSweep = solid as RotationalSweep;\r\n const axis = rotationalSweep.cloneAxisRay();\r\n return `${summary}'\r\n ' center: ${axis.origin.toJSON()}'\r\n ' axis: ${JSON.stringify(axis.direction.toJSON())}'\r\n ' sweepAngle: ${rotationalSweep.getSweep().degrees}`;\r\n case \"ruledSweep\":\r\n const ruledSweep: RuledSweep = solid as RuledSweep;\r\n const summarizedCollection = ruledSweep.cloneContours().map((curveCollection) => this.summarizeCurveCollection(curveCollection));\r\n return `${summary}'\r\n ' isClosedVolume${ruledSweep.isClosedVolume}'\r\n ' contours: ${JSON.stringify(summarizedCollection)}`;\r\n case \"torusPipe\":\r\n const torusPipe: TorusPipe = solid as TorusPipe;\r\n const vectorX = torusPipe.cloneVectorX();\r\n const vectorY = torusPipe.cloneVectorY();\r\n const sweep = torusPipe.getSweepAngle();\r\n if (torusPipe.getIsReversed()) {\r\n vectorY.scaleInPlace(-1.0);\r\n sweep.setRadians(-sweep.radians);\r\n }\r\n return `${summary}'\r\n ' center: ${torusPipe.cloneCenter().toJSON()}'\r\n ' xyVectors: ${JSON.stringify([vectorX.toJSON(), vectorY.toJSON()])}'\r\n ' majorRadius: ${torusPipe.getMajorRadius()}'\r\n ' minorRadius: ${torusPipe.getMinorRadius()}'\r\n ' sweepAngle: ${sweep.degrees}`;\r\n }\r\n }\r\n\r\n public summarizeCurvePrimitive(curve: CurvePrimitive): string {\r\n let summary: string = \"\";\r\n const writer = new IModelJson.Writer();\r\n switch (curve.curvePrimitiveType) {\r\n case \"arc\":\r\n const arc: Arc3d = curve as Arc3d;\r\n summary = `${summary} center: ${JSON.stringify(arc.center.toJSON())}`;\r\n if (undefined !== arc.circularRadius)\r\n summary = `${summary} radius: ${arc.circularRadius()}`;\r\n summary = `${summary}'\r\n ' vectorX:${arc.vector0.toJSON()}'\r\n ' vectorY:${arc.vector90.toJSON()}'\r\n ' sweepStartEnd [${arc.sweep.startDegrees}, ${arc.sweep.endDegrees}]`\r\n + ` curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"lineSegment\":\r\n const lineSegment: LineSegment3d = curve as LineSegment3d;\r\n summary = `${summary} points: ${JSON.stringify(lineSegment.toJSON())}`;\r\n summary = `${summary} curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"lineString\":\r\n const lineString: LineString3d = curve as LineString3d;\r\n summary = `${summary} pointCount: ${lineString.numPoints()}'\r\n ' curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"bsplineCurve\":\r\n const bsplineCurve: BSplineCurve3d = curve as BSplineCurve3d;\r\n summary = `${summary}'\r\n ' curveOrder: ${bsplineCurve.order}'\r\n ' controlPointsCount: ${bsplineCurve.numPoles}'\r\n ' curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"interpolationCurve\":\r\n const interpolationCurve: InterpolationCurve3d = curve as InterpolationCurve3d;\r\n const interpolationProps = interpolationCurve.cloneProps();\r\n summary = `${summary}'\r\n ' curveOrder: ${interpolationProps.order}'\r\n ' controlPointsCount: ${interpolationProps.fitPoints.length}`;\r\n return summary;\r\n case \"akimaCurve\":\r\n const akimaCurve: AkimaCurve3d = curve as AkimaCurve3d;\r\n const akimaProps = akimaCurve.cloneProps();\r\n summary = `${summary}'\r\n ' controlPointsCount: ${akimaProps.fitPoints.length}`;\r\n return summary;\r\n case \"bezierCurve\":\r\n const bezierCurve: BezierCurveBase = curve as BezierCurveBase;\r\n summary = `${summary}'\r\n ' curveOrder: ${bezierCurve.order}'\r\n ' controlPointsCount: ${bezierCurve.numPoles}'\r\n ' curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"transitionSpiral\":\r\n const transitionSpiral: TransitionSpiral3d = curve as TransitionSpiral3d;\r\n const json = writer.handleTransitionSpiral(transitionSpiral);\r\n summary = summary + JSON.stringify(json);\r\n return summary;\r\n case \"curveChainWithDistanceIndex\":\r\n const curveChainWithDistanceIndex: CurveChainWithDistanceIndex = curve as CurveChainWithDistanceIndex;\r\n const path = curveChainWithDistanceIndex.path;\r\n summary = `${summary}'\r\n ' curveLength: ${curve.curveLength()}'\r\n ' isOpen: ${path.isOpenPath}`;\r\n return summary;\r\n }\r\n }\r\n\r\n public summarizeCurveCollection(curves: CurveCollection): string {\r\n let summary: string = \"\";\r\n switch (curves.curveCollectionType) {\r\n case \"loop\":\r\n const loop: Loop = curves as Loop;\r\n summary = `${summary} isInner: ${loop.isInner}`;\r\n break;\r\n case \"path\":\r\n const path: Path = curves as Path;\r\n summary = `${summary} isOpen: ${path.isOpenPath}`;\r\n break;\r\n }\r\n\r\n return `${summary}'\r\n ' numCurves: ${curves.collectCurvePrimitives().length}'\r\n ' boundary: ${curves.dgnBoundaryType()}`;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function generateGeometrySummaries(request: GeometrySummaryRequestProps, iModel: IModelDb): string {\r\n const generator = new ResponseGenerator(request, iModel);\r\n return generator.generateSummaries();\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"GeometrySummary.js","sourceRoot":"","sources":["../../src/GeometrySummary.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAgG;AAChG,wDAK8B;AAC9B,oDAG4B;AAC5B,uCAAoE;AAQpE,uBAAuB;AAEvB,yDAAyD;AACzD,MAAM,iBAAiB;IAUrB,YAAm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CACF;AAED,gBAAgB;AAChB,SAAgB,yBAAyB,CAAC,OAAoC,EAAE,MAAgB;IAC9F,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC,iBAAiB,EAAE,CAAC;AACvC,CAAC;AAHD,8DAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { assert, BentleyError, Id64Array, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport {\r\n AkimaCurve3d, AnyGeometryQuery, Arc3d, BezierCurveBase, Box, BSplineCurve3d, Cone, CurveChainWithDistanceIndex, CurveCollection, CurvePrimitive, IModelJson,\r\n InterpolationCurve3d,\r\n LinearSweep, LineSegment3d, LineString3d, Loop, Path, Range3d, RotationalSweep, RuledSweep, SolidPrimitive, Sphere, TorusPipe, Transform,\r\n TransitionSpiral3d, UVSelect,\r\n} from \"@itwin/core-geometry\";\r\nimport {\r\n BRepEntity, GeometryParams, GeometryStreamIterator, GeometrySummaryRequestProps, GeometrySummaryVerbosity, ImagePrimitive,\r\n IModelError, TextStringPrimitive,\r\n} from \"@itwin/core-common\";\r\nimport { Element, GeometricElement, GeometryPart } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\ninterface ElementGeom {\r\n iterator: GeometryStreamIterator;\r\n geometricElement?: GeometricElement;\r\n}\r\n\r\n// cspell:ignore earlin\r\n\r\n/** Generates an array of GeometryStreamResponseProps. */\r\nclass ResponseGenerator {\r\n public verbosity = GeometrySummaryVerbosity.Basic;\r\n public includePlacement = false;\r\n public includePartReferences?: \"2d\" | \"3d\";\r\n public verboseSymbology = false;\r\n public elementIds: Id64Array;\r\n public iModel: IModelDb;\r\n\r\n public get wantSquish() { return GeometrySummaryVerbosity.Full !== this.verbosity; }\r\n\r\n public constructor(request: GeometrySummaryRequestProps, iModel: IModelDb) {\r\n this.elementIds = request.elementIds;\r\n this.iModel = iModel;\r\n const opts = request.options;\r\n if (undefined !== opts) {\r\n this.verbosity = undefined !== opts.geometryVerbosity ? opts.geometryVerbosity : GeometrySummaryVerbosity.Basic;\r\n this.includePlacement = true === opts.includePlacement;\r\n this.includePartReferences = opts.includePartReferences;\r\n this.verboseSymbology = true === opts.verboseSymbology;\r\n }\r\n }\r\n\r\n public generateSummaries(): string {\r\n const summaries: string[] = [];\r\n for (const elementId of this.elementIds)\r\n summaries.push(this.generateSummary(elementId));\r\n\r\n return summaries.join(\"\\n\");\r\n }\r\n\r\n public generateSummary(id: Id64String): string {\r\n let lines = [`[Geometry Summary for Element ${id}]`];\r\n try {\r\n const geom = this.getElementGeom(id);\r\n if (undefined === geom)\r\n throw new IModelError(IModelStatus.NoGeometry, \"Element is neither a geometric element nor a geometry part\");\r\n\r\n if (undefined !== geom.geometricElement)\r\n lines.push(this.summarizeElement(geom.geometricElement));\r\n else if (undefined !== this.includePartReferences)\r\n lines.push(this.summarizePartReferences(id, \"2d\" === this.includePartReferences)); // NB: Hideously inefficient if more than one element's summary was requested.\r\n\r\n let curGeomParams: GeometryParams | undefined;\r\n let curLocalRange: Range3d | undefined;\r\n for (const entry of geom.iterator) {\r\n if (this.verboseSymbology && (undefined === curGeomParams || !curGeomParams.isEquivalent(entry.geomParams))) {\r\n lines.push(`Symbology: ${this.stringify(entry.geomParams)}`);\r\n curGeomParams = entry.geomParams.clone();\r\n }\r\n\r\n if (undefined !== entry.localRange && (undefined === curLocalRange || !curLocalRange.isAlmostEqual(entry.localRange))) {\r\n lines.push(this.summarizeRange3d(entry.localRange));\r\n curLocalRange = entry.localRange;\r\n }\r\n\r\n const prim = entry.primitive;\r\n switch (prim.type) {\r\n case \"textString\":\r\n case \"image\":\r\n this.summarizePrimitive(lines, prim);\r\n break;\r\n case \"brep\":\r\n this.summarizeBRep(lines, prim.brep);\r\n break;\r\n case \"geometryQuery\":\r\n this.summarizeGeometryQuery(lines, prim.geometry);\r\n break;\r\n case \"partReference\":\r\n lines.push(this.summarizePartReference(prim.part.id, prim.part.toLocal));\r\n break;\r\n }\r\n }\r\n } catch (err) {\r\n lines = lines.slice(0, 1);\r\n lines.push(`ERROR: ${BentleyError.getErrorMessage(err)}`);\r\n }\r\n\r\n return lines.filter((line) => line !== \"\").join(\"\\n\");\r\n }\r\n\r\n public summarizeElement(elem: GeometricElement): string {\r\n const lines: string[] = [];\r\n lines.push(`(${elem.is2d() ? \"2D\" : \"3D\"}) Category: ${elem.category}`);\r\n lines.push(`Model: ${elem.model}`);\r\n if (this.includePlacement) {\r\n lines.push(`Range: ${this.stringify(elem.calculateRange3d())}`);\r\n lines.push(`Transform: ${this.stringify(elem.getPlacementTransform())}`);\r\n }\r\n\r\n return lines.join(\"\\n\");\r\n }\r\n\r\n public summarizePartReferences(id: Id64String, is2d: boolean): string {\r\n const refIds = this.iModel.nativeDb.findGeometryPartReferences([id], is2d);\r\n return `Part references (${refIds.length}): ${refIds.join()}`;\r\n }\r\n\r\n public getElementGeom(id: Id64String): ElementGeom | undefined {\r\n const elem = this.iModel.elements.getElement<Element>({ id, wantGeometry: true });\r\n let iterator: GeometryStreamIterator | undefined;\r\n let geometricElement: GeometricElement | undefined;\r\n if (elem instanceof GeometricElement) {\r\n geometricElement = elem;\r\n if (geometricElement.is2d()) {\r\n iterator = GeometryStreamIterator.fromGeometricElement2d(geometricElement);\r\n } else {\r\n assert(geometricElement.is3d());\r\n iterator = GeometryStreamIterator.fromGeometricElement3d(geometricElement);\r\n }\r\n } else if (elem instanceof GeometryPart) {\r\n iterator = GeometryStreamIterator.fromGeometryPart(elem);\r\n }\r\n\r\n return undefined !== iterator ? { iterator, geometricElement } : undefined;\r\n }\r\n\r\n public summarizeRange3d(range: Range3d): string {\r\n return `SubGraphicRange: ${this.stringify(range)}`;\r\n }\r\n\r\n public summarizePrimitive(lines: string[], primitive: TextStringPrimitive | ImagePrimitive): void {\r\n const summary = primitive.type;\r\n if (GeometrySummaryVerbosity.Basic >= this.verbosity) {\r\n lines.push(summary);\r\n return;\r\n }\r\n\r\n const json = this.stringify(primitive.type === \"textString\" ? primitive.textString : primitive.image);\r\n if (GeometrySummaryVerbosity.Detailed >= this.verbosity) {\r\n lines.push(`${summary}: ${json}`);\r\n return;\r\n }\r\n\r\n lines.push(`${summary}:`);\r\n lines.push(json);\r\n }\r\n\r\n public summarizeBRep(lines: string[], brep: BRepEntity.DataProps): void {\r\n const summary = \"brep\";\r\n if (GeometrySummaryVerbosity.Basic >= this.verbosity) {\r\n lines.push(summary);\r\n return;\r\n }\r\n\r\n const json = this.stringify({ type: brep.type, transform: brep.transform, faceSymbology: brep.faceSymbology });\r\n if (GeometrySummaryVerbosity.Detailed >= this.verbosity) {\r\n lines.push(`${summary}: ${json}`);\r\n return;\r\n }\r\n\r\n lines.push(`${summary}:`);\r\n lines.push(json);\r\n }\r\n\r\n public summarizePartReference(partId: string, partToLocal?: Transform): string {\r\n let line = `part id: ${partId}`;\r\n if (undefined !== partToLocal)\r\n line = `${line} transform: ${this.stringify(partToLocal)}`;\r\n\r\n return line;\r\n }\r\n\r\n public summarizeGeometryQuery(lines: string[], query: AnyGeometryQuery): void {\r\n switch (this.verbosity) {\r\n case GeometrySummaryVerbosity.Detailed:\r\n lines.push(this.summarizeGeometryQueryDetailed(query));\r\n break;\r\n case GeometrySummaryVerbosity.Full:\r\n lines.push(this.summarizeGeometryQueryFull(query));\r\n break;\r\n default:\r\n lines.push(this.summarizeGeometryQueryBasic(query));\r\n break;\r\n }\r\n }\r\n\r\n public summarizeGeometryQueryBasic(query: AnyGeometryQuery): string {\r\n switch (query.geometryCategory) {\r\n case \"solid\":\r\n return query.solidPrimitiveType;\r\n case \"curvePrimitive\":\r\n return query.curvePrimitiveType;\r\n case \"curveCollection\":\r\n return query.curveCollectionType;\r\n default:\r\n return query.geometryCategory;\r\n }\r\n }\r\n\r\n public summarizeGeometryQueryFull(query: AnyGeometryQuery): string {\r\n return this.geometryQueryToJson(query);\r\n }\r\n\r\n public geometryQueryToJson(query: AnyGeometryQuery): string {\r\n try {\r\n const json = IModelJson.Writer.toIModelJson(query);\r\n const str = JSON.stringify(json);\r\n return this.wantSquish ? this.squish(str) : str;\r\n } catch (err) {\r\n return BentleyError.getErrorMessage(err);\r\n }\r\n }\r\n\r\n // Earlin likes to put tons of whitespace + newlines into his JSON. Remove it.\r\n public squish(str: string): string {\r\n return str.replace(/\\s+/g, \"\");\r\n }\r\n\r\n public stringify(obj: object): string {\r\n const json = JSON.stringify(obj);\r\n return this.wantSquish ? this.squish(json) : json;\r\n }\r\n\r\n public summarizeGeometryQueryDetailed(query: AnyGeometryQuery): string {\r\n let summary = `${this.summarizeGeometryQueryBasic(query)}: `;\r\n switch (query.geometryCategory) {\r\n case \"solid\":\r\n return summary + this.summarizeSolidPrimitive(query);\r\n case \"curvePrimitive\":\r\n return summary + this.summarizeCurvePrimitive(query);\r\n case \"curveCollection\":\r\n return summary + this.summarizeCurveCollection(query);\r\n case \"pointCollection\":\r\n return `${summary} numPoints: ${query.points.length}`;\r\n case \"bsurf\":\r\n return `${summary}'\r\n ' poleDimension: ${query.poleDimension}'\r\n ' numPolesTotal: ${query.numPolesTotal()}'\r\n ' degree[U,V]: ${JSON.stringify([query.degreeUV(UVSelect.uDirection), query.degreeUV(UVSelect.VDirection)])}'\r\n ' order[U,V]: ${JSON.stringify([query.orderUV(UVSelect.uDirection), query.orderUV(UVSelect.VDirection)])}'\r\n ' numSpan[U,V]: ${JSON.stringify([query.numSpanUV(UVSelect.uDirection), query.numSpanUV(UVSelect.VDirection)])}'\r\n ' numPoles[U,V]: ${JSON.stringify([query.numPolesUV(UVSelect.uDirection), query.numPolesUV(UVSelect.VDirection)])}'\r\n ' poleStep[U,V]: ${JSON.stringify([query.poleStepUV(UVSelect.uDirection), query.poleStepUV(UVSelect.VDirection)])}`;\r\n case \"polyface\": {\r\n const data = query.data;\r\n summary = `${summary} pointCount: ${data.point.length}'\r\n ' pointIndexCount: ${data.pointIndex.length}`;\r\n if (query.twoSided)\r\n summary = `${summary} (two-sided)`;\r\n if (undefined !== data.normal)\r\n summary = `${summary} normalCount: ${data.normal.length}`;\r\n if (undefined !== data.param)\r\n summary = `${summary} paramCount: ${data.param.length}`;\r\n if (undefined !== data.color)\r\n summary = `${summary} colorCount: ${data.color.length}`;\r\n\r\n return summary;\r\n }\r\n case \"point\":\r\n return summary + this.geometryQueryToJson(query);\r\n }\r\n }\r\n\r\n public summarizeSolidPrimitive(solid: SolidPrimitive): string {\r\n const summary: string = solid.capped ? \" capped\" : \" uncapped\";\r\n switch (solid.solidPrimitiveType) {\r\n case \"box\":\r\n const box: Box = (solid as Box);\r\n return `${summary}'\r\n ' origin: ${JSON.stringify(box.getBaseOrigin().toJSON())}'\r\n ' topOrigin: ${JSON.stringify(box.getTopOrigin().toJSON())}'\r\n ' baseX: ${box.getBaseX()}'\r\n ' baseY: ${box.getBaseY()}`;\r\n case \"cone\":\r\n const cone: Cone = solid as Cone;\r\n return `${summary}'\r\n ' baseCenterPoint: ${JSON.stringify(cone.getCenterA())}'\r\n ' topCenterPoint: ${JSON.stringify(cone.getCenterB())}'\r\n ' baseCenterRadius: ${JSON.stringify(cone.getRadiusA())}'\r\n ' topCenterRadius: ${JSON.stringify(cone.getRadiusB())}`;\r\n case \"sphere\":\r\n const sphere: Sphere = solid as Sphere;\r\n return `${summary}'\r\n ' centerPoint: ${JSON.stringify(sphere.cloneCenter().toJSON())}'\r\n ' radius: ${JSON.stringify(sphere.trueSphereRadius())}`;\r\n case \"linearSweep\":\r\n const linearSweep: LinearSweep = solid as LinearSweep;\r\n return `${summary}'\r\n ' vector: ${linearSweep.cloneSweepVector().toJSON()}'\r\n ' curves${this.summarizeCurveCollection(linearSweep.getCurvesRef())}`;\r\n case \"rotationalSweep\":\r\n const rotationalSweep: RotationalSweep = solid as RotationalSweep;\r\n const axis = rotationalSweep.cloneAxisRay();\r\n return `${summary}'\r\n ' center: ${axis.origin.toJSON()}'\r\n ' axis: ${JSON.stringify(axis.direction.toJSON())}'\r\n ' sweepAngle: ${rotationalSweep.getSweep().degrees}`;\r\n case \"ruledSweep\":\r\n const ruledSweep: RuledSweep = solid as RuledSweep;\r\n const summarizedCollection = ruledSweep.cloneContours().map((curveCollection) => this.summarizeCurveCollection(curveCollection));\r\n return `${summary}'\r\n ' isClosedVolume${ruledSweep.isClosedVolume}'\r\n ' contours: ${JSON.stringify(summarizedCollection)}`;\r\n case \"torusPipe\":\r\n const torusPipe: TorusPipe = solid as TorusPipe;\r\n const vectorX = torusPipe.cloneVectorX();\r\n const vectorY = torusPipe.cloneVectorY();\r\n const sweep = torusPipe.getSweepAngle();\r\n if (torusPipe.getIsReversed()) {\r\n vectorY.scaleInPlace(-1.0);\r\n sweep.setRadians(-sweep.radians);\r\n }\r\n return `${summary}'\r\n ' center: ${torusPipe.cloneCenter().toJSON()}'\r\n ' xyVectors: ${JSON.stringify([vectorX.toJSON(), vectorY.toJSON()])}'\r\n ' majorRadius: ${torusPipe.getMajorRadius()}'\r\n ' minorRadius: ${torusPipe.getMinorRadius()}'\r\n ' sweepAngle: ${sweep.degrees}`;\r\n }\r\n }\r\n\r\n public summarizeCurvePrimitive(curve: CurvePrimitive): string {\r\n let summary: string = \"\";\r\n const writer = new IModelJson.Writer();\r\n switch (curve.curvePrimitiveType) {\r\n case \"arc\":\r\n const arc: Arc3d = curve as Arc3d;\r\n summary = `${summary} center: ${JSON.stringify(arc.center.toJSON())}`;\r\n if (undefined !== arc.circularRadius)\r\n summary = `${summary} radius: ${arc.circularRadius()}`;\r\n summary = `${summary}'\r\n ' vectorX:${arc.vector0.toJSON()}'\r\n ' vectorY:${arc.vector90.toJSON()}'\r\n ' sweepStartEnd [${arc.sweep.startDegrees}, ${arc.sweep.endDegrees}]`\r\n + ` curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"lineSegment\":\r\n const lineSegment: LineSegment3d = curve as LineSegment3d;\r\n summary = `${summary} points: ${JSON.stringify(lineSegment.toJSON())}`;\r\n summary = `${summary} curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"lineString\":\r\n const lineString: LineString3d = curve as LineString3d;\r\n summary = `${summary} pointCount: ${lineString.numPoints()}'\r\n ' curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"bsplineCurve\":\r\n const bsplineCurve: BSplineCurve3d = curve as BSplineCurve3d;\r\n summary = `${summary}'\r\n ' curveOrder: ${bsplineCurve.order}'\r\n ' controlPointsCount: ${bsplineCurve.numPoles}'\r\n ' curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"interpolationCurve\":\r\n const interpolationCurve: InterpolationCurve3d = curve as InterpolationCurve3d;\r\n const interpolationProps = interpolationCurve.cloneProps();\r\n summary = `${summary}'\r\n ' curveOrder: ${interpolationProps.order}'\r\n ' controlPointsCount: ${interpolationProps.fitPoints.length}`;\r\n return summary;\r\n case \"akimaCurve\":\r\n const akimaCurve: AkimaCurve3d = curve as AkimaCurve3d;\r\n const akimaProps = akimaCurve.cloneProps();\r\n summary = `${summary}'\r\n ' controlPointsCount: ${akimaProps.fitPoints.length}`;\r\n return summary;\r\n case \"bezierCurve\":\r\n const bezierCurve: BezierCurveBase = curve as BezierCurveBase;\r\n summary = `${summary}'\r\n ' curveOrder: ${bezierCurve.order}'\r\n ' controlPointsCount: ${bezierCurve.numPoles}'\r\n ' curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"transitionSpiral\":\r\n const transitionSpiral: TransitionSpiral3d = curve as TransitionSpiral3d;\r\n const json = writer.handleTransitionSpiral(transitionSpiral);\r\n summary = summary + JSON.stringify(json);\r\n return summary;\r\n case \"curveChainWithDistanceIndex\":\r\n const curveChainWithDistanceIndex: CurveChainWithDistanceIndex = curve as CurveChainWithDistanceIndex;\r\n const path = curveChainWithDistanceIndex.path;\r\n summary = `${summary}'\r\n ' curveLength: ${curve.curveLength()}'\r\n ' isOpen: ${path.isOpenPath}`;\r\n return summary;\r\n }\r\n }\r\n\r\n public summarizeCurveCollection(curves: CurveCollection): string {\r\n let summary: string = \"\";\r\n switch (curves.curveCollectionType) {\r\n case \"loop\":\r\n const loop: Loop = curves as Loop;\r\n summary = `${summary} isInner: ${loop.isInner}`;\r\n break;\r\n case \"path\":\r\n const path: Path = curves as Path;\r\n summary = `${summary} isOpen: ${path.isOpenPath}`;\r\n break;\r\n }\r\n\r\n return `${summary}'\r\n ' numCurves: ${curves.collectCurvePrimitives().length}'\r\n ' boundary: ${curves.dgnBoundaryType()}`;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function generateGeometrySummaries(request: GeometrySummaryRequestProps, iModel: IModelDb): string {\r\n const generator = new ResponseGenerator(request, iModel);\r\n return generator.generateSummaries();\r\n}\r\n"]}
|