@itwin/editor-frontend 4.6.0-dev.8 → 4.7.0-dev.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ModifyElementTool.js","sourceRoot":"","sources":["../../src/ModifyElementTool.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAkC,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAuE,MAAM,oBAAoB,CAAC;AAC5H,OAAO,EAAkC,cAAc,EAAwD,SAAS,EAA2D,MAAM,sBAAsB,CAAC;AAEhN,OAAO,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9F;;GAEG;AACH,MAAM,OAAgB,iBAAkB,SAAQ,cAAc;IAA9D;;QACqB,gBAAW,GAAG,IAAI,GAAG,EAAuB,CAAC;IAyFlE,CAAC;IAvFW,SAAS,CAAC,GAAa,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC;IACnC,oBAAoB,CAAC,EAAwB,EAAE,oBAA6B,IAAa,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,EAAE,oBAAoB,CAAC,IAAI,SAAS,KAAK,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzM,uBAAuB,KAAW,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAE7D,KAAK,CAAC,2BAA2B,CAAC,GAAe,IAAsB,OAAO,KAAK,CAAC,CAAC,CAAC;IAEtF,KAAK,CAAC,yBAAyB,CAAC,EAAc;QACtD,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAC;QAEf,IAAI,MAAM,GAAG,IAAI,CAAC,WAAW,CA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CAAC,QAAQ,EAAE,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAChG,CAAC;IAEe,cAAc,CAAC,GAAkB,EAAE,OAAwB;QACzE,IAAI,SAAS,KAAK,IAAI,CAAC,iBAAiB;YACtC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAEe,KAAK,CAAC,aAAa,CAAC,EAAiB;QACnD,OAAO,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAEe,KAAK,CAAC,WAAW;QAC/B,IAAI,CAAC,IAAI,CAAC,YAAY;YACpB,IAAI,CAAC,8BAA8B,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;IAC7B,CAAC;IAEe,KAAK,CAAC,SAAS;QAC7B,IAAI,CAAC,IAAI,CAAC,YAAY;YACpB,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAAC,CAAC;QAC5C,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC;IAC3B,CAAC;IAEe,KAAK,CAAC,aAAa;QACjC,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,4BAA4B;YACnC,IAAI,CAAC,MAAM,CAAC,iBAAiB,GAAG,KAAK,CAAC;IAC1C,CAAC;IAEe,KAAK,CAAC,SAAS;QAC7B,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { Id64, Id64Arg, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport { FeatureAppearance, FlatBufferGeometryStream, GeometricElementProps, JsonGeometryStream } from \"@itwin/core-common\";\nimport { BeButtonEvent, DynamicsContext, ElementSetTool, FeatureOverrideProvider, FeatureSymbology, HitDetail, IModelApp, LocateResponse, SelectionMethod, SelectionSet, Viewport } from \"@itwin/core-frontend\";\nimport { Point3d } from \"@itwin/core-geometry\";\nimport { computeChordToleranceFromPoint, DynamicGraphicsProvider } from \"./CreateElementTool\";\n\n/** Edit tool base class for updating existing elements.\n * @beta\n */\nexport abstract class ModifyElementTool extends ElementSetTool {\n protected readonly _checkedIds = new Map<Id64String, boolean>();\n\n protected allowView(_vp: Viewport) { return true; }\n public override isCompatibleViewport(vp: Viewport | undefined, isSelectedViewChange: boolean): boolean { return (super.isCompatibleViewport(vp, isSelectedViewChange) && undefined !== vp && this.allowView(vp)); }\n\n protected onGeometryFilterChanged(): void { this._checkedIds.clear(); }\n\n protected async doAcceptElementForOperation(_id: Id64String): Promise<boolean> { return false; }\n\n protected async acceptElementForOperation(id: Id64String): Promise<boolean> {\n if (Id64.isInvalid(id) || Id64.isTransient(id))\n return false;\n\n let accept = this._checkedIds.get(id);\n\n if (undefined === accept) {\n if (this.agenda.isEmpty && this._checkedIds.size > 1000)\n this._checkedIds.clear(); // Limit auto-locate cache size to something reasonable...\n\n accept = await this.doAcceptElementForOperation(id);\n this._checkedIds.set(id, accept);\n }\n\n return accept;\n }\n\n protected override async isElementValidForOperation(hit: HitDetail, out?: LocateResponse): Promise<boolean> {\n if (!await super.isElementValidForOperation(hit, out))\n return false;\n\n return this.acceptElementForOperation(hit.sourceId);\n }\n\n protected async postFilterIds(arg: Id64Arg): Promise<Id64Arg> {\n const ids: Id64Array = [];\n\n for (const id of Id64.iterable(arg)) {\n if (await this.acceptElementForOperation(id))\n ids.push(id);\n }\n\n return ids;\n }\n\n protected override async getGroupIds(id: Id64String): Promise<Id64Arg> {\n return this.postFilterIds(await super.getGroupIds(id));\n }\n\n protected override async getSelectionSetCandidates(ss: SelectionSet): Promise<Id64Arg> {\n return this.postFilterIds(await super.getSelectionSetCandidates(ss));\n }\n\n protected override async getDragSelectCandidates(vp: Viewport, origin: Point3d, corner: Point3d, method: SelectionMethod, overlap: boolean): Promise<Id64Arg> {\n return this.postFilterIds(await super.getDragSelectCandidates(vp, origin, corner, method, overlap));\n }\n\n protected setupAccuDraw(): void { }\n\n protected override setupAndPromptForNextAction(): void {\n this.setupAccuDraw();\n super.setupAndPromptForNextAction();\n }\n\n protected abstract getGeometryProps(ev: BeButtonEvent, isAccept: boolean): JsonGeometryStream | FlatBufferGeometryStream | undefined;\n protected abstract getElementProps(ev: BeButtonEvent): GeometricElementProps | undefined;\n\n protected async doUpdateElement(_props: GeometricElementProps): Promise<boolean> { return false; }\n\n protected async applyAgendaOperation(ev: BeButtonEvent): Promise<boolean> {\n const geometry = this.getGeometryProps(ev, true);\n if (undefined === geometry)\n return false;\n\n const elemProps = this.getElementProps(ev);\n if (undefined === elemProps)\n return false;\n\n if (\"flatbuffer\" === geometry.format)\n elemProps.elementGeometryBuilderParams = { entryArray: geometry.data };\n else\n elemProps.geom = geometry.data;\n\n return this.doUpdateElement(elemProps);\n }\n\n public override async processAgenda(ev: BeButtonEvent): Promise<void> {\n if (await this.applyAgendaOperation(ev))\n return this.saveChanges();\n }\n}\n\n/** Edit tool base class for updating existing elements that use dynamics to show intermediate results.\n * @beta\n */\nexport abstract class ModifyElementWithDynamicsTool extends ModifyElementTool implements FeatureOverrideProvider {\n protected _graphicsProvider?: DynamicGraphicsProvider;\n protected _firstResult = true;\n protected _agendaAppearanceDefault?: FeatureAppearance;\n protected _agendaAppearanceDynamic?: FeatureAppearance;\n\n protected override get wantAccuSnap(): boolean { return true; }\n protected override get wantDynamics(): boolean { return true; }\n\n protected agendaAppearance(isDynamics: boolean): FeatureAppearance {\n if (isDynamics) {\n if (undefined === this._agendaAppearanceDynamic)\n this._agendaAppearanceDynamic = FeatureAppearance.fromTransparency(0.0);\n\n return this._agendaAppearanceDynamic;\n }\n\n if (undefined === this._agendaAppearanceDefault)\n this._agendaAppearanceDefault = FeatureAppearance.fromTransparency(0.9);\n\n return this._agendaAppearanceDefault;\n }\n\n protected get wantAgendaAppearanceOverride(): boolean { return false; }\n\n public addFeatureOverrides(overrides: FeatureSymbology.Overrides, _vp: Viewport): void {\n if (this.agenda.isEmpty)\n return;\n\n const appearance = this.agendaAppearance(false);\n this.agenda.elements.forEach((elementId) => overrides.override({ elementId, appearance }));\n }\n\n protected updateAgendaAppearanceProvider(drop?: true): void {\n if (!this.wantAgendaAppearanceOverride)\n return;\n\n for (const vp of IModelApp.viewManager) {\n if (!this.allowView(vp))\n continue;\n\n if (drop || this.agenda.isEmpty)\n vp.dropFeatureOverrideProvider(this);\n else if (!vp.addFeatureOverrideProvider(this))\n vp.setFeatureOverrideProviderChanged();\n }\n }\n\n protected clearGraphics(): void {\n if (undefined === this._graphicsProvider)\n return;\n this._graphicsProvider.cleanupGraphic();\n this._graphicsProvider = undefined;\n }\n\n protected async createGraphics(ev: BeButtonEvent): Promise<void> {\n if (!IModelApp.viewManager.inDynamicsMode)\n return; // Don't need to create graphic if dynamics aren't yet active...\n\n const geometry = this.getGeometryProps(ev, false);\n if (undefined === geometry) {\n this.clearGraphics();\n return;\n }\n\n const elemProps = this.getElementProps(ev);\n if (undefined === elemProps?.placement) {\n this.clearGraphics();\n return;\n }\n\n if (undefined === this._graphicsProvider) {\n if (this._firstResult) {\n this.updateAgendaAppearanceProvider();\n this._firstResult = false;\n }\n this._graphicsProvider = new DynamicGraphicsProvider(this.iModel, this.toolId);\n }\n\n // Set chord tolerance for non-linear/non-planar geometry...\n if (ev.viewport)\n this._graphicsProvider.chordTolerance = computeChordToleranceFromPoint(ev.viewport, ev.point);\n\n await this._graphicsProvider.createGraphic(elemProps.category, elemProps.placement, geometry);\n }\n\n public override onDynamicFrame(_ev: BeButtonEvent, context: DynamicsContext): void {\n if (undefined !== this._graphicsProvider)\n this._graphicsProvider.addGraphic(context);\n }\n\n public override async onMouseMotion(ev: BeButtonEvent): Promise<void> {\n return this.createGraphics(ev);\n }\n\n public override async onUnsuspend(): Promise<void> {\n if (!this._firstResult)\n this.updateAgendaAppearanceProvider();\n return super.onUnsuspend();\n }\n\n public override async onSuspend(): Promise<void> {\n if (!this._firstResult)\n this.updateAgendaAppearanceProvider(true);\n return super.onSuspend();\n }\n\n public override async onPostInstall(): Promise<void> {\n await super.onPostInstall();\n if (this.wantAgendaAppearanceOverride)\n this.agenda.manageHiliteState = false;\n }\n\n public override async onCleanup(): Promise<void> {\n this.clearGraphics();\n this.updateAgendaAppearanceProvider(true);\n return super.onCleanup();\n }\n}\n"]}
1
+ {"version":3,"file":"ModifyElementTool.js","sourceRoot":"","sources":["../../src/ModifyElementTool.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAkC,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAuE,MAAM,oBAAoB,CAAC;AAC5H,OAAO,EAAkC,cAAc,EAAwD,SAAS,EAA2D,MAAM,sBAAsB,CAAC;AAEhN,OAAO,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9F;;GAEG;AACH,MAAM,OAAgB,iBAAkB,SAAQ,cAAc;IAA9D;;QACqB,gBAAW,GAAG,IAAI,GAAG,EAAuB,CAAC;IAyFlE,CAAC;IAvFW,SAAS,CAAC,GAAa,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC;IACnC,oBAAoB,CAAC,EAAwB,EAAE,oBAA6B,IAAa,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,EAAE,oBAAoB,CAAC,IAAI,SAAS,KAAK,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzM,uBAAuB,KAAW,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAE7D,KAAK,CAAC,2BAA2B,CAA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;QACrB,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { Id64, Id64Arg, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport { FeatureAppearance, FlatBufferGeometryStream, GeometricElementProps, JsonGeometryStream } from \"@itwin/core-common\";\nimport { BeButtonEvent, DynamicsContext, ElementSetTool, FeatureOverrideProvider, FeatureSymbology, HitDetail, IModelApp, LocateResponse, SelectionMethod, SelectionSet, Viewport } from \"@itwin/core-frontend\";\nimport { Point3d } from \"@itwin/core-geometry\";\nimport { computeChordToleranceFromPoint, DynamicGraphicsProvider } from \"./CreateElementTool\";\n\n/** Edit tool base class for updating existing elements.\n * @beta\n */\nexport abstract class ModifyElementTool extends ElementSetTool {\n protected readonly _checkedIds = new Map<Id64String, boolean>();\n\n protected allowView(_vp: Viewport) { return true; }\n public override isCompatibleViewport(vp: Viewport | undefined, isSelectedViewChange: boolean): boolean { return (super.isCompatibleViewport(vp, isSelectedViewChange) && undefined !== vp && this.allowView(vp)); }\n\n protected onGeometryFilterChanged(): void { this._checkedIds.clear(); }\n\n protected async doAcceptElementForOperation(_id: Id64String): Promise<boolean> { return false; }\n\n protected async acceptElementForOperation(id: Id64String): Promise<boolean> {\n if (Id64.isInvalid(id) || Id64.isTransient(id))\n return false;\n\n let accept = this._checkedIds.get(id);\n\n if (undefined === accept) {\n if (this.agenda.isEmpty && this._checkedIds.size > 1000)\n this._checkedIds.clear(); // Limit auto-locate cache size to something reasonable...\n\n accept = await this.doAcceptElementForOperation(id);\n this._checkedIds.set(id, accept);\n }\n\n return accept;\n }\n\n protected override async isElementValidForOperation(hit: HitDetail, out?: LocateResponse): Promise<boolean> {\n if (!await super.isElementValidForOperation(hit, out))\n return false;\n\n return this.acceptElementForOperation(hit.sourceId);\n }\n\n protected async postFilterIds(arg: Id64Arg): Promise<Id64Arg> {\n const ids: Id64Array = [];\n\n for (const id of Id64.iterable(arg)) {\n if (await this.acceptElementForOperation(id))\n ids.push(id);\n }\n\n return ids;\n }\n\n protected override async getGroupIds(id: Id64String): Promise<Id64Arg> {\n return this.postFilterIds(await super.getGroupIds(id));\n }\n\n protected override async getSelectionSetCandidates(ss: SelectionSet): Promise<Id64Arg> {\n return this.postFilterIds(await super.getSelectionSetCandidates(ss));\n }\n\n protected override async getDragSelectCandidates(vp: Viewport, origin: Point3d, corner: Point3d, method: SelectionMethod, overlap: boolean): Promise<Id64Arg> {\n return this.postFilterIds(await super.getDragSelectCandidates(vp, origin, corner, method, overlap));\n }\n\n protected setupAccuDraw(): void { }\n\n protected override setupAndPromptForNextAction(): void {\n this.setupAccuDraw();\n super.setupAndPromptForNextAction();\n }\n\n protected abstract getGeometryProps(ev: BeButtonEvent, isAccept: boolean): JsonGeometryStream | FlatBufferGeometryStream | undefined;\n protected abstract getElementProps(ev: BeButtonEvent): GeometricElementProps | undefined;\n\n protected async doUpdateElement(_props: GeometricElementProps): Promise<boolean> { return false; }\n\n protected async applyAgendaOperation(ev: BeButtonEvent): Promise<boolean> {\n const geometry = this.getGeometryProps(ev, true);\n if (undefined === geometry)\n return false;\n\n const elemProps = this.getElementProps(ev);\n if (undefined === elemProps)\n return false;\n\n if (\"flatbuffer\" === geometry.format)\n elemProps.elementGeometryBuilderParams = { entryArray: geometry.data };\n else\n elemProps.geom = geometry.data;\n\n return this.doUpdateElement(elemProps);\n }\n\n public override async processAgenda(ev: BeButtonEvent): Promise<void> {\n if (await this.applyAgendaOperation(ev))\n return this.saveChanges();\n }\n}\n\n/** Edit tool base class for updating existing elements that use dynamics to show intermediate results.\n * @beta\n */\nexport abstract class ModifyElementWithDynamicsTool extends ModifyElementTool implements FeatureOverrideProvider {\n protected _graphicsProvider?: DynamicGraphicsProvider;\n protected _firstResult = true;\n protected _agendaAppearanceDefault?: FeatureAppearance;\n protected _agendaAppearanceDynamic?: FeatureAppearance;\n\n protected override get wantAccuSnap(): boolean { return true; }\n protected override get wantDynamics(): boolean { return true; }\n\n protected agendaAppearance(isDynamics: boolean): FeatureAppearance {\n if (isDynamics) {\n if (undefined === this._agendaAppearanceDynamic)\n this._agendaAppearanceDynamic = FeatureAppearance.fromTransparency(0.0);\n\n return this._agendaAppearanceDynamic;\n }\n\n if (undefined === this._agendaAppearanceDefault)\n this._agendaAppearanceDefault = FeatureAppearance.fromTransparency(0.9);\n\n return this._agendaAppearanceDefault;\n }\n\n protected get wantAgendaAppearanceOverride(): boolean { return false; }\n\n public addFeatureOverrides(overrides: FeatureSymbology.Overrides, _vp: Viewport): void {\n if (this.agenda.isEmpty)\n return;\n\n const appearance = this.agendaAppearance(false);\n this.agenda.elements.forEach((elementId) => overrides.override({ elementId, appearance }));\n }\n\n protected updateAgendaAppearanceProvider(drop?: true): void {\n if (!this.wantAgendaAppearanceOverride)\n return;\n\n for (const vp of IModelApp.viewManager) {\n if (!this.allowView(vp))\n continue;\n\n if (drop || this.agenda.isEmpty)\n vp.dropFeatureOverrideProvider(this);\n else if (!vp.addFeatureOverrideProvider(this))\n vp.setFeatureOverrideProviderChanged();\n }\n }\n\n protected clearGraphics(): void {\n if (undefined === this._graphicsProvider)\n return;\n this._graphicsProvider.cleanupGraphic();\n this._graphicsProvider = undefined;\n }\n\n protected async createGraphics(ev: BeButtonEvent): Promise<void> {\n if (!IModelApp.viewManager.inDynamicsMode)\n return; // Don't need to create graphic if dynamics aren't yet active...\n\n const geometry = this.getGeometryProps(ev, false);\n if (undefined === geometry) {\n this.clearGraphics();\n return;\n }\n\n const elemProps = this.getElementProps(ev);\n if (undefined === elemProps?.placement) {\n this.clearGraphics();\n return;\n }\n\n if (undefined === this._graphicsProvider) {\n if (this._firstResult) {\n this.updateAgendaAppearanceProvider();\n this._firstResult = false;\n }\n this._graphicsProvider = new DynamicGraphicsProvider(this.iModel, this.toolId);\n }\n\n // Set chord tolerance for non-linear/non-planar geometry...\n if (ev.viewport)\n this._graphicsProvider.chordTolerance = computeChordToleranceFromPoint(ev.viewport, ev.point);\n\n await this._graphicsProvider.createGraphic(elemProps.category, elemProps.placement, geometry);\n }\n\n public override onDynamicFrame(_ev: BeButtonEvent, context: DynamicsContext): void {\n if (undefined !== this._graphicsProvider)\n this._graphicsProvider.addGraphic(context);\n }\n\n public override async onMouseMotion(ev: BeButtonEvent): Promise<void> {\n return this.createGraphics(ev);\n }\n\n public override async onUnsuspend(): Promise<void> {\n if (!this._firstResult)\n this.updateAgendaAppearanceProvider();\n return super.onUnsuspend();\n }\n\n public override async onSuspend(): Promise<void> {\n if (!this._firstResult)\n this.updateAgendaAppearanceProvider(true);\n return super.onSuspend();\n }\n\n public override async onPostInstall(): Promise<void> {\n await super.onPostInstall();\n if (this.wantAgendaAppearanceOverride)\n this.agenda.manageHiliteState = false;\n }\n\n public override async onCleanup(): Promise<void> {\n this.clearGraphics();\n this.updateAgendaAppearanceProvider(true);\n return super.onCleanup();\n }\n}\n"]}
@@ -724,7 +724,7 @@ export class ProjectExtentsClipDecoration extends EditManipulator.HandleProvider
724
724
  /** Show project location decoration. Project extents represented by view clip.
725
725
  * @beta
726
726
  */
