@itwin/editor-backend 4.6.0-dev.3 → 4.6.0-dev.6

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/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Change Log - @itwin/editor-backend
2
2
 
3
- This log was last generated on Mon, 25 Mar 2024 22:24:35 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 03 Apr 2024 18:28:10 GMT and should not be manually modified.
4
+
5
+ ## 4.5.1
6
+ Wed, 03 Apr 2024 18:26:59 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 4.5.0
11
+ Tue, 02 Apr 2024 19:06:00 GMT
12
+
13
+ ### Updates
14
+
15
+ - Improved documentation for extending commands
4
16
 
5
17
  ## 4.4.8
6
18
  Mon, 25 Mar 2024 22:22:26 GMT
@@ -15,6 +15,8 @@ export declare class BasicManipulationCommand extends EditCommand implements Bas
15
15
  static commandId: string;
16
16
  constructor(iModel: IModelDb, _str: string);
17
17
  onStart(): Promise<string>;
18
+ addAllowedChannel(channelKey: string): Promise<void>;
19
+ removeAllowedChannel(channelKey: string): Promise<void>;
18
20
  deleteElements(ids: CompressedId64Set): Promise<IModelStatus>;
19
21
  transformPlacement(ids: CompressedId64Set, transProps: TransformProps): Promise<IModelStatus>;
20
22
  rotatePlacement(ids: CompressedId64Set, matrixProps: Matrix3dProps, aboutCenter: boolean): Promise<IModelStatus>;