727
- class ProjectLocationShowTool extends Tool {
727
+ export class ProjectLocationShowTool extends Tool {
728
728
  async run() {
729
729
  const vp = IModelApp.viewManager.selectedView;
730
730
  if (undefined === vp || !ProjectExtentsClipDecoration.show(vp))
@@ -734,11 +734,10 @@ class ProjectLocationShowTool extends Tool {
734
734
  }
735
735
  }
736
736
  ProjectLocationShowTool.toolId = "ProjectLocation.Show";
737
- export { ProjectLocationShowTool };
738
737
  /** Hide project location decoration. Preserves changes to project extents view clip and geolocation.
739
738
  * @beta
740
739
  */
741
- class ProjectLocationHideTool extends Tool {
740
+ export class ProjectLocationHideTool extends Tool {
742
741
  async run() {
743
742
  ProjectExtentsClipDecoration.hide();
744
743
  await IModelApp.toolAdmin.startDefaultTool();
@@ -746,11 +745,10 @@ class ProjectLocationHideTool extends Tool {
746
745
  }
747
746
  }
748
747
  ProjectLocationHideTool.toolId = "ProjectLocation.Hide";
749
- export { ProjectLocationHideTool };
750
748
  /** Clear project location decoration. Restore modified geolocation and remove view clip.
751
749
  * @beta
752
750
  */
753
- class ProjectLocationCancelTool extends Tool {
751
+ export class ProjectLocationCancelTool extends Tool {
754
752
  async run() {
755
753
  ProjectExtentsClipDecoration.clear();
756
754
  await IModelApp.toolAdmin.startDefaultTool();
@@ -758,13 +756,12 @@ class ProjectLocationCancelTool extends Tool {
758
756
  }
759
757
  }
760
758
  ProjectLocationCancelTool.toolId = "ProjectLocation.Cancel";
761
- export { ProjectLocationCancelTool };
762
759
  /** Save modified project extents and geolocation. Updates decoration to reflect saved state.
763
760
  * @note Allowing this change to be undone is both problematic and undesirable.
764
761
  * Warns the user if called with previous changes to cancel restarting the TxnManager session.
765
762
  * @beta
766
763
  */
767
- class ProjectLocationSaveTool extends Tool {
764
+ export class ProjectLocationSaveTool extends Tool {
768
765
  async allowRestartTxnSession(iModel) {
769
766
  if (!await iModel.txns.isUndoPossible())
770
767
  return true;
@@ -815,5 +812,4 @@ class ProjectLocationSaveTool extends Tool {
815
812
  }
816
813
  }
817
814
  ProjectLocationSaveTool.toolId = "ProjectLocation.Save";
818
- export { ProjectLocationSaveTool };
819
815
  //# sourceMappingURL=ProjectExtentsDecoration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectExtentsDecoration.js","sourceRoot":"","sources":["../../../src/ProjectLocation/ProjectExtentsDecoration.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAgB,QAAQ,EAAE,YAAY,EAAqB,MAAM,oBAAoB,CAAC;AAC7F,OAA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D,SAAS,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,oBAAoB,CAAC,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YAC3H,OAAO,IAAI,CAAC;SACb;QAED,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;;AA9DsB,8BAAM,GAAG,sBAAsB,CAAC;SAD5C,uBAAuB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { BeDuration, BeEvent, BentleyError } from \"@itwin/core-bentley\";\nimport { Cartographic, ColorDef, EcefLocation, EcefLocationProps } from \"@itwin/core-common\";\nimport {\n BeButton, BeButtonEvent, BriefcaseConnection, CoreTools, DecorateContext, EditManipulator, EventHandled, GraphicType, HitDetail, IModelApp,\n IModelConnection, MessageBoxIconType, MessageBoxType, MessageBoxValue, NotifyMessageDetails, OutputMessagePriority, QuantityType, ScreenViewport,\n Tool, ViewClipControlArrow, ViewClipDecorationProvider, ViewClipShapeModifyTool, ViewClipTool, Viewport,\n} from \"@itwin/core-frontend\";\nimport {\n Angle, Arc3d, AxisIndex, AxisOrder, ClipShape, ClipVector, Constant, Matrix3d, Point3d, PolygonOps, Range1d, Range3d, Range3dProps, Ray3d,\n Transform, Vector3d,\n} from \"@itwin/core-geometry\";\nimport { editorBuiltInCmdIds } from \"@itwin/editor-common\";\nimport { EditTools } from \"../EditTool\";\nimport { basicManipulationIpc } from \"../EditToolIpc\";\nimport { ProjectGeolocationNorthTool, ProjectGeolocationPointTool } from \"./ProjectGeolocation\";\n\nfunction translateMessage(key: string) {\n return EditTools.translate(`ProjectLocation:Message.${key}`);\n}\nfunction translateMessageBold(key: string) {\n return `<b>${translateMessage(key)}:</b> `;\n}\nfunction translateCoreMeasureBold(key: string) {\n return `<b>${CoreTools.translate(`Measure.Labels.${key}`)}:</b> `;\n}\n\nfunction clearViewClip(vp: ScreenViewport): boolean {\n if (!ViewClipTool.doClipClear(vp))\n return false;\n ViewClipDecorationProvider.create().onClearClip(vp); // Send clear event...\n ViewClipDecorationProvider.clear();\n return true;\n}\n\nfunction clipToProjectExtents(vp: ScreenViewport): boolean {\n clearViewClip(vp); // Clear any existing view clip and send clear event...\n ViewClipTool.enableClipVolume(vp);\n return ViewClipTool.doClipToRange(vp, vp.iModel.projectExtents, Transform.createIdentity());\n}\n\nfunction enableBackgroundMap(viewport: Viewport, onOff: boolean): boolean {\n if (onOff === viewport.viewFlags.backgroundMap)\n return false;\n\n viewport.viewFlags = viewport.viewFlags.with(\"backgroundMap\", onOff);\n return true;\n}\n\nfunction updateMapDisplay(vp: ScreenViewport, turnOnMap: boolean): void {\n if (!turnOnMap || !enableBackgroundMap(vp, true))\n vp.invalidateRenderPlan();\n}\n\nclass ProjectExtentsControlArrow extends ViewClipControlArrow {\n public extentValid = true;\n}\n\n/** Values for [[ProjectExtentsClipDecoration.onChanged] event.\n * @beta\n */\nexport enum ProjectLocationChanged {\n /** Extents has been modified (unsaved changes) */\n Extents,\n /** Geolocation has been modified (unsaved changes) */\n Geolocation,\n /** Abandon unsaved changes to extents */\n ResetExtents,\n /** Abandon unsaved changes to geolocation */\n ResetGeolocation,\n /** Decoration hidden (unsaved changes preserved) */\n Hide,\n /** Decoration shown (unsaved changes restored) */\n Show,\n /** Save changes to extents and geolocation */\n Save,\n}\n\n/** Controls to modify project extents shown using view clip\n * @beta\n */\nexport class ProjectExtentsClipDecoration extends EditManipulator.HandleProvider {\n private static _decorator?: ProjectExtentsClipDecoration;\n protected _clip?: ClipVector;\n protected _clipId?: string;\n protected _clipShape?: ClipShape;\n protected _clipShapeExtents?: Range1d;\n protected _clipRange?: Range3d;\n protected _extentsLengthValid = true;\n protected _extentsWidthValid = true;\n protected _extentsHeightValid = true;\n protected _ecefLocation?: EcefLocation;\n protected _allowEcefLocationChange = false;\n protected _controlIds: string[] = [];\n protected _controls: ProjectExtentsControlArrow[] = [];\n protected _monumentPoint?: Point3d;\n protected _northDirection?: Ray3d;\n protected _monumentId?: string;\n protected _northId?: string;\n protected _suspendDecorator = false;\n protected _removeViewCloseListener?: () => void;\n public suspendGeolocationDecorations = false;\n\n /** Called when project extents or geolocation is modified */\n public readonly onChanged = new BeEvent<(iModel: IModelConnection, ev: ProjectLocationChanged) => void>();\n\n public constructor(public viewport: ScreenViewport) {\n super(viewport.iModel);\n\n if (!this.init())\n return;\n\n this._monumentId = this.iModel.transientIds.getNext();\n this._northId = this.iModel.transientIds.getNext();\n this._clipId = this.iModel.transientIds.getNext();\n\n this.start();\n }\n\n protected start(): void {\n this.updateDecorationListener(true);\n this._removeViewCloseListener = IModelApp.viewManager.onViewClose.addListener((vp) => this.onViewClose(vp));\n this.iModel.selectionSet.replace(this._clipId!); // Always select decoration on create...\n }\n\n protected override stop(): void {\n const selectedId = (undefined !== this._clipId && this.iModel.selectionSet.has(this._clipId)) ? this._clipId : undefined;\n this._clipId = undefined; // Invalidate id so that decorator will be dropped...\n super.stop();\n if (undefined !== selectedId)\n this.iModel.selectionSet.remove(selectedId); // Don't leave decorator id in selection set...\n if (undefined !== this._removeViewCloseListener) {\n this._removeViewCloseListener();\n this._removeViewCloseListener = undefined;\n }\n }\n\n protected init(): boolean {\n if (!this.getClipData())\n return false;\n\n this._ecefLocation = this.iModel.ecefLocation;\n this._monumentPoint = this.getMonumentPoint();\n this._northDirection = this.getNorthDirection();\n\n return true;\n }\n\n public onViewClose(vp: ScreenViewport): void {\n if (this.viewport === vp)\n ProjectExtentsClipDecoration.clear();\n }\n\n private getClipData(): boolean {\n this._clip = this._clipShape = this._clipShapeExtents = this._clipRange = undefined;\n const clip = this.viewport.view.getViewClip();\n if (undefined === clip)\n return false;\n\n const clipShape = ViewClipTool.isSingleClipShape(clip);\n if (undefined === clipShape)\n return false;\n\n if (5 !== clipShape.polygon.length || undefined === clipShape.zLow || undefined === clipShape.zHigh)\n return false; // Not a box, can't be project extents clip...\n\n if (undefined !== clipShape.transformFromClip && !clipShape.transformFromClip.isIdentity)\n return false; // Not axis aligned, can't be project extents clip...\n\n this._clipShapeExtents = Range1d.createXX(clipShape.zLow, clipShape.zHigh);\n this._clipShape = clipShape;\n this._clip = clip;\n\n this._clipRange = Range3d.create();\n const shapePtsLo = ViewClipTool.getClipShapePoints(this._clipShape, this._clipShapeExtents.low);\n const shapePtsHi = ViewClipTool.getClipShapePoints(this._clipShape, this._clipShapeExtents.high);\n\n this._clipRange.extendArray(shapePtsLo);\n this._clipRange.extendArray(shapePtsHi);\n\n return true;\n }\n\n private ensureNumControls(numReqControls: number): void {\n const numCurrent = this._controlIds.length;\n if (numCurrent < numReqControls) {\n const transientIds = this.iModel.transientIds;\n for (let i: number = numCurrent; i < numReqControls; i++)\n this._controlIds[i] = transientIds.getNext();\n } else if (numCurrent > numReqControls) {\n this._controlIds.length = numReqControls;\n }\n }\n\n private createClipShapeControls(): boolean {\n if (undefined === this._clipShape)\n return false;\n\n const shapePtsLo = ViewClipTool.getClipShapePoints(this._clipShape, this._clipShapeExtents!.low);\n const shapePtsHi = ViewClipTool.getClipShapePoints(this._clipShape, this._clipShapeExtents!.high);\n const shapeArea = PolygonOps.centroidAreaNormal(shapePtsLo);\n if (undefined === shapeArea)\n return false;\n\n const numControls = shapePtsLo.length + 1; // Number of edge midpoints plus zLow and zHigh...\n this.ensureNumControls(numControls);\n\n for (let i: number = 0; i < numControls - 2; i++) {\n const midPtLo = shapePtsLo[i].interpolate(0.5, shapePtsLo[i + 1]);\n const midPtHi = shapePtsHi[i].interpolate(0.5, shapePtsHi[i + 1]);\n const faceCenter = midPtLo.interpolate(0.5, midPtHi);\n const edgeTangent = Vector3d.createStartEnd(shapePtsLo[i], shapePtsLo[i + 1]);\n const faceNormal = edgeTangent.crossProduct(shapeArea.direction);\n faceNormal.normalizeInPlace();\n this._controls[i] = new ProjectExtentsControlArrow(faceCenter, faceNormal, 0.75);\n this._controls[i].extentValid = (faceNormal.isParallelTo(Vector3d.unitX(), true) ? this._extentsLengthValid : this._extentsWidthValid);\n }\n\n const zFillColor = ColorDef.from(150, 150, 250);\n this._controls[numControls - 2] = new ProjectExtentsControlArrow(shapeArea.origin, Vector3d.unitZ(-1.0), 0.75, zFillColor, undefined, \"zLow\");\n this._controls[numControls - 1] = new ProjectExtentsControlArrow(shapeArea.origin.plusScaled(Vector3d.unitZ(), shapePtsLo[0].distance(shapePtsHi[0])), Vector3d.unitZ(), 0.75, zFillColor, undefined, \"zHigh\");\n this._controls[numControls - 2].extentValid = this._extentsHeightValid;\n this._controls[numControls - 1].extentValid = this._extentsHeightValid;\n\n return true;\n }\n\n /** Allow project extents for map projections to be larger since curvature of the earth is accounted for. */\n protected get maxExtentLength(): number { return ((this._allowEcefLocationChange ? 20 : 350) * Constant.oneKilometer); }\n\n /** Impose some reasonable height limit for project extents. */\n protected get maxExtentHeight(): number { return (2 * Constant.oneKilometer); }\n\n protected hasValidGCS(): boolean {\n if (!this.iModel.isGeoLocated || this.iModel.noGcsDefined)\n return false;\n\n const gcs = this.iModel.geographicCoordinateSystem;\n if (undefined === gcs || undefined === gcs.horizontalCRS)\n return false; // A valid GCS ought to have horizontalCR defined...\n\n // Check for approximate GCS (such as from MicroStation's \"From Placemark\" tool) and allow it to be replaced...\n const hasValidId = (undefined !== gcs.horizontalCRS.id && 0 !== gcs.horizontalCRS.id.length);\n const hasValidDescr = (undefined !== gcs.horizontalCRS.description && 0 !== gcs.horizontalCRS.description.length);\n const hasValidProjection = (undefined !== gcs.horizontalCRS.projection && \"AzimuthalEqualArea\" !== gcs.horizontalCRS.projection.method);\n\n return hasValidId || hasValidDescr || hasValidProjection;\n }\n\n protected async createControls(): Promise<boolean> {\n // Always update to current view clip to handle post-modify, etc.\n if (undefined === this._clipId || !this.getClipData())\n return false;\n\n this._allowEcefLocationChange = !this.hasValidGCS();\n\n if (undefined !== this._clipRange) {\n this._extentsLengthValid = (this._clipRange.xLength() < this.maxExtentLength);\n this._extentsWidthValid = (this._clipRange.yLength() < this.maxExtentLength);\n this._extentsHeightValid = (this._clipRange.zLength() < this.maxExtentHeight);\n }\n\n // Show controls if only range box and it's controls are selected, selection set doesn't include any other elements...\n let showControls = false;\n if (this.iModel.selectionSet.size <= this._controlIds.length + 1 && this.iModel.selectionSet.has(this._clipId)) {\n showControls = true;\n if (this.iModel.selectionSet.size > 1) {\n this.iModel.selectionSet.elements.forEach((val) => {\n if (this._clipId !== val && !this._controlIds.includes(val))\n showControls = false;\n });\n }\n }\n\n if (!showControls)\n return false; // Don't clear decoration on de-select...\n\n return this.createClipShapeControls();\n }\n\n protected override clearControls(): void {\n this.iModel.selectionSet.remove(this._controlIds); // Remove any selected controls as they won't continue to be displayed...\n super.clearControls();\n }\n\n protected async modifyControls(hit: HitDetail, _ev: BeButtonEvent): Promise<boolean> {\n if (undefined === this._clip || hit.sourceId === this._clipId)\n return false;\n\n const saveQualifiers = IModelApp.toolAdmin.currentInputState.qualifiers;\n if (undefined !== this._clipShape) {\n const clipShapeModifyTool = new ViewClipShapeModifyTool(this, this._clip, this.viewport, hit.sourceId, this._controlIds, this._controls);\n this._suspendDecorator = await clipShapeModifyTool.run();\n }\n\n if (this._suspendDecorator)\n IModelApp.toolAdmin.currentInputState.qualifiers = saveQualifiers; // onInstallTool cleared qualifiers, preserve for \"modify all\" behavior when shift was held and drag started...\n\n return this._suspendDecorator;\n }\n\n protected override async onRightClick(_hit: HitDetail, _ev: BeButtonEvent): Promise<EventHandled> { return EventHandled.No; }\n\n protected override async onTouchTap(hit: HitDetail, ev: BeButtonEvent): Promise<EventHandled> { return (hit.sourceId === this._clipId ? EventHandled.No : super.onTouchTap(hit, ev)); }\n\n public override async onDecorationButtonEvent(hit: HitDetail, ev: BeButtonEvent): Promise<EventHandled> {\n if (hit.sourceId === this._monumentId) {\n if (BeButton.Data === ev.button && !ev.isDown && !ev.isDragging)\n await ProjectGeolocationPointTool.startTool();\n return EventHandled.Yes; // Only pickable for tooltip, don't allow selection...\n }\n\n if (hit.sourceId === this._northId) {\n if (BeButton.Data === ev.button && !ev.isDown && !ev.isDragging)\n await ProjectGeolocationNorthTool.startTool();\n return EventHandled.Yes; // Only pickable for tooltip, don't allow selection...\n }\n\n return super.onDecorationButtonEvent(hit, ev);\n }\n\n public override onManipulatorEvent(eventType: EditManipulator.EventType): void {\n if (EditManipulator.EventType.Accept === eventType)\n this.onChanged.raiseEvent(this.iModel, ProjectLocationChanged.Extents);\n this._suspendDecorator = false;\n super.onManipulatorEvent(eventType);\n }\n\n public async getDecorationToolTip(hit: HitDetail): Promise<HTMLElement | string> {\n const quantityFormatter = IModelApp.quantityFormatter;\n const toolTip = document.createElement(\"div\");\n let toolTipHtml = \"\";\n\n if (hit.sourceId === this._monumentId) {\n toolTipHtml += `${translateMessage(\"ModifyGeolocation\")}<br>`;\n\n const coordFormatterSpec = quantityFormatter.findFormatterSpecByQuantityType(QuantityType.Coordinate);\n if (undefined !== coordFormatterSpec) {\n const pointAdjusted = this._monumentPoint!.minus(this.iModel.globalOrigin);\n const formattedPointX = quantityFormatter.formatQuantity(pointAdjusted.x, coordFormatterSpec);\n const formattedPointY = quantityFormatter.formatQuantity(pointAdjusted.y, coordFormatterSpec);\n const formattedPointZ = quantityFormatter.formatQuantity(pointAdjusted.z, coordFormatterSpec);\n toolTipHtml += `${translateCoreMeasureBold(\"Coordinate\") + formattedPointX}, ${formattedPointY}, ${formattedPointZ}<br>`;\n }\n\n const latLongFormatterSpec = quantityFormatter.findFormatterSpecByQuantityType(QuantityType.LatLong);\n if (undefined !== latLongFormatterSpec && undefined !== coordFormatterSpec && this.iModel.isGeoLocated) {\n const cartographic = this.iModel.spatialToCartographicFromEcef(this._monumentPoint!);\n const formattedLat = quantityFormatter.formatQuantity(Math.abs(cartographic.latitude), latLongFormatterSpec);\n const formattedLong = quantityFormatter.formatQuantity(Math.abs(cartographic.longitude), latLongFormatterSpec);\n const formattedHeight = quantityFormatter.formatQuantity(cartographic.height, coordFormatterSpec);\n const latDir = CoreTools.translate(cartographic.latitude < 0 ? \"Measure.Labels.S\" : \"Measure.Labels.N\");\n const longDir = CoreTools.translate(cartographic.longitude < 0 ? \"Measure.Labels.W\" : \"Measure.Labels.E\");\n toolTipHtml += `${translateCoreMeasureBold(\"LatLong\") + formattedLat + latDir}, ${formattedLong}${longDir}<br>`;\n toolTipHtml += `${translateCoreMeasureBold(\"Altitude\") + formattedHeight}<br>`;\n }\n\n } else if (hit.sourceId === this._northId) {\n toolTipHtml += `${translateMessage(\"ModifyNorthDirection\")}<br>`;\n\n const angleFormatterSpec = quantityFormatter.findFormatterSpecByQuantityType(QuantityType.Angle);\n if (undefined !== angleFormatterSpec) {\n const formattedAngle = quantityFormatter.formatQuantity(this.getClockwiseAngleToNorth().radians, angleFormatterSpec);\n toolTipHtml += `${translateMessageBold(\"Angle\") + formattedAngle}<br>`;\n }\n\n } else if (hit.sourceId === this._clipId) {\n const extentsValid = (this._extentsLengthValid && this._extentsWidthValid && this._extentsHeightValid);\n toolTipHtml += `${translateMessage(extentsValid ? \"ProjectExtents\" : \"LargeProjectExtents\")}<br>`;\n\n const distanceFormatterSpec = quantityFormatter.findFormatterSpecByQuantityType(QuantityType.Length);\n if (undefined !== distanceFormatterSpec && undefined !== this._clipRange) {\n const formattedLength = quantityFormatter.formatQuantity(this._clipRange.xLength(), distanceFormatterSpec);\n const formattedWidth = quantityFormatter.formatQuantity(this._clipRange.yLength(), distanceFormatterSpec);\n const formattedHeight = quantityFormatter.formatQuantity(this._clipRange.zLength(), distanceFormatterSpec);\n toolTipHtml += `${translateMessageBold(\"Length\") + formattedLength}<br>`;\n toolTipHtml += `${translateMessageBold(\"Width\") + formattedWidth}<br>`;\n toolTipHtml += `${translateMessageBold(\"Height\") + formattedHeight}<br>`;\n }\n\n } else {\n const arrowIndex = this._controlIds.indexOf(hit.sourceId);\n if (-1 !== arrowIndex) {\n toolTipHtml += `${translateMessage(\"ModifyProjectExtents\")}<br>`;\n\n const distanceFormatterSpec = quantityFormatter.findFormatterSpecByQuantityType(QuantityType.Length);\n if (undefined !== distanceFormatterSpec && undefined !== this._clipRange) {\n const arrowControl = this._controls[arrowIndex];\n\n let arrowLabel = \"\";\n let arrowLength = 0.0;\n let arrowLengthMax = 0.0;\n\n if (arrowControl.direction.isParallelTo(Vector3d.unitX(), true)) {\n arrowLabel = \"Length\";\n arrowLength = this._clipRange.xLength();\n if (!this._extentsLengthValid)\n arrowLengthMax = this.maxExtentLength;\n } else if (arrowControl.direction.isParallelTo(Vector3d.unitY(), true)) {\n arrowLabel = \"Width\";\n arrowLength = this._clipRange.yLength();\n if (!this._extentsWidthValid)\n arrowLengthMax = this.maxExtentLength;\n } else {\n arrowLabel = \"Height\";\n arrowLength = this._clipRange.zLength();\n if (!this._extentsHeightValid)\n arrowLengthMax = this.maxExtentHeight;\n\n const coordFormatterSpec = (this.iModel.isGeoLocated ? quantityFormatter.findFormatterSpecByQuantityType(QuantityType.Coordinate) : undefined);\n if (undefined !== coordFormatterSpec) {\n const heightPt = (\"zLow\" === arrowControl.name ? this._clipRange.low : this._clipRange.high);\n const cartographic = this.iModel.spatialToCartographicFromEcef(heightPt);\n const formattedAltitude = quantityFormatter.formatQuantity(cartographic.height, coordFormatterSpec);\n toolTipHtml += `${translateCoreMeasureBold(\"Altitude\") + formattedAltitude}<br>`;\n }\n }\n\n const formattedLength = quantityFormatter.formatQuantity(arrowLength, distanceFormatterSpec);\n toolTipHtml += `${translateMessageBold(arrowLabel) + formattedLength}<br>`;\n\n if (0.0 !== arrowLengthMax) {\n const formattedMaxLength = quantityFormatter.formatQuantity(arrowLengthMax, distanceFormatterSpec);\n toolTipHtml += `${translateMessageBold(\"MaxExtent\") + formattedMaxLength}<br>`;\n }\n }\n }\n }\n\n toolTip.innerHTML = toolTipHtml;\n return toolTip;\n }\n\n public testDecorationHit(id: string): boolean { return (id === this._monumentId || id === this._northId || id === this._clipId || this._controlIds.includes(id)); }\n protected override updateDecorationListener(_add: boolean): void { super.updateDecorationListener(undefined !== this._clipId); } // Decorator isn't just for resize controls...\n\n public getMonumentPoint(): Point3d {\n const origin = Point3d.createZero();\n if (this.iModel.ecefLocation && this.iModel.ecefLocation.cartographicOrigin)\n return this.iModel.cartographicToSpatialFromEcef(this.iModel.ecefLocation.cartographicOrigin, origin);\n origin.setFrom(this.iModel.projectExtents.low);\n if (0.0 > this.iModel.projectExtents.low.z && 0.0 < this.iModel.projectExtents.high.z)\n origin.z = 0.0;\n return origin;\n }\n\n public getClockwiseAngleToNorth(): Angle {\n const angle = this.getNorthAngle();\n angle.setRadians(Angle.adjustRadians0To2Pi(angle.radians));\n return angle;\n }\n\n public getNorthAngle(): Angle {\n const northDirection = (undefined !== this._northDirection ? this._northDirection : this.getNorthDirection());\n return northDirection.direction.angleToXY(Vector3d.unitY());\n }\n\n public getNorthDirection(refOrigin?: Point3d): Ray3d {\n const origin = (undefined !== refOrigin ? refOrigin : this.iModel.projectExtents.center);\n\n if (!this.iModel.isGeoLocated)\n return Ray3d.create(origin, Vector3d.unitY());\n\n const cartographic = this.iModel.spatialToCartographicFromEcef(origin);\n cartographic.latitude += Angle.createDegrees(0.01).radians;\n const pt2 = this.iModel.cartographicToSpatialFromEcef(cartographic);\n const northVec = Vector3d.createStartEnd(origin, pt2);\n northVec.z = 0.0;\n northVec.normalizeInPlace();\n\n return Ray3d.create(origin, northVec);\n }\n\n public drawNorthArrow(context: DecorateContext, northDir: Ray3d, id?: string): void {\n const vp = context.viewport;\n const pixelSize = vp.pixelsFromInches(0.55);\n const scale = vp.viewingSpace.getPixelSizeAtPoint(northDir.origin) * pixelSize;\n const matrix = Matrix3d.createRigidFromColumns(northDir.direction, Vector3d.unitZ(), AxisOrder.YZX);\n\n if (undefined === matrix)\n return;\n\n matrix.scaleColumnsInPlace(scale, scale, scale);\n const arrowTrans = Transform.createRefs(northDir.origin, matrix);\n\n const northArrowBuilder = context.createGraphicBuilder(GraphicType.WorldOverlay, arrowTrans, id);\n const color = ColorDef.white;\n\n const arrowOutline: Point3d[] = [];\n arrowOutline[0] = Point3d.create(0.0, 0.65);\n arrowOutline[1] = Point3d.create(-0.45, -0.5);\n arrowOutline[2] = Point3d.create(0.0, -0.2);\n arrowOutline[3] = Point3d.create(0.45, -0.5);\n arrowOutline[4] = arrowOutline[0].clone();\n\n const arrowLeftFill: Point3d[] = [];\n arrowLeftFill[0] = arrowOutline[0].clone();\n arrowLeftFill[1] = arrowOutline[1].clone();\n arrowLeftFill[2] = arrowOutline[2].clone();\n arrowLeftFill[3] = arrowLeftFill[0].clone();\n\n const arrowRightFill: Point3d[] = [];\n arrowRightFill[0] = arrowOutline[0].clone();\n arrowRightFill[1] = arrowOutline[3].clone();\n arrowRightFill[2] = arrowOutline[2].clone();\n arrowRightFill[3] = arrowRightFill[0].clone();\n\n northArrowBuilder.setSymbology(color, ColorDef.from(0, 0, 0, 200), 1);\n northArrowBuilder.addArc(Arc3d.createXY(Point3d.createZero(), 0.6), true, true);\n northArrowBuilder.addArc(Arc3d.createXY(Point3d.create(0.0, 0.85), 0.2), true, true);\n\n northArrowBuilder.setSymbology(color, color, 2);\n northArrowBuilder.addArc(Arc3d.createXY(Point3d.createZero(), 0.5), false, false);\n northArrowBuilder.addLineString([Point3d.create(0.6, 0.0), Point3d.create(-0.6, 0.0)]);\n northArrowBuilder.addLineString([Point3d.create(0.0, 0.6), Point3d.create(0.0, -0.6)]);\n\n northArrowBuilder.setSymbology(color, ColorDef.from(150, 150, 150), 1);\n northArrowBuilder.addShape(arrowLeftFill);\n\n northArrowBuilder.setSymbology(color, ColorDef.black, 1);\n northArrowBuilder.addShape(arrowRightFill);\n\n northArrowBuilder.setSymbology(color, color, 1);\n northArrowBuilder.addLineString(arrowOutline);\n northArrowBuilder.setSymbology(color, color, 3);\n northArrowBuilder.addLineString([Point3d.create(-0.1, 0.75), Point3d.create(-0.1, 0.95), Point3d.create(0.1, 0.75), Point3d.create(0.1, 0.95)]);\n\n context.addDecorationFromBuilder(northArrowBuilder);\n }\n\n public drawMonumentPoint(context: DecorateContext, point: Point3d, scaleFactor: number, id?: string): void {\n const vp = context.viewport;\n const pixelSize = vp.pixelsFromInches(0.25) * scaleFactor;\n const scale = vp.viewingSpace.getPixelSizeAtPoint(point) * pixelSize;\n const matrix = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, Angle.createDegrees(45.0));\n\n matrix.scaleColumnsInPlace(scale, scale, scale);\n const monumentTrans = Transform.createRefs(point, matrix);\n\n const monumentPointBuilder = context.createGraphicBuilder(GraphicType.WorldOverlay, monumentTrans, id);\n const color = ColorDef.white;\n\n monumentPointBuilder.setSymbology(color, ColorDef.from(0, 0, 0, 150), 1);\n monumentPointBuilder.addArc(Arc3d.createXY(Point3d.createZero(), 0.7), true, true);\n\n monumentPointBuilder.setSymbology(color, color, 2);\n monumentPointBuilder.addArc(Arc3d.createXY(Point3d.createZero(), 0.5), false, false);\n monumentPointBuilder.addLineString([Point3d.create(0.5, 0.0), Point3d.create(-0.5, 0.0)]);\n monumentPointBuilder.addLineString([Point3d.create(0.0, 0.5), Point3d.create(0.0, -0.5)]);\n\n context.addDecorationFromBuilder(monumentPointBuilder);\n }\n\n protected drawAreaTooLargeIndicator(context: DecorateContext): void {\n if ((this._extentsLengthValid && this._extentsWidthValid) || undefined === this._clipRange)\n return;\n\n const corners = this._clipRange.corners();\n const indices = Range3d.faceCornerIndices(5);\n const points: Point3d[] = [];\n\n for (const index of indices)\n points.push(corners[index]);\n\n const areaWarnColor = ColorDef.red.withAlpha(50);\n const areaWarnBuilder = context.createGraphicBuilder(GraphicType.WorldDecoration);\n\n areaWarnBuilder.setSymbology(areaWarnColor, areaWarnColor, 1);\n areaWarnBuilder.addShape(points);\n context.addDecorationFromBuilder(areaWarnBuilder);\n }\n\n protected drawExtentTooLargeIndicator(context: DecorateContext, worldPoint: Point3d, sizePixels: number): void {\n const position = context.viewport.worldToView(worldPoint);\n position.x = Math.floor(position.x) + 0.5;\n position.y = Math.floor(position.y) + 0.5;\n const drawDecoration = (ctx: CanvasRenderingContext2D) => {\n ctx.lineWidth = 4;\n ctx.lineCap = \"round\";\n ctx.strokeStyle = \"rgba(255,0,0,.75)\";\n ctx.fillStyle = \"rgba(255,255,255,.75)\";\n ctx.shadowColor = \"black\";\n ctx.shadowBlur = 5;\n\n ctx.beginPath();\n ctx.moveTo(0, -sizePixels);\n ctx.lineTo(-sizePixels, sizePixels);\n ctx.lineTo(sizePixels, sizePixels);\n ctx.lineTo(0, -sizePixels);\n ctx.fill();\n\n ctx.shadowBlur = 0;\n\n ctx.beginPath();\n ctx.moveTo(0, -sizePixels);\n ctx.lineTo(-sizePixels, sizePixels);\n ctx.lineTo(sizePixels, sizePixels);\n ctx.lineTo(0, -sizePixels);\n ctx.stroke();\n\n ctx.strokeStyle = \"black\";\n ctx.lineWidth = 3;\n\n ctx.beginPath();\n ctx.moveTo(0, -sizePixels * 0.2);\n ctx.lineTo(0, sizePixels * 0.3);\n ctx.moveTo(0, (sizePixels * 0.3) + 4);\n ctx.lineTo(0, (sizePixels * 0.3) + 4.5);\n ctx.stroke();\n\n };\n context.addCanvasDecoration({ position, drawDecoration });\n }\n\n public override decorate(context: DecorateContext): void {\n if (this._suspendDecorator)\n return;\n\n if (undefined === this._clipId || undefined === this._clipShape || undefined === this._clipRange)\n return;\n\n const vp = context.viewport;\n if (this.viewport !== vp)\n return;\n\n if (!this.suspendGeolocationDecorations && undefined !== this._northDirection && this.iModel.isGeoLocated)\n this.drawNorthArrow(context, this._northDirection, this._allowEcefLocationChange ? this._northId : undefined); // Show north, but don't make pickable if it shouldn't be modified...\n\n const maxSizeInches = ((this._clipRange.maxLength() / vp.viewingSpace.getPixelSizeAtPoint(this._clipRange.center)) / vp.pixelsPerInch) * 0.5; // Display size limit when zooming out...\n if (maxSizeInches < 0.5)\n return;\n\n if (!this.suspendGeolocationDecorations && undefined !== this._monumentPoint && this._allowEcefLocationChange)\n this.drawMonumentPoint(context, this._monumentPoint, 1.0, this._monumentId);\n\n ViewClipTool.drawClipShape(context, this._clipShape, this._clipShapeExtents!, ColorDef.white.adjustedForContrast(context.viewport.view.backgroundColor), 3, this._clipId);\n this.drawAreaTooLargeIndicator(context);\n\n if (!this._isActive)\n return;\n\n const outlineColor = ColorDef.from(0, 0, 0, 50).adjustedForContrast(vp.view.backgroundColor);\n const fillVisColor = ColorDef.from(150, 250, 200, 225).adjustedForContrast(vp.view.backgroundColor);\n const fillHidColor = fillVisColor.withAlpha(200);\n const fillSelColor = fillVisColor.inverse().withAlpha(75);\n const shapePts = EditManipulator.HandleUtils.getArrowShape(0.0, 0.15, 0.55, 1.0, 0.3, 0.5, 0.1);\n\n for (let iFace = 0; iFace < this._controlIds.length; iFace++) {\n const sizeInches = Math.min(this._controls[iFace].sizeInches, maxSizeInches);\n if (0.0 === sizeInches)\n continue;\n\n const anchorRay = ViewClipTool.getClipRayTransformed(this._controls[iFace].origin, this._controls[iFace].direction, undefined !== this._clipShape ? this._clipShape.transformFromClip : undefined);\n const transform = EditManipulator.HandleUtils.getArrowTransform(vp, anchorRay.origin, anchorRay.direction, sizeInches);\n if (undefined === transform)\n continue;\n\n // deep copies because we're using a builder transform w/addLineString...\n const visPts = shapePts.map((pt) => pt.clone());\n const hidPts = shapePts.map((pt) => pt.clone());\n\n const arrowVisBuilder = context.createGraphicBuilder(GraphicType.WorldOverlay, transform, this._controlIds[iFace]);\n const arrowHidBuilder = context.createGraphicBuilder(GraphicType.WorldDecoration, transform);\n const isSelected = this.iModel.selectionSet.has(this._controlIds[iFace]);\n\n let outlineColorOvr = this._controls[iFace].outline;\n if (undefined !== outlineColorOvr) {\n outlineColorOvr = outlineColorOvr.adjustedForContrast(vp.view.backgroundColor);\n outlineColorOvr = outlineColorOvr.withAlpha(outlineColor.getAlpha());\n } else {\n outlineColorOvr = outlineColor;\n }\n\n let fillVisColorOvr = this._controls[iFace].fill;\n let fillHidColorOvr = fillHidColor;\n let fillSelColorOvr = fillSelColor;\n if (undefined !== fillVisColorOvr) {\n fillVisColorOvr = fillVisColorOvr.adjustedForContrast(vp.view.backgroundColor);\n fillVisColorOvr = fillVisColorOvr.withAlpha(fillVisColor.getAlpha());\n fillHidColorOvr = fillVisColorOvr.withAlpha(fillHidColor.getAlpha());\n fillSelColorOvr = fillVisColorOvr.inverse().withAlpha(fillSelColor.getAlpha());\n } else {\n fillVisColorOvr = fillVisColor;\n }\n\n arrowVisBuilder.setSymbology(outlineColorOvr, outlineColorOvr, isSelected ? 4 : 2);\n arrowVisBuilder.addLineString(visPts);\n arrowVisBuilder.setBlankingFill(isSelected ? fillSelColorOvr : fillVisColorOvr);\n arrowVisBuilder.addShape(visPts);\n context.addDecorationFromBuilder(arrowVisBuilder);\n\n arrowHidBuilder.setSymbology(fillHidColorOvr, fillHidColorOvr, 1);\n arrowHidBuilder.addShape(hidPts);\n context.addDecorationFromBuilder(arrowHidBuilder);\n\n if (this._controls[iFace].extentValid)\n continue;\n\n const warnPixels = 15.0;\n const warnOffset = vp.viewingSpace.getPixelSizeAtPoint(anchorRay.origin) * warnPixels * 1.5;\n const warnOrigin = anchorRay.origin.plusScaled(anchorRay.direction, -warnOffset);\n this.drawExtentTooLargeIndicator(context, warnOrigin, warnPixels);\n }\n }\n\n public resetViewClip(): boolean {\n if (!clearViewClip(this.viewport))\n return false;\n\n if (undefined !== this.getModifiedExtents())\n this.onChanged.raiseEvent(this.iModel, ProjectLocationChanged.ResetExtents);\n\n return true;\n }\n\n public resetGeolocation(): boolean {\n if (!this._allowEcefLocationChange)\n return false;\n\n if (undefined === this.getModifiedEcefLocation())\n return false; // Wasn't changed...\n\n this.iModel.disableGCS(false);\n this.iModel.ecefLocation = this._ecefLocation;\n\n this._monumentPoint = this.getMonumentPoint();\n this._northDirection = this.getNorthDirection();\n\n updateMapDisplay(this.viewport, false);\n this.onChanged.raiseEvent(this.iModel, ProjectLocationChanged.ResetGeolocation);\n return true;\n }\n\n public updateEcefLocation(origin: Cartographic, point?: Point3d, angle?: Angle): boolean {\n if (!this._allowEcefLocationChange)\n return false;\n\n const newEcefLocation = EcefLocation.createFromCartographicOrigin(origin, point, (undefined !== angle ? angle : this.getNorthAngle())); // Preserve modified north direction...\n const ecefLocation = this.iModel.ecefLocation;\n if (undefined !== ecefLocation && ecefLocation.isAlmostEqual(newEcefLocation))\n return false;\n\n this.iModel.disableGCS(true); // Map display will ignore change to ecef location when GCS is present...\n this.iModel.setEcefLocation(newEcefLocation);\n\n this._monumentPoint = this.getMonumentPoint();\n this._northDirection = this.getNorthDirection(undefined !== this._northDirection ? this._northDirection.origin : undefined); // Preserve modified north reference point...\n\n updateMapDisplay(this.viewport, true);\n this.onChanged.raiseEvent(this.iModel, ProjectLocationChanged.Geolocation);\n return true;\n }\n\n public updateNorthDirection(northDir: Ray3d): boolean {\n if (!this._allowEcefLocationChange || !this.iModel.isGeoLocated)\n return false;\n\n const point = (undefined !== this._monumentPoint ? this._monumentPoint : this.getMonumentPoint()); // Preserve modified monument point...\n const origin = this.iModel.spatialToCartographicFromEcef(point);\n\n const saveDirection = this._northDirection;\n this._northDirection = northDir; // Change reference point to input location...\n const angle = this.getNorthAngle();\n\n if (!this.updateEcefLocation(origin, point, angle)) {\n this._northDirection = saveDirection;\n return false;\n }\n\n return true;\n }\n\n public getModifiedEcefLocation(): EcefLocation | undefined {\n const ecefLocation = this.iModel.ecefLocation;\n if (undefined === ecefLocation)\n return undefined; // geolocation wasn't added...\n\n if (undefined === this._ecefLocation)\n return ecefLocation; // geolocation didn't exist previously...\n\n if (this._ecefLocation.isAlmostEqual(ecefLocation))\n return undefined;\n\n return ecefLocation;\n }\n\n public getModifiedExtents(): Range3d | undefined {\n if (undefined === this._clipRange)\n return undefined;\n\n return this._clipRange.isAlmostEqual(this.iModel.projectExtents) ? undefined : this._clipRange;\n }\n\n public static allowEcefLocationChange(requireExisting: boolean, outputError: boolean = true): boolean {\n if (undefined === ProjectExtentsClipDecoration._decorator) {\n if (outputError)\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, translateMessage(\"NotActive\")));\n return false;\n } else if (!ProjectExtentsClipDecoration._decorator._allowEcefLocationChange) {\n if (outputError)\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, translateMessage(\"NotAllowed\")));\n return false;\n } else if (requireExisting && !ProjectExtentsClipDecoration._decorator.iModel.isGeoLocated) {\n if (outputError)\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, translateMessage(\"NotGeolocated\")));\n return false;\n }\n return true;\n }\n\n public fitExtents(): void {\n if (undefined === this._clipRange)\n return undefined;\n\n const options = { animateFrustumChange: true, animationTime: BeDuration.fromSeconds(2).milliseconds };\n const aspect = this.viewport.viewRect.aspect;\n this.viewport.view.lookAtVolume(this._clipRange, aspect);\n this.viewport.synchWithView(options);\n this.viewport.viewCmdTargetCenter = undefined;\n }\n\n public static get(): ProjectExtentsClipDecoration | undefined {\n if (undefined === ProjectExtentsClipDecoration._decorator)\n return undefined;\n return ProjectExtentsClipDecoration._decorator;\n }\n\n public static show(vp: ScreenViewport, fitExtents: boolean = true): boolean {\n if (!vp.view.isSpatialView())\n return false;\n\n if (undefined !== ProjectExtentsClipDecoration._decorator) {\n const deco = ProjectExtentsClipDecoration._decorator;\n if (vp === deco.viewport && undefined !== deco._clipId && undefined !== deco._clip) {\n if (deco._clip !== vp.view.getViewClip()) {\n clearViewClip(vp);\n ViewClipTool.enableClipVolume(vp);\n ViewClipTool.setViewClip(vp, deco._clip);\n }\n if (undefined === deco._removeManipulatorToolListener) {\n deco._removeManipulatorToolListener = IModelApp.toolAdmin.manipulatorToolEvent.addListener((tool, event) => deco.onManipulatorToolEvent(tool, event));\n deco.start();\n deco.onChanged.raiseEvent(deco.iModel, ProjectLocationChanged.Show);\n }\n return true;\n }\n ProjectExtentsClipDecoration.clear();\n }\n\n if (!clipToProjectExtents(vp))\n return false;\n\n ProjectExtentsClipDecoration._decorator = new ProjectExtentsClipDecoration(vp);\n if (fitExtents)\n ProjectExtentsClipDecoration._decorator.fitExtents();\n vp.onChangeView.addOnce(() => this.clear(false, true));\n return (undefined !== ProjectExtentsClipDecoration._decorator._clipId);\n }\n\n public static hide(): void {\n if (undefined === ProjectExtentsClipDecoration._decorator)\n return;\n const saveClipId = ProjectExtentsClipDecoration._decorator._clipId; // cleared by stop to trigger decorator removal...\n ProjectExtentsClipDecoration._decorator.stop();\n ProjectExtentsClipDecoration._decorator._clipId = saveClipId;\n ProjectExtentsClipDecoration._decorator.onChanged.raiseEvent(ProjectExtentsClipDecoration._decorator.iModel, ProjectLocationChanged.Hide);\n }\n\n public static clear(clearClip: boolean = true, resetGeolocation: boolean = true): void {\n if (undefined === ProjectExtentsClipDecoration._decorator)\n return;\n if (clearClip)\n ProjectExtentsClipDecoration._decorator.resetViewClip(); // Clear project extents view clip...\n if (resetGeolocation)\n ProjectExtentsClipDecoration._decorator.resetGeolocation(); // Restore modified geolocation back to create state...\n ProjectExtentsClipDecoration._decorator.stop();\n ProjectExtentsClipDecoration._decorator = undefined;\n }\n\n public static async update(): Promise<void> {\n const deco = ProjectExtentsClipDecoration._decorator;\n if (undefined === deco)\n return;\n\n clipToProjectExtents(deco.viewport);\n deco.init();\n\n return deco.updateControls();\n }\n}\n\n/** Show project location decoration. Project extents represented by view clip.\n * @beta\n */\nexport class ProjectLocationShowTool extends Tool {\n public static override toolId = \"ProjectLocation.Show\";\n\n public override async run(): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined === vp || !ProjectExtentsClipDecoration.show(vp))\n return false;\n await IModelApp.toolAdmin.startDefaultTool();\n return true;\n }\n}\n\n/** Hide project location decoration. Preserves changes to project extents view clip and geolocation.\n * @beta\n */\nexport class ProjectLocationHideTool extends Tool {\n public static override toolId = \"ProjectLocation.Hide\";\n\n public override async run(): Promise<boolean> {\n ProjectExtentsClipDecoration.hide();\n await IModelApp.toolAdmin.startDefaultTool();\n return true;\n }\n}\n\n/** Clear project location decoration. Restore modified geolocation and remove view clip.\n * @beta\n */\nexport class ProjectLocationCancelTool extends Tool {\n public static override toolId = \"ProjectLocation.Cancel\";\n\n public override async run(): Promise<boolean> {\n ProjectExtentsClipDecoration.clear();\n await IModelApp.toolAdmin.startDefaultTool();\n return true;\n }\n}\n\n/** Save modified project extents and geolocation. Updates decoration to reflect saved state.\n * @note Allowing this change to be undone is both problematic and undesirable.\n * Warns the user if called with previous changes to cancel restarting the TxnManager session.\n * @beta\n */\nexport class ProjectLocationSaveTool extends Tool {\n public static override toolId = \"ProjectLocation.Save\";\n\n protected async allowRestartTxnSession(iModel: BriefcaseConnection): Promise<boolean> {\n if (!await iModel.txns.isUndoPossible())\n return true;\n\n // NOTE: Default if openMessageBox isn't implemented is MessageBoxValue.Ok, so we'll check No instead of Yes...\n if (MessageBoxValue.No === await IModelApp.notifications.openMessageBox(MessageBoxType.YesNo, translateMessage(\"RestartTxn\"), MessageBoxIconType.Question))\n return false;\n\n return true;\n }\n\n protected async saveChanges(deco: ProjectExtentsClipDecoration, extents?: Range3dProps, ecefLocation?: EcefLocationProps): Promise<void> {\n if (!deco.iModel.isBriefcaseConnection())\n return;\n\n if (!await this.allowRestartTxnSession(deco.iModel))\n return;\n\n try {\n await EditTools.startCommand<string>({ commandId: editorBuiltInCmdIds.cmdBasicManipulation, iModelKey: deco.iModel.key });\n\n if (undefined !== extents)\n await basicManipulationIpc.updateProjectExtents(extents);\n\n if (undefined !== ecefLocation)\n await basicManipulationIpc.updateEcefLocation(ecefLocation);\n\n await deco.iModel.saveChanges(this.toolId);\n await deco.iModel.txns.restartTxnSession();\n } catch (err) {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, BentleyError.getErrorMessage(err) || \"An unknown error occurred.\"));\n }\n\n deco.onChanged.raiseEvent(deco.iModel, ProjectLocationChanged.Save);\n await ProjectExtentsClipDecoration.update();\n return IModelApp.toolAdmin.startDefaultTool();\n }\n\n public override async run(): Promise<boolean> {\n const deco = ProjectExtentsClipDecoration.get();\n if (undefined === deco) {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, translateMessage(\"NotActive\")));\n return false;\n }\n\n if (deco.iModel.isReadonly) {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, translateMessage(\"Readonly\")));\n return true;\n }\n\n const extents = deco.getModifiedExtents();\n const ecefLocation = deco.getModifiedEcefLocation();\n\n if (undefined === extents && undefined === ecefLocation) {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, translateMessage(\"NoChanges\")));\n return true;\n }\n\n await this.saveChanges(deco, extents, ecefLocation);\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"ProjectExtentsDecoration.js","sourceRoot":"","sources":["../../../src/ProjectLocation/ProjectExtentsDecoration.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAgB,QAAQ,EAAE,YAAY,EAAqB,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EACL,QAAQ,EAAsC,SAAS,EAAmB,eAAe,EAAE,YAAY,EAAE,WAAW,EAAa,SAAS,EACxH,kBAAkB,EAAE,cAAc,EAAE,eAAe,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,YAAY,EAChI,IAAI,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,YAAY,GAC9F,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAyB,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAgB,KAAK,EACzI,SAAS,EAAE,QAAQ,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE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xD,SAAS,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,oBAAoB,CAAC,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YAC3H,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;;AA9DsB,8BAAM,GAAG,sBAAsB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { BeDuration, BeEvent, BentleyError } from \"@itwin/core-bentley\";\nimport { Cartographic, ColorDef, EcefLocation, EcefLocationProps } from \"@itwin/core-common\";\nimport {\n BeButton, BeButtonEvent, BriefcaseConnection, CoreTools, DecorateContext, EditManipulator, EventHandled, GraphicType, HitDetail, IModelApp,\n IModelConnection, MessageBoxIconType, MessageBoxType, MessageBoxValue, NotifyMessageDetails, OutputMessagePriority, QuantityType, ScreenViewport,\n Tool, ViewClipControlArrow, ViewClipDecorationProvider, ViewClipShapeModifyTool, ViewClipTool, Viewport,\n} from \"@itwin/core-frontend\";\nimport {\n Angle, Arc3d, AxisIndex, AxisOrder, ClipShape, ClipVector, Constant, Matrix3d, Point3d, PolygonOps, Range1d, Range3d, Range3dProps, Ray3d,\n Transform, Vector3d,\n} from \"@itwin/core-geometry\";\nimport { editorBuiltInCmdIds } from \"@itwin/editor-common\";\nimport { EditTools } from \"../EditTool\";\nimport { basicManipulationIpc } from \"../EditToolIpc\";\nimport { ProjectGeolocationNorthTool, ProjectGeolocationPointTool } from \"./ProjectGeolocation\";\n\nfunction translateMessage(key: string) {\n return EditTools.translate(`ProjectLocation:Message.${key}`);\n}\nfunction translateMessageBold(key: string) {\n return `<b>${translateMessage(key)}:</b> `;\n}\nfunction translateCoreMeasureBold(key: string) {\n return `<b>${CoreTools.translate(`Measure.Labels.${key}`)}:</b> `;\n}\n\nfunction clearViewClip(vp: ScreenViewport): boolean {\n if (!ViewClipTool.doClipClear(vp))\n return false;\n ViewClipDecorationProvider.create().onClearClip(vp); // Send clear event...\n ViewClipDecorationProvider.clear();\n return true;\n}\n\nfunction clipToProjectExtents(vp: ScreenViewport): boolean {\n clearViewClip(vp); // Clear any existing view clip and send clear event...\n ViewClipTool.enableClipVolume(vp);\n return ViewClipTool.doClipToRange(vp, vp.iModel.projectExtents, Transform.createIdentity());\n}\n\nfunction enableBackgroundMap(viewport: Viewport, onOff: boolean): boolean {\n if (onOff === viewport.viewFlags.backgroundMap)\n return false;\n\n viewport.viewFlags = viewport.viewFlags.with(\"backgroundMap\", onOff);\n return true;\n}\n\nfunction updateMapDisplay(vp: ScreenViewport, turnOnMap: boolean): void {\n if (!turnOnMap || !enableBackgroundMap(vp, true))\n vp.invalidateRenderPlan();\n}\n\nclass ProjectExtentsControlArrow extends ViewClipControlArrow {\n public extentValid = true;\n}\n\n/** Values for [[ProjectExtentsClipDecoration.onChanged] event.\n * @beta\n */\nexport enum ProjectLocationChanged {\n /** Extents has been modified (unsaved changes) */\n Extents,\n /** Geolocation has been modified (unsaved changes) */\n Geolocation,\n /** Abandon unsaved changes to extents */\n ResetExtents,\n /** Abandon unsaved changes to geolocation */\n ResetGeolocation,\n /** Decoration hidden (unsaved changes preserved) */\n Hide,\n /** Decoration shown (unsaved changes restored) */\n Show,\n /** Save changes to extents and geolocation */\n Save,\n}\n\n/** Controls to modify project extents shown using view clip\n * @beta\n */\nexport class ProjectExtentsClipDecoration extends EditManipulator.HandleProvider {\n private static _decorator?: ProjectExtentsClipDecoration;\n protected _clip?: ClipVector;\n protected _clipId?: string;\n protected _clipShape?: ClipShape;\n protected _clipShapeExtents?: Range1d;\n protected _clipRange?: Range3d;\n protected _extentsLengthValid = true;\n protected _extentsWidthValid = true;\n protected _extentsHeightValid = true;\n protected _ecefLocation?: EcefLocation;\n protected _allowEcefLocationChange = false;\n protected _controlIds: string[] = [];\n protected _controls: ProjectExtentsControlArrow[] = [];\n protected _monumentPoint?: Point3d;\n protected _northDirection?: Ray3d;\n protected _monumentId?: string;\n protected _northId?: string;\n protected _suspendDecorator = false;\n protected _removeViewCloseListener?: () => void;\n public suspendGeolocationDecorations = false;\n\n /** Called when project extents or geolocation is modified */\n public readonly onChanged = new BeEvent<(iModel: IModelConnection, ev: ProjectLocationChanged) => void>();\n\n public constructor(public viewport: ScreenViewport) {\n super(viewport.iModel);\n\n if (!this.init())\n return;\n\n this._monumentId = this.iModel.transientIds.getNext();\n this._northId = this.iModel.transientIds.getNext();\n this._clipId = this.iModel.transientIds.getNext();\n\n this.start();\n }\n\n protected start(): void {\n this.updateDecorationListener(true);\n this._removeViewCloseListener = IModelApp.viewManager.onViewClose.addListener((vp) => this.onViewClose(vp));\n this.iModel.selectionSet.replace(this._clipId!); // Always select decoration on create...\n }\n\n protected override stop(): void {\n const selectedId = (undefined !== this._clipId && this.iModel.selectionSet.has(this._clipId)) ? this._clipId : undefined;\n this._clipId = undefined; // Invalidate id so that decorator will be dropped...\n super.stop();\n if (undefined !== selectedId)\n this.iModel.selectionSet.remove(selectedId); // Don't leave decorator id in selection set...\n if (undefined !== this._removeViewCloseListener) {\n this._removeViewCloseListener();\n this._removeViewCloseListener = undefined;\n }\n }\n\n protected init(): boolean {\n if (!this.getClipData())\n return false;\n\n this._ecefLocation = this.iModel.ecefLocation;\n this._monumentPoint = this.getMonumentPoint();\n this._northDirection = this.getNorthDirection();\n\n return true;\n }\n\n public onViewClose(vp: ScreenViewport): void {\n if (this.viewport === vp)\n ProjectExtentsClipDecoration.clear();\n }\n\n private getClipData(): boolean {\n this._clip = this._clipShape = this._clipShapeExtents = this._clipRange = undefined;\n const clip = this.viewport.view.getViewClip();\n if (undefined === clip)\n return false;\n\n const clipShape = ViewClipTool.isSingleClipShape(clip);\n if (undefined === clipShape)\n return false;\n\n if (5 !== clipShape.polygon.length || undefined === clipShape.zLow || undefined === clipShape.zHigh)\n return false; // Not a box, can't be project extents clip...\n\n if (undefined !== clipShape.transformFromClip && !clipShape.transformFromClip.isIdentity)\n return false; // Not axis aligned, can't be project extents clip...\n\n this._clipShapeExtents = Range1d.createXX(clipShape.zLow, clipShape.zHigh);\n this._clipShape = clipShape;\n this._clip = clip;\n\n this._clipRange = Range3d.create();\n const shapePtsLo = ViewClipTool.getClipShapePoints(this._clipShape, this._clipShapeExtents.low);\n const shapePtsHi = ViewClipTool.getClipShapePoints(this._clipShape, this._clipShapeExtents.high);\n\n this._clipRange.extendArray(shapePtsLo);\n this._clipRange.extendArray(shapePtsHi);\n\n return true;\n }\n\n private ensureNumControls(numReqControls: number): void {\n const numCurrent = this._controlIds.length;\n if (numCurrent < numReqControls) {\n const transientIds = this.iModel.transientIds;\n for (let i: number = numCurrent; i < numReqControls; i++)\n this._controlIds[i] = transientIds.getNext();\n } else if (numCurrent > numReqControls) {\n this._controlIds.length = numReqControls;\n }\n }\n\n private createClipShapeControls(): boolean {\n if (undefined === this._clipShape)\n return false;\n\n const shapePtsLo = ViewClipTool.getClipShapePoints(this._clipShape, this._clipShapeExtents!.low);\n const shapePtsHi = ViewClipTool.getClipShapePoints(this._clipShape, this._clipShapeExtents!.high);\n const shapeArea = PolygonOps.centroidAreaNormal(shapePtsLo);\n if (undefined === shapeArea)\n return false;\n\n const numControls = shapePtsLo.length + 1; // Number of edge midpoints plus zLow and zHigh...\n this.ensureNumControls(numControls);\n\n for (let i: number = 0; i < numControls - 2; i++) {\n const midPtLo = shapePtsLo[i].interpolate(0.5, shapePtsLo[i + 1]);\n const midPtHi = shapePtsHi[i].interpolate(0.5, shapePtsHi[i + 1]);\n const faceCenter = midPtLo.interpolate(0.5, midPtHi);\n const edgeTangent = Vector3d.createStartEnd(shapePtsLo[i], shapePtsLo[i + 1]);\n const faceNormal = edgeTangent.crossProduct(shapeArea.direction);\n faceNormal.normalizeInPlace();\n this._controls[i] = new ProjectExtentsControlArrow(faceCenter, faceNormal, 0.75);\n this._controls[i].extentValid = (faceNormal.isParallelTo(Vector3d.unitX(), true) ? this._extentsLengthValid : this._extentsWidthValid);\n }\n\n const zFillColor = ColorDef.from(150, 150, 250);\n this._controls[numControls - 2] = new ProjectExtentsControlArrow(shapeArea.origin, Vector3d.unitZ(-1.0), 0.75, zFillColor, undefined, \"zLow\");\n this._controls[numControls - 1] = new ProjectExtentsControlArrow(shapeArea.origin.plusScaled(Vector3d.unitZ(), shapePtsLo[0].distance(shapePtsHi[0])), Vector3d.unitZ(), 0.75, zFillColor, undefined, \"zHigh\");\n this._controls[numControls - 2].extentValid = this._extentsHeightValid;\n this._controls[numControls - 1].extentValid = this._extentsHeightValid;\n\n return true;\n }\n\n /** Allow project extents for map projections to be larger since curvature of the earth is accounted for. */\n protected get maxExtentLength(): number { return ((this._allowEcefLocationChange ? 20 : 350) * Constant.oneKilometer); }\n\n /** Impose some reasonable height limit for project extents. */\n protected get maxExtentHeight(): number { return (2 * Constant.oneKilometer); }\n\n protected hasValidGCS(): boolean {\n if (!this.iModel.isGeoLocated || this.iModel.noGcsDefined)\n return false;\n\n const gcs = this.iModel.geographicCoordinateSystem;\n if (undefined === gcs || undefined === gcs.horizontalCRS)\n return false; // A valid GCS ought to have horizontalCR defined...\n\n // Check for approximate GCS (such as from MicroStation's \"From Placemark\" tool) and allow it to be replaced...\n const hasValidId = (undefined !== gcs.horizontalCRS.id && 0 !== gcs.horizontalCRS.id.length);\n const hasValidDescr = (undefined !== gcs.horizontalCRS.description && 0 !== gcs.horizontalCRS.description.length);\n const hasValidProjection = (undefined !== gcs.horizontalCRS.projection && \"AzimuthalEqualArea\" !== gcs.horizontalCRS.projection.method);\n\n return hasValidId || hasValidDescr || hasValidProjection;\n }\n\n protected async createControls(): Promise<boolean> {\n // Always update to current view clip to handle post-modify, etc.\n if (undefined === this._clipId || !this.getClipData())\n return false;\n\n this._allowEcefLocationChange = !this.hasValidGCS();\n\n if (undefined !== this._clipRange) {\n this._extentsLengthValid = (this._clipRange.xLength() < this.maxExtentLength);\n this._extentsWidthValid = (this._clipRange.yLength() < this.maxExtentLength);\n this._extentsHeightValid = (this._clipRange.zLength() < this.maxExtentHeight);\n }\n\n // Show controls if only range box and it's controls are selected, selection set doesn't include any other elements...\n let showControls = false;\n if (this.iModel.selectionSet.size <= this._controlIds.length + 1 && this.iModel.selectionSet.has(this._clipId)) {\n showControls = true;\n if (this.iModel.selectionSet.size > 1) {\n this.iModel.selectionSet.elements.forEach((val) => {\n if (this._clipId !== val && !this._controlIds.includes(val))\n showControls = false;\n });\n }\n }\n\n if (!showControls)\n return false; // Don't clear decoration on de-select...\n\n return this.createClipShapeControls();\n }\n\n protected override clearControls(): void {\n this.iModel.selectionSet.remove(this._controlIds); // Remove any selected controls as they won't continue to be displayed...\n super.clearControls();\n }\n\n protected async modifyControls(hit: HitDetail, _ev: BeButtonEvent): Promise<boolean> {\n if (undefined === this._clip || hit.sourceId === this._clipId)\n return false;\n\n const saveQualifiers = IModelApp.toolAdmin.currentInputState.qualifiers;\n if (undefined !== this._clipShape) {\n const clipShapeModifyTool = new ViewClipShapeModifyTool(this, this._clip, this.viewport, hit.sourceId, this._controlIds, this._controls);\n this._suspendDecorator = await clipShapeModifyTool.run();\n }\n\n if (this._suspendDecorator)\n IModelApp.toolAdmin.currentInputState.qualifiers = saveQualifiers; // onInstallTool cleared qualifiers, preserve for \"modify all\" behavior when shift was held and drag started...\n\n return this._suspendDecorator;\n }\n\n protected override async onRightClick(_hit: HitDetail, _ev: BeButtonEvent): Promise<EventHandled> { return EventHandled.No; }\n\n protected override async onTouchTap(hit: HitDetail, ev: BeButtonEvent): Promise<EventHandled> { return (hit.sourceId === this._clipId ? EventHandled.No : super.onTouchTap(hit, ev)); }\n\n public override async onDecorationButtonEvent(hit: HitDetail, ev: BeButtonEvent): Promise<EventHandled> {\n if (hit.sourceId === this._monumentId) {\n if (BeButton.Data === ev.button && !ev.isDown && !ev.isDragging)\n await ProjectGeolocationPointTool.startTool();\n return EventHandled.Yes; // Only pickable for tooltip, don't allow selection...\n }\n\n if (hit.sourceId === this._northId) {\n if (BeButton.Data === ev.button && !ev.isDown && !ev.isDragging)\n await ProjectGeolocationNorthTool.startTool();\n return EventHandled.Yes; // Only pickable for tooltip, don't allow selection...\n }\n\n return super.onDecorationButtonEvent(hit, ev);\n }\n\n public override onManipulatorEvent(eventType: EditManipulator.EventType): void {\n if (EditManipulator.EventType.Accept === eventType)\n this.onChanged.raiseEvent(this.iModel, ProjectLocationChanged.Extents);\n this._suspendDecorator = false;\n super.onManipulatorEvent(eventType);\n }\n\n public async getDecorationToolTip(hit: HitDetail): Promise<HTMLElement | string> {\n const quantityFormatter = IModelApp.quantityFormatter;\n const toolTip = document.createElement(\"div\");\n let toolTipHtml = \"\";\n\n if (hit.sourceId === this._monumentId) {\n toolTipHtml += `${translateMessage(\"ModifyGeolocation\")}<br>`;\n\n const coordFormatterSpec = quantityFormatter.findFormatterSpecByQuantityType(QuantityType.Coordinate);\n if (undefined !== coordFormatterSpec) {\n const pointAdjusted = this._monumentPoint!.minus(this.iModel.globalOrigin);\n const formattedPointX = quantityFormatter.formatQuantity(pointAdjusted.x, coordFormatterSpec);\n const formattedPointY = quantityFormatter.formatQuantity(pointAdjusted.y, coordFormatterSpec);\n const formattedPointZ = quantityFormatter.formatQuantity(pointAdjusted.z, coordFormatterSpec);\n toolTipHtml += `${translateCoreMeasureBold(\"Coordinate\") + formattedPointX}, ${formattedPointY}, ${formattedPointZ}<br>`;\n }\n\n const latLongFormatterSpec = quantityFormatter.findFormatterSpecByQuantityType(QuantityType.LatLong);\n if (undefined !== latLongFormatterSpec && undefined !== coordFormatterSpec && this.iModel.isGeoLocated) {\n const cartographic = this.iModel.spatialToCartographicFromEcef(this._monumentPoint!);\n const formattedLat = quantityFormatter.formatQuantity(Math.abs(cartographic.latitude), latLongFormatterSpec);\n const formattedLong = quantityFormatter.formatQuantity(Math.abs(cartographic.longitude), latLongFormatterSpec);\n const formattedHeight = quantityFormatter.formatQuantity(cartographic.height, coordFormatterSpec);\n const latDir = CoreTools.translate(cartographic.latitude < 0 ? \"Measure.Labels.S\" : \"Measure.Labels.N\");\n const longDir = CoreTools.translate(cartographic.longitude < 0 ? \"Measure.Labels.W\" : \"Measure.Labels.E\");\n toolTipHtml += `${translateCoreMeasureBold(\"LatLong\") + formattedLat + latDir}, ${formattedLong}${longDir}<br>`;\n toolTipHtml += `${translateCoreMeasureBold(\"Altitude\") + formattedHeight}<br>`;\n }\n\n } else if (hit.sourceId === this._northId) {\n toolTipHtml += `${translateMessage(\"ModifyNorthDirection\")}<br>`;\n\n const angleFormatterSpec = quantityFormatter.findFormatterSpecByQuantityType(QuantityType.Angle);\n if (undefined !== angleFormatterSpec) {\n const formattedAngle = quantityFormatter.formatQuantity(this.getClockwiseAngleToNorth().radians, angleFormatterSpec);\n toolTipHtml += `${translateMessageBold(\"Angle\") + formattedAngle}<br>`;\n }\n\n } else if (hit.sourceId === this._clipId) {\n const extentsValid = (this._extentsLengthValid && this._extentsWidthValid && this._extentsHeightValid);\n toolTipHtml += `${translateMessage(extentsValid ? \"ProjectExtents\" : \"LargeProjectExtents\")}<br>`;\n\n const distanceFormatterSpec = quantityFormatter.findFormatterSpecByQuantityType(QuantityType.Length);\n if (undefined !== distanceFormatterSpec && undefined !== this._clipRange) {\n const formattedLength = quantityFormatter.formatQuantity(this._clipRange.xLength(), distanceFormatterSpec);\n const formattedWidth = quantityFormatter.formatQuantity(this._clipRange.yLength(), distanceFormatterSpec);\n const formattedHeight = quantityFormatter.formatQuantity(this._clipRange.zLength(), distanceFormatterSpec);\n toolTipHtml += `${translateMessageBold(\"Length\") + formattedLength}<br>`;\n toolTipHtml += `${translateMessageBold(\"Width\") + formattedWidth}<br>`;\n toolTipHtml += `${translateMessageBold(\"Height\") + formattedHeight}<br>`;\n }\n\n } else {\n const arrowIndex = this._controlIds.indexOf(hit.sourceId);\n if (-1 !== arrowIndex) {\n toolTipHtml += `${translateMessage(\"ModifyProjectExtents\")}<br>`;\n\n const distanceFormatterSpec = quantityFormatter.findFormatterSpecByQuantityType(QuantityType.Length);\n if (undefined !== distanceFormatterSpec && undefined !== this._clipRange) {\n const arrowControl = this._controls[arrowIndex];\n\n let arrowLabel = \"\";\n let arrowLength = 0.0;\n let arrowLengthMax = 0.0;\n\n if (arrowControl.direction.isParallelTo(Vector3d.unitX(), true)) {\n arrowLabel = \"Length\";\n arrowLength = this._clipRange.xLength();\n if (!this._extentsLengthValid)\n arrowLengthMax = this.maxExtentLength;\n } else if (arrowControl.direction.isParallelTo(Vector3d.unitY(), true)) {\n arrowLabel = \"Width\";\n arrowLength = this._clipRange.yLength();\n if (!this._extentsWidthValid)\n arrowLengthMax = this.maxExtentLength;\n } else {\n arrowLabel = \"Height\";\n arrowLength = this._clipRange.zLength();\n if (!this._extentsHeightValid)\n arrowLengthMax = this.maxExtentHeight;\n\n const coordFormatterSpec = (this.iModel.isGeoLocated ? quantityFormatter.findFormatterSpecByQuantityType(QuantityType.Coordinate) : undefined);\n if (undefined !== coordFormatterSpec) {\n const heightPt = (\"zLow\" === arrowControl.name ? this._clipRange.low : this._clipRange.high);\n const cartographic = this.iModel.spatialToCartographicFromEcef(heightPt);\n const formattedAltitude = quantityFormatter.formatQuantity(cartographic.height, coordFormatterSpec);\n toolTipHtml += `${translateCoreMeasureBold(\"Altitude\") + formattedAltitude}<br>`;\n }\n }\n\n const formattedLength = quantityFormatter.formatQuantity(arrowLength, distanceFormatterSpec);\n toolTipHtml += `${translateMessageBold(arrowLabel) + formattedLength}<br>`;\n\n if (0.0 !== arrowLengthMax) {\n const formattedMaxLength = quantityFormatter.formatQuantity(arrowLengthMax, distanceFormatterSpec);\n toolTipHtml += `${translateMessageBold(\"MaxExtent\") + formattedMaxLength}<br>`;\n }\n }\n }\n }\n\n toolTip.innerHTML = toolTipHtml;\n return toolTip;\n }\n\n public testDecorationHit(id: string): boolean { return (id === this._monumentId || id === this._northId || id === this._clipId || this._controlIds.includes(id)); }\n protected override updateDecorationListener(_add: boolean): void { super.updateDecorationListener(undefined !== this._clipId); } // Decorator isn't just for resize controls...\n\n public getMonumentPoint(): Point3d {\n const origin = Point3d.createZero();\n if (this.iModel.ecefLocation && this.iModel.ecefLocation.cartographicOrigin)\n return this.iModel.cartographicToSpatialFromEcef(this.iModel.ecefLocation.cartographicOrigin, origin);\n origin.setFrom(this.iModel.projectExtents.low);\n if (0.0 > this.iModel.projectExtents.low.z && 0.0 < this.iModel.projectExtents.high.z)\n origin.z = 0.0;\n return origin;\n }\n\n public getClockwiseAngleToNorth(): Angle {\n const angle = this.getNorthAngle();\n angle.setRadians(Angle.adjustRadians0To2Pi(angle.radians));\n return angle;\n }\n\n public getNorthAngle(): Angle {\n const northDirection = (undefined !== this._northDirection ? this._northDirection : this.getNorthDirection());\n return northDirection.direction.angleToXY(Vector3d.unitY());\n }\n\n public getNorthDirection(refOrigin?: Point3d): Ray3d {\n const origin = (undefined !== refOrigin ? refOrigin : this.iModel.projectExtents.center);\n\n if (!this.iModel.isGeoLocated)\n return Ray3d.create(origin, Vector3d.unitY());\n\n const cartographic = this.iModel.spatialToCartographicFromEcef(origin);\n cartographic.latitude += Angle.createDegrees(0.01).radians;\n const pt2 = this.iModel.cartographicToSpatialFromEcef(cartographic);\n const northVec = Vector3d.createStartEnd(origin, pt2);\n northVec.z = 0.0;\n northVec.normalizeInPlace();\n\n return Ray3d.create(origin, northVec);\n }\n\n public drawNorthArrow(context: DecorateContext, northDir: Ray3d, id?: string): void {\n const vp = context.viewport;\n const pixelSize = vp.pixelsFromInches(0.55);\n const scale = vp.viewingSpace.getPixelSizeAtPoint(northDir.origin) * pixelSize;\n const matrix = Matrix3d.createRigidFromColumns(northDir.direction, Vector3d.unitZ(), AxisOrder.YZX);\n\n if (undefined === matrix)\n return;\n\n matrix.scaleColumnsInPlace(scale, scale, scale);\n const arrowTrans = Transform.createRefs(northDir.origin, matrix);\n\n const northArrowBuilder = context.createGraphicBuilder(GraphicType.WorldOverlay, arrowTrans, id);\n const color = ColorDef.white;\n\n const arrowOutline: Point3d[] = [];\n arrowOutline[0] = Point3d.create(0.0, 0.65);\n arrowOutline[1] = Point3d.create(-0.45, -0.5);\n arrowOutline[2] = Point3d.create(0.0, -0.2);\n arrowOutline[3] = Point3d.create(0.45, -0.5);\n arrowOutline[4] = arrowOutline[0].clone();\n\n const arrowLeftFill: Point3d[] = [];\n arrowLeftFill[0] = arrowOutline[0].clone();\n arrowLeftFill[1] = arrowOutline[1].clone();\n arrowLeftFill[2] = arrowOutline[2].clone();\n arrowLeftFill[3] = arrowLeftFill[0].clone();\n\n const arrowRightFill: Point3d[] = [];\n arrowRightFill[0] = arrowOutline[0].clone();\n arrowRightFill[1] = arrowOutline[3].clone();\n arrowRightFill[2] = arrowOutline[2].clone();\n arrowRightFill[3] = arrowRightFill[0].clone();\n\n northArrowBuilder.setSymbology(color, ColorDef.from(0, 0, 0, 200), 1);\n northArrowBuilder.addArc(Arc3d.createXY(Point3d.createZero(), 0.6), true, true);\n northArrowBuilder.addArc(Arc3d.createXY(Point3d.create(0.0, 0.85), 0.2), true, true);\n\n northArrowBuilder.setSymbology(color, color, 2);\n northArrowBuilder.addArc(Arc3d.createXY(Point3d.createZero(), 0.5), false, false);\n northArrowBuilder.addLineString([Point3d.create(0.6, 0.0), Point3d.create(-0.6, 0.0)]);\n northArrowBuilder.addLineString([Point3d.create(0.0, 0.6), Point3d.create(0.0, -0.6)]);\n\n northArrowBuilder.setSymbology(color, ColorDef.from(150, 150, 150), 1);\n northArrowBuilder.addShape(arrowLeftFill);\n\n northArrowBuilder.setSymbology(color, ColorDef.black, 1);\n northArrowBuilder.addShape(arrowRightFill);\n\n northArrowBuilder.setSymbology(color, color, 1);\n northArrowBuilder.addLineString(arrowOutline);\n northArrowBuilder.setSymbology(color, color, 3);\n northArrowBuilder.addLineString([Point3d.create(-0.1, 0.75), Point3d.create(-0.1, 0.95), Point3d.create(0.1, 0.75), Point3d.create(0.1, 0.95)]);\n\n context.addDecorationFromBuilder(northArrowBuilder);\n }\n\n public drawMonumentPoint(context: DecorateContext, point: Point3d, scaleFactor: number, id?: string): void {\n const vp = context.viewport;\n const pixelSize = vp.pixelsFromInches(0.25) * scaleFactor;\n const scale = vp.viewingSpace.getPixelSizeAtPoint(point) * pixelSize;\n const matrix = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, Angle.createDegrees(45.0));\n\n matrix.scaleColumnsInPlace(scale, scale, scale);\n const monumentTrans = Transform.createRefs(point, matrix);\n\n const monumentPointBuilder = context.createGraphicBuilder(GraphicType.WorldOverlay, monumentTrans, id);\n const color = ColorDef.white;\n\n monumentPointBuilder.setSymbology(color, ColorDef.from(0, 0, 0, 150), 1);\n monumentPointBuilder.addArc(Arc3d.createXY(Point3d.createZero(), 0.7), true, true);\n\n monumentPointBuilder.setSymbology(color, color, 2);\n monumentPointBuilder.addArc(Arc3d.createXY(Point3d.createZero(), 0.5), false, false);\n monumentPointBuilder.addLineString([Point3d.create(0.5, 0.0), Point3d.create(-0.5, 0.0)]);\n monumentPointBuilder.addLineString([Point3d.create(0.0, 0.5), Point3d.create(0.0, -0.5)]);\n\n context.addDecorationFromBuilder(monumentPointBuilder);\n }\n\n protected drawAreaTooLargeIndicator(context: DecorateContext): void {\n if ((this._extentsLengthValid && this._extentsWidthValid) || undefined === this._clipRange)\n return;\n\n const corners = this._clipRange.corners();\n const indices = Range3d.faceCornerIndices(5);\n const points: Point3d[] = [];\n\n for (const index of indices)\n points.push(corners[index]);\n\n const areaWarnColor = ColorDef.red.withAlpha(50);\n const areaWarnBuilder = context.createGraphicBuilder(GraphicType.WorldDecoration);\n\n areaWarnBuilder.setSymbology(areaWarnColor, areaWarnColor, 1);\n areaWarnBuilder.addShape(points);\n context.addDecorationFromBuilder(areaWarnBuilder);\n }\n\n protected drawExtentTooLargeIndicator(context: DecorateContext, worldPoint: Point3d, sizePixels: number): void {\n const position = context.viewport.worldToView(worldPoint);\n position.x = Math.floor(position.x) + 0.5;\n position.y = Math.floor(position.y) + 0.5;\n const drawDecoration = (ctx: CanvasRenderingContext2D) => {\n ctx.lineWidth = 4;\n ctx.lineCap = \"round\";\n ctx.strokeStyle = \"rgba(255,0,0,.75)\";\n ctx.fillStyle = \"rgba(255,255,255,.75)\";\n ctx.shadowColor = \"black\";\n ctx.shadowBlur = 5;\n\n ctx.beginPath();\n ctx.moveTo(0, -sizePixels);\n ctx.lineTo(-sizePixels, sizePixels);\n ctx.lineTo(sizePixels, sizePixels);\n ctx.lineTo(0, -sizePixels);\n ctx.fill();\n\n ctx.shadowBlur = 0;\n\n ctx.beginPath();\n ctx.moveTo(0, -sizePixels);\n ctx.lineTo(-sizePixels, sizePixels);\n ctx.lineTo(sizePixels, sizePixels);\n ctx.lineTo(0, -sizePixels);\n ctx.stroke();\n\n ctx.strokeStyle = \"black\";\n ctx.lineWidth = 3;\n\n ctx.beginPath();\n ctx.moveTo(0, -sizePixels * 0.2);\n ctx.lineTo(0, sizePixels * 0.3);\n ctx.moveTo(0, (sizePixels * 0.3) + 4);\n ctx.lineTo(0, (sizePixels * 0.3) + 4.5);\n ctx.stroke();\n\n };\n context.addCanvasDecoration({ position, drawDecoration });\n }\n\n public override decorate(context: DecorateContext): void {\n if (this._suspendDecorator)\n return;\n\n if (undefined === this._clipId || undefined === this._clipShape || undefined === this._clipRange)\n return;\n\n const vp = context.viewport;\n if (this.viewport !== vp)\n return;\n\n if (!this.suspendGeolocationDecorations && undefined !== this._northDirection && this.iModel.isGeoLocated)\n this.drawNorthArrow(context, this._northDirection, this._allowEcefLocationChange ? this._northId : undefined); // Show north, but don't make pickable if it shouldn't be modified...\n\n const maxSizeInches = ((this._clipRange.maxLength() / vp.viewingSpace.getPixelSizeAtPoint(this._clipRange.center)) / vp.pixelsPerInch) * 0.5; // Display size limit when zooming out...\n if (maxSizeInches < 0.5)\n return;\n\n if (!this.suspendGeolocationDecorations && undefined !== this._monumentPoint && this._allowEcefLocationChange)\n this.drawMonumentPoint(context, this._monumentPoint, 1.0, this._monumentId);\n\n ViewClipTool.drawClipShape(context, this._clipShape, this._clipShapeExtents!, ColorDef.white.adjustedForContrast(context.viewport.view.backgroundColor), 3, this._clipId);\n this.drawAreaTooLargeIndicator(context);\n\n if (!this._isActive)\n return;\n\n const outlineColor = ColorDef.from(0, 0, 0, 50).adjustedForContrast(vp.view.backgroundColor);\n const fillVisColor = ColorDef.from(150, 250, 200, 225).adjustedForContrast(vp.view.backgroundColor);\n const fillHidColor = fillVisColor.withAlpha(200);\n const fillSelColor = fillVisColor.inverse().withAlpha(75);\n const shapePts = EditManipulator.HandleUtils.getArrowShape(0.0, 0.15, 0.55, 1.0, 0.3, 0.5, 0.1);\n\n for (let iFace = 0; iFace < this._controlIds.length; iFace++) {\n const sizeInches = Math.min(this._controls[iFace].sizeInches, maxSizeInches);\n if (0.0 === sizeInches)\n continue;\n\n const anchorRay = ViewClipTool.getClipRayTransformed(this._controls[iFace].origin, this._controls[iFace].direction, undefined !== this._clipShape ? this._clipShape.transformFromClip : undefined);\n const transform = EditManipulator.HandleUtils.getArrowTransform(vp, anchorRay.origin, anchorRay.direction, sizeInches);\n if (undefined === transform)\n continue;\n\n // deep copies because we're using a builder transform w/addLineString...\n const visPts = shapePts.map((pt) => pt.clone());\n const hidPts = shapePts.map((pt) => pt.clone());\n\n const arrowVisBuilder = context.createGraphicBuilder(GraphicType.WorldOverlay, transform, this._controlIds[iFace]);\n const arrowHidBuilder = context.createGraphicBuilder(GraphicType.WorldDecoration, transform);\n const isSelected = this.iModel.selectionSet.has(this._controlIds[iFace]);\n\n let outlineColorOvr = this._controls[iFace].outline;\n if (undefined !== outlineColorOvr) {\n outlineColorOvr = outlineColorOvr.adjustedForContrast(vp.view.backgroundColor);\n outlineColorOvr = outlineColorOvr.withAlpha(outlineColor.getAlpha());\n } else {\n outlineColorOvr = outlineColor;\n }\n\n let fillVisColorOvr = this._controls[iFace].fill;\n let fillHidColorOvr = fillHidColor;\n let fillSelColorOvr = fillSelColor;\n if (undefined !== fillVisColorOvr) {\n fillVisColorOvr = fillVisColorOvr.adjustedForContrast(vp.view.backgroundColor);\n fillVisColorOvr = fillVisColorOvr.withAlpha(fillVisColor.getAlpha());\n fillHidColorOvr = fillVisColorOvr.withAlpha(fillHidColor.getAlpha());\n fillSelColorOvr = fillVisColorOvr.inverse().withAlpha(fillSelColor.getAlpha());\n } else {\n fillVisColorOvr = fillVisColor;\n }\n\n arrowVisBuilder.setSymbology(outlineColorOvr, outlineColorOvr, isSelected ? 4 : 2);\n arrowVisBuilder.addLineString(visPts);\n arrowVisBuilder.setBlankingFill(isSelected ? fillSelColorOvr : fillVisColorOvr);\n arrowVisBuilder.addShape(visPts);\n context.addDecorationFromBuilder(arrowVisBuilder);\n\n arrowHidBuilder.setSymbology(fillHidColorOvr, fillHidColorOvr, 1);\n arrowHidBuilder.addShape(hidPts);\n context.addDecorationFromBuilder(arrowHidBuilder);\n\n if (this._controls[iFace].extentValid)\n continue;\n\n const warnPixels = 15.0;\n const warnOffset = vp.viewingSpace.getPixelSizeAtPoint(anchorRay.origin) * warnPixels * 1.5;\n const warnOrigin = anchorRay.origin.plusScaled(anchorRay.direction, -warnOffset);\n this.drawExtentTooLargeIndicator(context, warnOrigin, warnPixels);\n }\n }\n\n public resetViewClip(): boolean {\n if (!clearViewClip(this.viewport))\n return false;\n\n if (undefined !== this.getModifiedExtents())\n this.onChanged.raiseEvent(this.iModel, ProjectLocationChanged.ResetExtents);\n\n return true;\n }\n\n public resetGeolocation(): boolean {\n if (!this._allowEcefLocationChange)\n return false;\n\n if (undefined === this.getModifiedEcefLocation())\n return false; // Wasn't changed...\n\n this.iModel.disableGCS(false);\n this.iModel.ecefLocation = this._ecefLocation;\n\n this._monumentPoint = this.getMonumentPoint();\n this._northDirection = this.getNorthDirection();\n\n updateMapDisplay(this.viewport, false);\n this.onChanged.raiseEvent(this.iModel, ProjectLocationChanged.ResetGeolocation);\n return true;\n }\n\n public updateEcefLocation(origin: Cartographic, point?: Point3d, angle?: Angle): boolean {\n if (!this._allowEcefLocationChange)\n return false;\n\n const newEcefLocation = EcefLocation.createFromCartographicOrigin(origin, point, (undefined !== angle ? angle : this.getNorthAngle())); // Preserve modified north direction...\n const ecefLocation = this.iModel.ecefLocation;\n if (undefined !== ecefLocation && ecefLocation.isAlmostEqual(newEcefLocation))\n return false;\n\n this.iModel.disableGCS(true); // Map display will ignore change to ecef location when GCS is present...\n this.iModel.setEcefLocation(newEcefLocation);\n\n this._monumentPoint = this.getMonumentPoint();\n this._northDirection = this.getNorthDirection(undefined !== this._northDirection ? this._northDirection.origin : undefined); // Preserve modified north reference point...\n\n updateMapDisplay(this.viewport, true);\n this.onChanged.raiseEvent(this.iModel, ProjectLocationChanged.Geolocation);\n return true;\n }\n\n public updateNorthDirection(northDir: Ray3d): boolean {\n if (!this._allowEcefLocationChange || !this.iModel.isGeoLocated)\n return false;\n\n const point = (undefined !== this._monumentPoint ? this._monumentPoint : this.getMonumentPoint()); // Preserve modified monument point...\n const origin = this.iModel.spatialToCartographicFromEcef(point);\n\n const saveDirection = this._northDirection;\n this._northDirection = northDir; // Change reference point to input location...\n const angle = this.getNorthAngle();\n\n if (!this.updateEcefLocation(origin, point, angle)) {\n this._northDirection = saveDirection;\n return false;\n }\n\n return true;\n }\n\n public getModifiedEcefLocation(): EcefLocation | undefined {\n const ecefLocation = this.iModel.ecefLocation;\n if (undefined === ecefLocation)\n return undefined; // geolocation wasn't added...\n\n if (undefined === this._ecefLocation)\n return ecefLocation; // geolocation didn't exist previously...\n\n if (this._ecefLocation.isAlmostEqual(ecefLocation))\n return undefined;\n\n return ecefLocation;\n }\n\n public getModifiedExtents(): Range3d | undefined {\n if (undefined === this._clipRange)\n return undefined;\n\n return this._clipRange.isAlmostEqual(this.iModel.projectExtents) ? undefined : this._clipRange;\n }\n\n public static allowEcefLocationChange(requireExisting: boolean, outputError: boolean = true): boolean {\n if (undefined === ProjectExtentsClipDecoration._decorator) {\n if (outputError)\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, translateMessage(\"NotActive\")));\n return false;\n } else if (!ProjectExtentsClipDecoration._decorator._allowEcefLocationChange) {\n if (outputError)\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, translateMessage(\"NotAllowed\")));\n return false;\n } else if (requireExisting && !ProjectExtentsClipDecoration._decorator.iModel.isGeoLocated) {\n if (outputError)\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, translateMessage(\"NotGeolocated\")));\n return false;\n }\n return true;\n }\n\n public fitExtents(): void {\n if (undefined === this._clipRange)\n return undefined;\n\n const options = { animateFrustumChange: true, animationTime: BeDuration.fromSeconds(2).milliseconds };\n const aspect = this.viewport.viewRect.aspect;\n this.viewport.view.lookAtVolume(this._clipRange, aspect);\n this.viewport.synchWithView(options);\n this.viewport.viewCmdTargetCenter = undefined;\n }\n\n public static get(): ProjectExtentsClipDecoration | undefined {\n if (undefined === ProjectExtentsClipDecoration._decorator)\n return undefined;\n return ProjectExtentsClipDecoration._decorator;\n }\n\n public static show(vp: ScreenViewport, fitExtents: boolean = true): boolean {\n if (!vp.view.isSpatialView())\n return false;\n\n if (undefined !== ProjectExtentsClipDecoration._decorator) {\n const deco = ProjectExtentsClipDecoration._decorator;\n if (vp === deco.viewport && undefined !== deco._clipId && undefined !== deco._clip) {\n if (deco._clip !== vp.view.getViewClip()) {\n clearViewClip(vp);\n ViewClipTool.enableClipVolume(vp);\n ViewClipTool.setViewClip(vp, deco._clip);\n }\n if (undefined === deco._removeManipulatorToolListener) {\n deco._removeManipulatorToolListener = IModelApp.toolAdmin.manipulatorToolEvent.addListener((tool, event) => deco.onManipulatorToolEvent(tool, event));\n deco.start();\n deco.onChanged.raiseEvent(deco.iModel, ProjectLocationChanged.Show);\n }\n return true;\n }\n ProjectExtentsClipDecoration.clear();\n }\n\n if (!clipToProjectExtents(vp))\n return false;\n\n ProjectExtentsClipDecoration._decorator = new ProjectExtentsClipDecoration(vp);\n if (fitExtents)\n ProjectExtentsClipDecoration._decorator.fitExtents();\n vp.onChangeView.addOnce(() => this.clear(false, true));\n return (undefined !== ProjectExtentsClipDecoration._decorator._clipId);\n }\n\n public static hide(): void {\n if (undefined === ProjectExtentsClipDecoration._decorator)\n return;\n const saveClipId = ProjectExtentsClipDecoration._decorator._clipId; // cleared by stop to trigger decorator removal...\n ProjectExtentsClipDecoration._decorator.stop();\n ProjectExtentsClipDecoration._decorator._clipId = saveClipId;\n ProjectExtentsClipDecoration._decorator.onChanged.raiseEvent(ProjectExtentsClipDecoration._decorator.iModel, ProjectLocationChanged.Hide);\n }\n\n public static clear(clearClip: boolean = true, resetGeolocation: boolean = true): void {\n if (undefined === ProjectExtentsClipDecoration._decorator)\n return;\n if (clearClip)\n ProjectExtentsClipDecoration._decorator.resetViewClip(); // Clear project extents view clip...\n if (resetGeolocation)\n ProjectExtentsClipDecoration._decorator.resetGeolocation(); // Restore modified geolocation back to create state...\n ProjectExtentsClipDecoration._decorator.stop();\n ProjectExtentsClipDecoration._decorator = undefined;\n }\n\n public static async update(): Promise<void> {\n const deco = ProjectExtentsClipDecoration._decorator;\n if (undefined === deco)\n return;\n\n clipToProjectExtents(deco.viewport);\n deco.init();\n\n return deco.updateControls();\n }\n}\n\n/** Show project location decoration. Project extents represented by view clip.\n * @beta\n */\nexport class ProjectLocationShowTool extends Tool {\n public static override toolId = \"ProjectLocation.Show\";\n\n public override async run(): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined === vp || !ProjectExtentsClipDecoration.show(vp))\n return false;\n await IModelApp.toolAdmin.startDefaultTool();\n return true;\n }\n}\n\n/** Hide project location decoration. Preserves changes to project extents view clip and geolocation.\n * @beta\n */\nexport class ProjectLocationHideTool extends Tool {\n public static override toolId = \"ProjectLocation.Hide\";\n\n public override async run(): Promise<boolean> {\n ProjectExtentsClipDecoration.hide();\n await IModelApp.toolAdmin.startDefaultTool();\n return true;\n }\n}\n\n/** Clear project location decoration. Restore modified geolocation and remove view clip.\n * @beta\n */\nexport class ProjectLocationCancelTool extends Tool {\n public static override toolId = \"ProjectLocation.Cancel\";\n\n public override async run(): Promise<boolean> {\n ProjectExtentsClipDecoration.clear();\n await IModelApp.toolAdmin.startDefaultTool();\n return true;\n }\n}\n\n/** Save modified project extents and geolocation. Updates decoration to reflect saved state.\n * @note Allowing this change to be undone is both problematic and undesirable.\n * Warns the user if called with previous changes to cancel restarting the TxnManager session.\n * @beta\n */\nexport class ProjectLocationSaveTool extends Tool {\n public static override toolId = \"ProjectLocation.Save\";\n\n protected async allowRestartTxnSession(iModel: BriefcaseConnection): Promise<boolean> {\n if (!await iModel.txns.isUndoPossible())\n return true;\n\n // NOTE: Default if openMessageBox isn't implemented is MessageBoxValue.Ok, so we'll check No instead of Yes...\n if (MessageBoxValue.No === await IModelApp.notifications.openMessageBox(MessageBoxType.YesNo, translateMessage(\"RestartTxn\"), MessageBoxIconType.Question))\n return false;\n\n return true;\n }\n\n protected async saveChanges(deco: ProjectExtentsClipDecoration, extents?: Range3dProps, ecefLocation?: EcefLocationProps): Promise<void> {\n if (!deco.iModel.isBriefcaseConnection())\n return;\n\n if (!await this.allowRestartTxnSession(deco.iModel))\n return;\n\n try {\n await EditTools.startCommand<string>({ commandId: editorBuiltInCmdIds.cmdBasicManipulation, iModelKey: deco.iModel.key });\n\n if (undefined !== extents)\n await basicManipulationIpc.updateProjectExtents(extents);\n\n if (undefined !== ecefLocation)\n await basicManipulationIpc.updateEcefLocation(ecefLocation);\n\n await deco.iModel.saveChanges(this.toolId);\n await deco.iModel.txns.restartTxnSession();\n } catch (err) {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, BentleyError.getErrorMessage(err) || \"An unknown error occurred.\"));\n }\n\n deco.onChanged.raiseEvent(deco.iModel, ProjectLocationChanged.Save);\n await ProjectExtentsClipDecoration.update();\n return IModelApp.toolAdmin.startDefaultTool();\n }\n\n public override async run(): Promise<boolean> {\n const deco = ProjectExtentsClipDecoration.get();\n if (undefined === deco) {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, translateMessage(\"NotActive\")));\n return false;\n }\n\n if (deco.iModel.isReadonly) {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, translateMessage(\"Readonly\")));\n return true;\n }\n\n const extents = deco.getModifiedExtents();\n const ecefLocation = deco.getModifiedEcefLocation();\n\n if (undefined === extents && undefined === ecefLocation) {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, translateMessage(\"NoChanges\")));\n return true;\n }\n\n await this.saveChanges(deco, extents, ecefLocation);\n return true;\n }\n}\n"]}
@@ -57,7 +57,7 @@ class LabelDecoration {
57
57
  * by calling QuantityFormatter.onInitialized at app startup.
58
58
  * @beta
59
59
  */
60
- class ProjectGeolocationPointTool extends PrimitiveTool {
60
+ export class ProjectGeolocationPointTool extends PrimitiveTool {
61
61
  constructor() {
62
62
  super(...arguments);
63
63
  this._haveToolSettings = false;
@@ -285,11 +285,10 @@ class ProjectGeolocationPointTool extends PrimitiveTool {
285
285
  }
286
286
  ProjectGeolocationPointTool.toolId = "ProjectLocation.Geolocation.Point";
287
287
  ProjectGeolocationPointTool.iconSpec = "icon-globe"; // <== Tool button should use whatever icon you have here...
288
- export { ProjectGeolocationPointTool };
289
288
  /** Change or update geolocation direction to true north.
290
289
  * @beta
291
290
  */
292
- class ProjectGeolocationNorthTool extends PrimitiveTool {
291
+ export class ProjectGeolocationNorthTool extends PrimitiveTool {
293
292
  isCompatibleViewport(vp, isSelectedViewChange) { return (super.isCompatibleViewport(vp, isSelectedViewChange) && undefined !== vp && vp.view.isSpatialView()); }
294
293
  isValidLocation(_ev, _isButtonEvent) { return true; } // Allow snapping to terrain, etc. outside project extents...
295
294
  requireWriteableTarget() { return false; } // Tool doesn't modify the imodel...
@@ -405,11 +404,10 @@ class ProjectGeolocationNorthTool extends PrimitiveTool {
405
404
  }
406
405
  ProjectGeolocationNorthTool.toolId = "ProjectLocation.Geolocation.North";
407
406
  ProjectGeolocationNorthTool.iconSpec = "icon-sort-up"; // <== Tool button should use whatever icon you have here...
408
- export { ProjectGeolocationNorthTool };
409
407
  /** Move a geolocated model by specifying two points to define the offset.
410
408
  * @beta
411
409
  */
412
- class ProjectGeolocationMoveTool extends PrimitiveTool {
410
+ export class ProjectGeolocationMoveTool extends PrimitiveTool {
413
411
  isCompatibleViewport(vp, isSelectedViewChange) { return (super.isCompatibleViewport(vp, isSelectedViewChange) && undefined !== vp && vp.view.isSpatialView()); }
414
412
  isValidLocation(_ev, _isButtonEvent) { return true; } // Allow snapping to terrain, etc. outside project extents...
415
413
  requireWriteableTarget() { return false; } // Tool doesn't modify the imodel...
@@ -526,5 +524,4 @@ class ProjectGeolocationMoveTool extends PrimitiveTool {
526
524
  }
527
525
  ProjectGeolocationMoveTool.toolId = "ProjectLocation.Geolocation.Move";
528
526
  ProjectGeolocationMoveTool.iconSpec = "icon-move"; // <== Tool button should use whatever icon you have here...
529
- export { ProjectGeolocationMoveTool };
530
527
  //# sourceMappingURL=ProjectGeolocation.js.map