@@ -1 +1 @@
1
- {"version":3,"file":"EditBuiltInCommand.d.ts","sourceRoot":"","sources":["../../src/EditBuiltInCommand.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAY,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAY,aAAa,EAAoB,YAAY,EAAa,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC1H,OAAO,EAAoB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EA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,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC;IAMjE,sBAAsB,CAAC,SAAS,EAAE,qBAAqB,GAAG,UAAU,EAAE,IAAI,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBzH,sBAAsB,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAyE1H,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IA0B1D,kBAAkB,CAAC,YAAY,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAShF"}
@@ -22,6 +22,12 @@ class BasicManipulationCommand extends EditCommand_1.EditCommand {
22
22
  this._str = _str;
23
23
  }
24
24
  async onStart() { return BasicManipulationCommand.commandId; }
25
+ async addAllowedChannel(channelKey) {
26
+ this.iModel.channels.addAllowedChannel(channelKey);
27
+ }
28
+ async removeAllowedChannel(channelKey) {
29
+ this.iModel.channels.removeAllowedChannel(channelKey);
30
+ }
25
31
  async deleteElements(ids) {
26
32
  const idSet = core_bentley_1.CompressedId64Set.decompressSet(ids);
27
33
  await this.iModel.locks.acquireLocks({ exclusive: idSet });
@@ -1 +1 @@
1
- {"version":3,"file":"EditBuiltInCommand.js","sourceRoot":"","sources":["../../src/EditBuiltInCommand.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4F;AAC5F,wDAA0H;AAE1H,oDAAgR;AAChR,wDAAkH;AAClH,+CAA4C;AAE5C;;GAEG;AACH,MAAa,wBAAyB,SAAQ,yBAAW;IAGvD,YAAmB,MAAgB,EAAY,IAAY;QAAI,KAAK,CAAC,MAAM,CAAC,CAAC;QAA9B,SAAI,GAAJ,IAAI,CAAQ;IAAmB,CAAC;IAE/D,KAAK,CAAC,OAAO,KAAK,OAAO,wBAAwB,CAAC,SAAS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AAK,QAAQ,EAAE;YAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACtC,MAAM,UAAU,GAAG,CAAC,CAAC;YAErB,IAAI,UAAU,KAAK,QAAQ,CAAC,aAAa,EAAE;gBACzC,QAAQ,CAAC,aAAa,GAAG,UAAU,CAAC;gBACpC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;aACpE;SACF;IACH,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,YAA+B;QAC7D,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAEtC,0DAA0D;QAC1D,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;QAExE,MAAM,eAAe,GAAG,IAAI,0BAAY,CAAC,YAAY,CAAC,CAAC;QACvD,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAClD,CAAC;;AArMsB,kCAAS,GAAG,mCAAmB,CAAC,oBAAoB,CAAC;AADjE,4DAAwB","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 Editing\r\n */\r\n\r\nimport { CompressedId64Set, DbResult, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { Matrix3d, Matrix3dProps, Point3d, Range3d, Range3dProps, Transform, TransformProps } from \"@itwin/core-geometry\";\r\nimport { GeometricElement, IModelDb } from \"@itwin/core-backend\";\r\nimport { BRepEntity, EcefLocation, EcefLocationProps, ElementGeometry, ElementGeometryBuilderParams, ElementGeometryFunction, ElementGeometryInfo, ElementGeometryRequest, FilePropertyProps, GeometricElementProps, GeometryPartProps, IModelError } from \"@itwin/core-common\";\r\nimport { BasicManipulationCommandIpc, editorBuiltInCmdIds, FlatBufferGeometryFilter } from \"@itwin/editor-common\";\r\nimport { EditCommand } from \"./EditCommand\";\r\n\r\n/** Implementation for a EditCommand command that provides basic creation and modification operations.\r\n * @beta\r\n */\r\nexport class BasicManipulationCommand extends EditCommand implements BasicManipulationCommandIpc {\r\n public static override commandId = editorBuiltInCmdIds.cmdBasicManipulation;\r\n\r\n public constructor(iModel: IModelDb, protected _str: string) { super(iModel); }\r\n\r\n public override async onStart() { return BasicManipulationCommand.commandId; }\r\n\r\n public async deleteElements(ids: CompressedId64Set): Promise<IModelStatus> {\r\n const idSet = CompressedId64Set.decompressSet(ids);\r\n await this.iModel.locks.acquireLocks({ exclusive: idSet });\r\n\r\n for (const id of idSet)\r\n this.iModel.elements.deleteElement(id);\r\n\r\n return IModelStatus.Success;\r\n }\r\n\r\n public async transformPlacement(ids: CompressedId64Set, transProps: TransformProps): Promise<IModelStatus> {\r\n const idSet = CompressedId64Set.decompressSet(ids);\r\n await this.iModel.locks.acquireLocks({ exclusive: idSet });\r\n\r\n const transform = Transform.fromJSON(transProps);\r\n\r\n for (const id of idSet) {\r\n const element = this.iModel.elements.getElement<GeometricElement>(id);\r\n\r\n if (!element.placement.isValid)\r\n continue; // Ignore assembly parents w/o geometry, etc...\r\n\r\n element.placement.multiplyTransform(transform);\r\n this.iModel.elements.updateElement(element.toJSON());\r\n }\r\n\r\n return IModelStatus.Success;\r\n }\r\n\r\n public async rotatePlacement(ids: CompressedId64Set, matrixProps: Matrix3dProps, aboutCenter: boolean): Promise<IModelStatus> {\r\n const idSet = CompressedId64Set.decompressSet(ids);\r\n await this.iModel.locks.acquireLocks({ exclusive: idSet });\r\n\r\n const matrix = Matrix3d.fromJSON(matrixProps);\r\n\r\n for (const id of idSet) {\r\n const element = this.iModel.elements.getElement<GeometricElement>(id);\r\n\r\n if (!element.placement.isValid)\r\n continue; // Ignore assembly parents w/o geometry, etc...\r\n\r\n const fixedPoint = aboutCenter ? element.placement.calculateRange().center : Point3d.createFrom(element.placement.origin);\r\n const transform = Transform.createFixedPointAndMatrix(fixedPoint, matrix);\r\n\r\n element.placement.multiplyTransform(transform);\r\n this.iModel.elements.updateElement(element.toJSON());\r\n }\r\n\r\n return IModelStatus.Success;\r\n }\r\n\r\n public async insertGeometricElement(props: GeometricElementProps): Promise<Id64String> {\r\n await this.iModel.locks.acquireLocks({ shared: props.model });\r\n\r\n return this.iModel.elements.insertElement(props);\r\n }\r\n\r\n public async insertGeometryPart(props: GeometryPartProps): Promise<Id64String> {\r\n await this.iModel.locks.acquireLocks({ shared: props.model });\r\n\r\n return this.iModel.elements.insertElement(props);\r\n }\r\n\r\n public async updateGeometricElement(propsOrId: GeometricElementProps | Id64String, data?: ElementGeometryBuilderParams): Promise<void> {\r\n let props: GeometricElementProps;\r\n if (typeof propsOrId === \"string\") {\r\n if (undefined === data)\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Flatbuffer data required for update by id\");\r\n props = this.iModel.elements.getElementProps<GeometricElementProps>(propsOrId);\r\n } else {\r\n props = propsOrId;\r\n }\r\n\r\n if (undefined === props.id)\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Element id required for update\");\r\n\r\n await this.iModel.locks.acquireLocks({ exclusive: props.id });\r\n\r\n if (undefined !== data)\r\n props.elementGeometryBuilderParams = { entryArray: data.entryArray, viewIndependent: data.viewIndependent };\r\n\r\n this.iModel.elements.updateElement(props);\r\n }\r\n\r\n public async requestElementGeometry(elementId: Id64String, filter?: FlatBufferGeometryFilter): Promise<ElementGeometryInfo | undefined> {\r\n let accepted: ElementGeometryInfo | undefined;\r\n\r\n const onGeometry: ElementGeometryFunction = (info: ElementGeometryInfo): void => {\r\n accepted = info;\r\n\r\n if (undefined !== filter) {\r\n let numDisplayable = 0;\r\n\r\n for (const entry of info.entryArray) {\r\n if (!ElementGeometry.isDisplayableEntry(entry))\r\n continue;\r\n\r\n numDisplayable++;\r\n if (filter.maxDisplayable && numDisplayable > filter.maxDisplayable) {\r\n accepted = undefined;\r\n break;\r\n }\r\n\r\n if (filter.reject && filter.reject.some((opcode) => entry.opcode === opcode)) {\r\n accepted = undefined;\r\n break;\r\n }\r\n\r\n if (filter.accept && !filter.accept.some((opcode) => entry.opcode === opcode)) {\r\n accepted = undefined;\r\n break;\r\n }\r\n\r\n if (undefined === filter.geometry)\r\n continue;\r\n\r\n let entityType;\r\n if (filter.geometry.curves && !(filter.geometry.surfaces || filter.geometry.solids))\r\n entityType = ElementGeometry.isCurve(entry) ? BRepEntity.Type.Wire : undefined; // skip surface/solid opcodes...\r\n else\r\n entityType = ElementGeometry.getBRepEntityType(entry);\r\n\r\n switch (entityType) {\r\n case BRepEntity.Type.Wire:\r\n if (!filter.geometry.curves)\r\n accepted = undefined;\r\n break;\r\n case BRepEntity.Type.Sheet:\r\n if (!filter.geometry.surfaces)\r\n accepted = undefined;\r\n break;\r\n case BRepEntity.Type.Solid:\r\n if (!filter.geometry.solids)\r\n accepted = undefined;\r\n break;\r\n default:\r\n accepted = undefined;\r\n break;\r\n }\r\n\r\n if (undefined === accepted)\r\n break;\r\n }\r\n }\r\n };\r\n\r\n const requestProps: ElementGeometryRequest = {\r\n onGeometry,\r\n elementId,\r\n };\r\n\r\n if (IModelStatus.Success !== this.iModel.elementGeometryRequest(requestProps))\r\n return undefined;\r\n\r\n return accepted;\r\n }\r\n\r\n public async updateProjectExtents(extents: Range3dProps): Promise<void> {\r\n const newExtents = new Range3d();\r\n newExtents.setFromJSON(extents);\r\n\r\n if (newExtents.isNull)\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Invalid project extents\");\r\n\r\n await this.iModel.acquireSchemaLock();\r\n\r\n this.iModel.updateProjectExtents(newExtents);\r\n\r\n // Set source from calculated to user so connectors preserve the change.\r\n const unitsProps: FilePropertyProps = { name: \"Units\", namespace: \"dgn_Db\" };\r\n const unitsStr = this.iModel.queryFilePropertyString(unitsProps);\r\n\r\n if (undefined !== unitsStr) {\r\n const unitsVal = JSON.parse(unitsStr);\r\n const calculated = 1;\r\n\r\n if (calculated !== unitsVal.extentsSource) {\r\n unitsVal.extentsSource = calculated;\r\n this.iModel.saveFileProperty(unitsProps, JSON.stringify(unitsVal));\r\n }\r\n }\r\n }\r\n\r\n public async updateEcefLocation(ecefLocation: EcefLocationProps): Promise<void> {\r\n await this.iModel.acquireSchemaLock();\r\n\r\n // Clear GCS that caller already determined was invalid...\r\n this.iModel.deleteFileProperty({ name: \"DgnGCS\", namespace: \"dgn_Db\" });\r\n\r\n const newEcefLocation = new EcefLocation(ecefLocation);\r\n this.iModel.updateEcefLocation(newEcefLocation);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"EditBuiltInCommand.js","sourceRoot":"","sources":["../../src/EditBuiltInCommand.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4F;AAC5F,wDAA0H;AAE1H,oDAAgR;AAChR,wDAAkH;AAClH,+CAA4C;AAE5C;;GAEG;AACH,MAAa,wBAAyB,SAAQ,yBAAW;IAGvD,YAAmB,MAAgB,EAAY,IAAY;QAAI,KAAK,CAAC,MAAM,CAAC,CAAC;QAA9B,SAAI,GAAJ,IAAI,CAAQ;IAAmB,CAAC;IAE/D,KAAK,CAAC,OAAO,KAAK,OAAO,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC;IAEvE,KAAK,CAAC,iBAAiB,CAAC,UAAkB;QAC/C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,UAAkB;QAClD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,GAAsB;QAChD,MAAM,KAAK,GAAG,gCAAiB,CAAC,a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M,UAAU,GAAG,CAAC,CAAC;YAErB,IAAI,UAAU,KAAK,QAAQ,CAAC,aAAa,EAAE;gBACzC,QAAQ,CAAC,aAAa,GAAG,UAAU,CAAC;gBACpC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;aACpE;SACF;IACH,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,YAA+B;QAC7D,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAEtC,0DAA0D;QAC1D,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;QAExE,MAAM,eAAe,GAAG,IAAI,0BAAY,CAAC,YAAY,CAAC,CAAC;QACvD,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAClD,CAAC;;AA7MsB,kCAAS,GAAG,mCAAmB,CAAC,oBAAoB,CAAC;AADjE,4DAAwB","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 Editing\r\n */\r\n\r\nimport { CompressedId64Set, DbResult, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { Matrix3d, Matrix3dProps, Point3d, Range3d, Range3dProps, Transform, TransformProps } from \"@itwin/core-geometry\";\r\nimport { GeometricElement, IModelDb } from \"@itwin/core-backend\";\r\nimport { BRepEntity, EcefLocation, EcefLocationProps, ElementGeometry, ElementGeometryBuilderParams, ElementGeometryFunction, ElementGeometryInfo, ElementGeometryRequest, FilePropertyProps, GeometricElementProps, GeometryPartProps, IModelError } from \"@itwin/core-common\";\r\nimport { BasicManipulationCommandIpc, editorBuiltInCmdIds, FlatBufferGeometryFilter } from \"@itwin/editor-common\";\r\nimport { EditCommand } from \"./EditCommand\";\r\n\r\n/** Implementation for a EditCommand command that provides basic creation and modification operations.\r\n * @beta\r\n */\r\nexport class BasicManipulationCommand extends EditCommand implements BasicManipulationCommandIpc {\r\n public static override commandId = editorBuiltInCmdIds.cmdBasicManipulation;\r\n\r\n public constructor(iModel: IModelDb, protected _str: string) { super(iModel); }\r\n\r\n public override async onStart() { return BasicManipulationCommand.commandId; }\r\n\r\n public async addAllowedChannel(channelKey: string): Promise<void> {\r\n this.iModel.channels.addAllowedChannel(channelKey);\r\n }\r\n\r\n public async removeAllowedChannel(channelKey: string): Promise<void> {\r\n this.iModel.channels.removeAllowedChannel(channelKey);\r\n }\r\n\r\n public async deleteElements(ids: CompressedId64Set): Promise<IModelStatus> {\r\n const idSet = CompressedId64Set.decompressSet(ids);\r\n await this.iModel.locks.acquireLocks({ exclusive: idSet });\r\n\r\n for (const id of idSet)\r\n this.iModel.elements.deleteElement(id);\r\n\r\n return IModelStatus.Success;\r\n }\r\n\r\n public async transformPlacement(ids: CompressedId64Set, transProps: TransformProps): Promise<IModelStatus> {\r\n const idSet = CompressedId64Set.decompressSet(ids);\r\n await this.iModel.locks.acquireLocks({ exclusive: idSet });\r\n\r\n const transform = Transform.fromJSON(transProps);\r\n\r\n for (const id of idSet) {\r\n const element = this.iModel.elements.getElement<GeometricElement>(id);\r\n\r\n if (!element.placement.isValid)\r\n continue; // Ignore assembly parents w/o geometry, etc...\r\n\r\n element.placement.multiplyTransform(transform);\r\n this.iModel.elements.updateElement(element.toJSON());\r\n }\r\n\r\n return IModelStatus.Success;\r\n }\r\n\r\n public async rotatePlacement(ids: CompressedId64Set, matrixProps: Matrix3dProps, aboutCenter: boolean): Promise<IModelStatus> {\r\n const idSet = CompressedId64Set.decompressSet(ids);\r\n await this.iModel.locks.acquireLocks({ exclusive: idSet });\r\n\r\n const matrix = Matrix3d.fromJSON(matrixProps);\r\n\r\n for (const id of idSet) {\r\n const element = this.iModel.elements.getElement<GeometricElement>(id);\r\n\r\n if (!element.placement.isValid)\r\n continue; // Ignore assembly parents w/o geometry, etc...\r\n\r\n const fixedPoint = aboutCenter ? element.placement.calculateRange().center : Point3d.createFrom(element.placement.origin);\r\n const transform = Transform.createFixedPointAndMatrix(fixedPoint, matrix);\r\n\r\n element.placement.multiplyTransform(transform);\r\n this.iModel.elements.updateElement(element.toJSON());\r\n }\r\n\r\n return IModelStatus.Success;\r\n }\r\n\r\n public async insertGeometricElement(props: GeometricElementProps): Promise<Id64String> {\r\n await this.iModel.locks.acquireLocks({ shared: props.model });\r\n\r\n return this.iModel.elements.insertElement(props);\r\n }\r\n\r\n public async insertGeometryPart(props: GeometryPartProps): Promise<Id64String> {\r\n await this.iModel.locks.acquireLocks({ shared: props.model });\r\n\r\n return this.iModel.elements.insertElement(props);\r\n }\r\n\r\n public async updateGeometricElement(propsOrId: GeometricElementProps | Id64String, data?: ElementGeometryBuilderParams): Promise<void> {\r\n let props: GeometricElementProps;\r\n if (typeof propsOrId === \"string\") {\r\n if (undefined === data)\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Flatbuffer data required for update by id\");\r\n props = this.iModel.elements.getElementProps<GeometricElementProps>(propsOrId);\r\n } else {\r\n props = propsOrId;\r\n }\r\n\r\n if (undefined === props.id)\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Element id required for update\");\r\n\r\n await this.iModel.locks.acquireLocks({ exclusive: props.id });\r\n\r\n if (undefined !== data)\r\n props.elementGeometryBuilderParams = { entryArray: data.entryArray, viewIndependent: data.viewIndependent };\r\n\r\n this.iModel.elements.updateElement(props);\r\n }\r\n\r\n public async requestElementGeometry(elementId: Id64String, filter?: FlatBufferGeometryFilter): Promise<ElementGeometryInfo | undefined> {\r\n let accepted: ElementGeometryInfo | undefined;\r\n\r\n const onGeometry: ElementGeometryFunction = (info: ElementGeometryInfo): void => {\r\n accepted = info;\r\n\r\n if (undefined !== filter) {\r\n let numDisplayable = 0;\r\n\r\n for (const entry of info.entryArray) {\r\n if (!ElementGeometry.isDisplayableEntry(entry))\r\n continue;\r\n\r\n numDisplayable++;\r\n if (filter.maxDisplayable && numDisplayable > filter.maxDisplayable) {\r\n accepted = undefined;\r\n break;\r\n }\r\n\r\n if (filter.reject && filter.reject.some((opcode) => entry.opcode === opcode)) {\r\n accepted = undefined;\r\n break;\r\n }\r\n\r\n if (filter.accept && !filter.accept.some((opcode) => entry.opcode === opcode)) {\r\n accepted = undefined;\r\n break;\r\n }\r\n\r\n if (undefined === filter.geometry)\r\n continue;\r\n\r\n let entityType;\r\n if (filter.geometry.curves && !(filter.geometry.surfaces || filter.geometry.solids))\r\n entityType = ElementGeometry.isCurve(entry) ? BRepEntity.Type.Wire : undefined; // skip surface/solid opcodes...\r\n else\r\n entityType = ElementGeometry.getBRepEntityType(entry);\r\n\r\n switch (entityType) {\r\n case BRepEntity.Type.Wire:\r\n if (!filter.geometry.curves)\r\n accepted = undefined;\r\n break;\r\n case BRepEntity.Type.Sheet:\r\n if (!filter.geometry.surfaces)\r\n accepted = undefined;\r\n break;\r\n case BRepEntity.Type.Solid:\r\n if (!filter.geometry.solids)\r\n accepted = undefined;\r\n break;\r\n default:\r\n accepted = undefined;\r\n break;\r\n }\r\n\r\n if (undefined === accepted)\r\n break;\r\n }\r\n }\r\n };\r\n\r\n const requestProps: ElementGeometryRequest = {\r\n onGeometry,\r\n elementId,\r\n };\r\n\r\n if (IModelStatus.Success !== this.iModel.elementGeometryRequest(requestProps))\r\n return undefined;\r\n\r\n return accepted;\r\n }\r\n\r\n public async updateProjectExtents(extents: Range3dProps): Promise<void> {\r\n const newExtents = new Range3d();\r\n newExtents.setFromJSON(extents);\r\n\r\n if (newExtents.isNull)\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Invalid project extents\");\r\n\r\n await this.iModel.acquireSchemaLock();\r\n\r\n this.iModel.updateProjectExtents(newExtents);\r\n\r\n // Set source from calculated to user so connectors preserve the change.\r\n const unitsProps: FilePropertyProps = { name: \"Units\", namespace: \"dgn_Db\" };\r\n const unitsStr = this.iModel.queryFilePropertyString(unitsProps);\r\n\r\n if (undefined !== unitsStr) {\r\n const unitsVal = JSON.parse(unitsStr);\r\n const calculated = 1;\r\n\r\n if (calculated !== unitsVal.extentsSource) {\r\n unitsVal.extentsSource = calculated;\r\n this.iModel.saveFileProperty(unitsProps, JSON.stringify(unitsVal));\r\n }\r\n }\r\n }\r\n\r\n public async updateEcefLocation(ecefLocation: EcefLocationProps): Promise<void> {\r\n await this.iModel.acquireSchemaLock();\r\n\r\n // Clear GCS that caller already determined was invalid...\r\n this.iModel.deleteFileProperty({ name: \"DgnGCS\", namespace: \"dgn_Db\" });\r\n\r\n const newEcefLocation = new EcefLocation(ecefLocation);\r\n this.iModel.updateEcefLocation(newEcefLocation);\r\n }\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/editor-backend",
3
- "version": "4.6.0-dev.3",
3
+ "version": "4.6.0-dev.6",
4
4
  "description": "iTwin.js editor backend",
5
5
  "main": "lib/cjs/editor-backend.js",
6
6
  "typings": "lib/cjs/editor-backend",
@@ -25,10 +25,10 @@
25
25
  "url": "http://www.bentley.com"
26
26
  },
27
27
  "peerDependencies": {
28
- "@itwin/core-backend": "^4.6.0-dev.3",
29
- "@itwin/core-bentley": "^4.6.0-dev.3",
30
- "@itwin/core-common": "^4.6.0-dev.3",
31
- "@itwin/core-geometry": "^4.6.0-dev.3"
28
+ "@itwin/core-backend": "^4.6.0-dev.6",
29
+ "@itwin/core-bentley": "^4.6.0-dev.6",
30
+ "@itwin/core-common": "^4.6.0-dev.6",
31
+ "@itwin/core-geometry": "^4.6.0-dev.6"
32
32
  },
33
33
  "//devDependencies": [
34
34
  "NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install",
@@ -39,14 +39,14 @@
39
39
  "eslint": "^8.44.0",
40
40
  "rimraf": "^3.0.2",
41
41
  "typescript": "~5.0.2",
42
- "@itwin/build-tools": "4.6.0-dev.3",
43
- "@itwin/core-backend": "4.6.0-dev.3",
44
- "@itwin/core-geometry": "4.6.0-dev.3",
45
- "@itwin/core-common": "4.6.0-dev.3",
46
- "@itwin/core-bentley": "4.6.0-dev.3"
42
+ "@itwin/core-backend": "4.6.0-dev.6",
43
+ "@itwin/build-tools": "4.6.0-dev.6",
44
+ "@itwin/core-bentley": "4.6.0-dev.6",
45
+ "@itwin/core-common": "4.6.0-dev.6",
46
+ "@itwin/core-geometry": "4.6.0-dev.6"
47
47
  },
48
48
  "dependencies": {
49
- "@itwin/editor-common": "4.6.0-dev.3"
49
+ "@itwin/editor-common": "4.6.0-dev.6"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "npm run -s build:cjs",