@itwin/editor-frontend 3.5.0-dev.8 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/lib/cjs/DeleteElementsTool.d.ts +0 -2
  3. package/lib/cjs/DeleteElementsTool.d.ts.map +1 -1
  4. package/lib/cjs/DeleteElementsTool.js +3 -5
  5. package/lib/cjs/DeleteElementsTool.js.map +1 -1
  6. package/lib/cjs/EditTool.d.ts +0 -1
  7. package/lib/cjs/EditTool.d.ts.map +1 -1
  8. package/lib/cjs/EditTool.js +6 -7
  9. package/lib/cjs/EditTool.js.map +1 -1
  10. package/lib/cjs/EditToolIpc.d.ts +18 -0
  11. package/lib/cjs/EditToolIpc.d.ts.map +1 -0
  12. package/lib/cjs/EditToolIpc.js +28 -0
  13. package/lib/cjs/EditToolIpc.js.map +1 -0
  14. package/lib/cjs/ElementGeometryTool.d.ts +2 -3
  15. package/lib/cjs/ElementGeometryTool.d.ts.map +1 -1
  16. package/lib/cjs/ElementGeometryTool.js +8 -10
  17. package/lib/cjs/ElementGeometryTool.js.map +1 -1
  18. package/lib/cjs/ModifyCurveTools.d.ts +19 -43
  19. package/lib/cjs/ModifyCurveTools.d.ts.map +1 -1
  20. package/lib/cjs/ModifyCurveTools.js +127 -188
  21. package/lib/cjs/ModifyCurveTools.js.map +1 -1
  22. package/lib/cjs/ModifyElementTool.d.ts +43 -0
  23. package/lib/cjs/ModifyElementTool.d.ts.map +1 -0
  24. package/lib/cjs/ModifyElementTool.js +161 -0
  25. package/lib/cjs/ModifyElementTool.js.map +1 -0
  26. package/lib/cjs/ProjectLocation/ProjectExtentsDecoration.d.ts +0 -2
  27. package/lib/cjs/ProjectLocation/ProjectExtentsDecoration.d.ts.map +1 -1
  28. package/lib/cjs/ProjectLocation/ProjectExtentsDecoration.js +3 -5
  29. package/lib/cjs/ProjectLocation/ProjectExtentsDecoration.js.map +1 -1
  30. package/lib/cjs/SketchTools.d.ts +2 -4
  31. package/lib/cjs/SketchTools.d.ts.map +1 -1
  32. package/lib/cjs/SketchTools.js +8 -10
  33. package/lib/cjs/SketchTools.js.map +1 -1
  34. package/lib/cjs/SolidModelingTools.d.ts +3 -3
  35. package/lib/cjs/SolidModelingTools.d.ts.map +1 -1
  36. package/lib/cjs/SolidModelingTools.js +30 -29
  37. package/lib/cjs/SolidModelingTools.js.map +1 -1
  38. package/lib/cjs/SolidPrimitiveTools.d.ts +69 -5
  39. package/lib/cjs/SolidPrimitiveTools.d.ts.map +1 -1
  40. package/lib/cjs/SolidPrimitiveTools.js +291 -8
  41. package/lib/cjs/SolidPrimitiveTools.js.map +1 -1
  42. package/lib/cjs/TransformElementsTool.d.ts +3 -5
  43. package/lib/cjs/TransformElementsTool.d.ts.map +1 -1
  44. package/lib/cjs/TransformElementsTool.js +10 -12
  45. package/lib/cjs/TransformElementsTool.js.map +1 -1
  46. package/lib/cjs/UndoRedoTool.js +1 -1
  47. package/lib/cjs/UndoRedoTool.js.map +1 -1
  48. package/lib/cjs/editor-frontend.d.ts +5 -3
  49. package/lib/cjs/editor-frontend.d.ts.map +1 -1
  50. package/lib/cjs/editor-frontend.js +5 -3
  51. package/lib/cjs/editor-frontend.js.map +1 -1
  52. package/lib/esm/DeleteElementsTool.d.ts +0 -2
  53. package/lib/esm/DeleteElementsTool.d.ts.map +1 -1
  54. package/lib/esm/DeleteElementsTool.js +3 -5
  55. package/lib/esm/DeleteElementsTool.js.map +1 -1
  56. package/lib/esm/EditTool.d.ts +0 -1
  57. package/lib/esm/EditTool.d.ts.map +1 -1
  58. package/lib/esm/EditTool.js +7 -8
  59. package/lib/esm/EditTool.js.map +1 -1
  60. package/lib/esm/EditToolIpc.d.ts +18 -0
  61. package/lib/esm/EditToolIpc.d.ts.map +1 -0
  62. package/lib/esm/EditToolIpc.js +24 -0
  63. package/lib/esm/EditToolIpc.js.map +1 -0
  64. package/lib/esm/ElementGeometryTool.d.ts +2 -3
  65. package/lib/esm/ElementGeometryTool.d.ts.map +1 -1
  66. package/lib/esm/ElementGeometryTool.js +8 -10
  67. package/lib/esm/ElementGeometryTool.js.map +1 -1
  68. package/lib/esm/ModifyCurveTools.d.ts +19 -43
  69. package/lib/esm/ModifyCurveTools.d.ts.map +1 -1
  70. package/lib/esm/ModifyCurveTools.js +127 -188
  71. package/lib/esm/ModifyCurveTools.js.map +1 -1
  72. package/lib/esm/ModifyElementTool.d.ts +43 -0
  73. package/lib/esm/ModifyElementTool.d.ts.map +1 -0
  74. package/lib/esm/ModifyElementTool.js +156 -0
  75. package/lib/esm/ModifyElementTool.js.map +1 -0
  76. package/lib/esm/ProjectLocation/ProjectExtentsDecoration.d.ts +0 -2
  77. package/lib/esm/ProjectLocation/ProjectExtentsDecoration.d.ts.map +1 -1
  78. package/lib/esm/ProjectLocation/ProjectExtentsDecoration.js +3 -5
  79. package/lib/esm/ProjectLocation/ProjectExtentsDecoration.js.map +1 -1
  80. package/lib/esm/SketchTools.d.ts +2 -4
  81. package/lib/esm/SketchTools.d.ts.map +1 -1
  82. package/lib/esm/SketchTools.js +8 -10
  83. package/lib/esm/SketchTools.js.map +1 -1
  84. package/lib/esm/SolidModelingTools.d.ts +3 -3
  85. package/lib/esm/SolidModelingTools.d.ts.map +1 -1
  86. package/lib/esm/SolidModelingTools.js +30 -29
  87. package/lib/esm/SolidModelingTools.js.map +1 -1
  88. package/lib/esm/SolidPrimitiveTools.d.ts +69 -5
  89. package/lib/esm/SolidPrimitiveTools.d.ts.map +1 -1
  90. package/lib/esm/SolidPrimitiveTools.js +289 -8
  91. package/lib/esm/SolidPrimitiveTools.js.map +1 -1
  92. package/lib/esm/TransformElementsTool.d.ts +3 -5
  93. package/lib/esm/TransformElementsTool.d.ts.map +1 -1
  94. package/lib/esm/TransformElementsTool.js +10 -12
  95. package/lib/esm/TransformElementsTool.js.map +1 -1
  96. package/lib/esm/UndoRedoTool.js +1 -1
  97. package/lib/esm/UndoRedoTool.js.map +1 -1
  98. package/lib/esm/editor-frontend.d.ts +5 -3
  99. package/lib/esm/editor-frontend.d.ts.map +1 -1
  100. package/lib/esm/editor-frontend.js +5 -3
  101. package/lib/esm/editor-frontend.js.map +1 -1
  102. package/lib/public/locales/en/Editor.json +26 -0
  103. package/package.json +15 -15
@@ -1,10 +1,9 @@
1
- import { BeButtonEvent, DynamicsContext, ElementSetTool, FeatureOverrideProvider, FeatureSymbology, HitDetail, LocateResponse, ToolAssistanceInstruction, Viewport } from "@itwin/core-frontend";
2
- import { ElementGeometryInfo, FeatureAppearance, FlatBufferGeometryStream, GeometricElementProps, GeometryParams, JsonGeometryStream } from "@itwin/core-common";
3
- import { CurveCollection, CurvePrimitive } from "@itwin/core-geometry";
4
- import { BasicManipulationCommandIpc } from "@itwin/editor-common";
5
- import { DynamicGraphicsProvider } from "./CreateElementTool";
6
1
  import { DialogItem, DialogProperty, DialogPropertySyncItem } from "@itwin/appui-abstract";
7
2
  import { Id64String } from "@itwin/core-bentley";
3
+ import { ElementGeometryInfo, FlatBufferGeometryStream, GeometricElementProps, GeometryParams, JsonGeometryStream } from "@itwin/core-common";
4
+ import { BeButtonEvent, ToolAssistanceInstruction } from "@itwin/core-frontend";
5
+ import { CurveCollection, CurveLocationDetail, CurvePrimitive, GeometryQuery, Path, Point3d } from "@itwin/core-geometry";
6
+ import { ModifyElementWithDynamicsTool } from "./ModifyElementTool";
8
7
  /** @alpha */
9
8
  export declare class CurveData {
10
9
  props: GeometricElementProps;
@@ -12,58 +11,32 @@ export declare class CurveData {
12
11
  geom: CurveCollection | CurvePrimitive;
13
12
  constructor(props: GeometricElementProps, params: GeometryParams, geom: CurveCollection | CurvePrimitive);
14
13
  }
15
- /** @alpha Base class for applying an offset to path and loops. */
16
- export declare abstract class ModifyCurveTool extends ElementSetTool implements FeatureOverrideProvider {
14
+ /** @alpha Base class for modifying all types of curve geometry. */
15
+ export declare abstract class ModifyCurveTool extends ModifyElementWithDynamicsTool {
17
16
  protected _startedCmd?: string;
18
- protected readonly _checkedIds: Map<string, boolean>;
19
17
  protected curveData?: CurveData;
20
- protected _graphicsProvider?: DynamicGraphicsProvider;
21
- protected _firstResult: boolean;
22
- protected _agendaAppearanceDefault?: FeatureAppearance;
23
- protected _agendaAppearanceDynamic?: FeatureAppearance;
24
- protected allowView(_vp: Viewport): boolean;
25
- isCompatibleViewport(vp: Viewport | undefined, isSelectedViewChange: boolean): boolean;
26
18
  protected startCommand(): Promise<string>;
27
- static callCommand<T extends keyof BasicManipulationCommandIpc>(method: T, ...args: Parameters<BasicManipulationCommandIpc[T]>): ReturnType<BasicManipulationCommandIpc[T]>;
28
- protected agendaAppearance(isDynamics: boolean): FeatureAppearance;
29
- protected get wantAgendaAppearanceOverride(): boolean;
30
- addFeatureOverrides(overrides: FeatureSymbology.Overrides, _vp: Viewport): void;
31
- protected updateAgendaAppearanceProvider(drop?: true): void;
32
- protected clearGraphics(): void;
33
- protected createGraphics(ev: BeButtonEvent): Promise<void>;
34
19
  static isSingleCurve(info: ElementGeometryInfo): {
35
20
  curve: CurveCollection | CurvePrimitive;
36
21
  params: GeometryParams;
37
22
  } | undefined;
38
23
  protected acceptCurve(_curve: CurveCollection | CurvePrimitive): boolean;
39
- protected modifyCurve(_ev: BeButtonEvent, _isAccept: boolean): CurveCollection | CurvePrimitive | undefined;
24
+ protected modifyCurve(_ev: BeButtonEvent, _isAccept: boolean): GeometryQuery | undefined;
40
25
  protected getCurveData(id: Id64String): Promise<CurveData | undefined>;
41
- protected onGeometryFilterChanged(): void;
42
- protected acceptElementForOperation(id: Id64String): Promise<boolean>;
43
- protected isElementValidForOperation(hit: HitDetail, out?: LocateResponse): Promise<boolean>;
26
+ protected doAcceptElementForOperation(id: Id64String): Promise<boolean>;
44
27
  protected onAgendaModified(): Promise<void>;
45
- onDynamicFrame(_ev: BeButtonEvent, context: DynamicsContext): void;
46
- onMouseMotion(ev: BeButtonEvent): Promise<void>;
47
28
  protected setupAccuDraw(): void;
48
- protected setupAndPromptForNextAction(): void;
49
29
  protected getGeometryProps(ev: BeButtonEvent, isAccept: boolean): JsonGeometryStream | FlatBufferGeometryStream | undefined;
50
30
  protected getElementProps(ev: BeButtonEvent): GeometricElementProps | undefined;
51
- protected applyAgendaOperation(ev: BeButtonEvent): Promise<boolean>;
52
- processAgenda(ev: BeButtonEvent): Promise<void>;
31
+ protected doUpdateElement(elemProps: GeometricElementProps): Promise<boolean>;
53
32
  protected get wantModifyOriginal(): boolean;
54
33
  protected get wantContinueWithPreviousResult(): boolean;
55
34
  onProcessComplete(): Promise<void>;
56
- onUnsuspend(): Promise<void>;
57
- onSuspend(): Promise<void>;
58
- onPostInstall(): Promise<void>;
59
- onCleanup(): Promise<void>;
60
35
  }
61
36
  /** @alpha Tool for applying an offset to paths and loops. */
62
37
  export declare class OffsetCurveTool extends ModifyCurveTool {
63
38
  static toolId: string;
64
39
  static iconSpec: string;
65
- protected get wantAccuSnap(): boolean;
66
- protected get wantDynamics(): boolean;
67
40
  private _useDistanceProperty;
68
41
  get useDistanceProperty(): DialogProperty<boolean>;
69
42
  get useDistance(): boolean;
@@ -80,7 +53,7 @@ export declare class OffsetCurveTool extends ModifyCurveTool {
80
53
  applyToolSettingPropertyChange(updatedValue: DialogPropertySyncItem): Promise<boolean>;
81
54
  supplyToolSettingsProperties(): DialogItem[] | undefined;
82
55
  protected acceptCurve(curve: CurveCollection | CurvePrimitive): boolean;
83
- protected modifyCurve(ev: BeButtonEvent, isAccept: boolean): CurveCollection | CurvePrimitive | undefined;
56
+ protected modifyCurve(ev: BeButtonEvent, isAccept: boolean): GeometryQuery | undefined;
84
57
  protected get wantModifyOriginal(): boolean;
85
58
  protected get wantContinueWithPreviousResult(): boolean;
86
59
  protected setupAccuDraw(): void;
@@ -94,24 +67,27 @@ export declare class BreakCurveTool extends ModifyCurveTool {
94
67
  protected resultA?: CurveCollection | CurvePrimitive;
95
68
  protected resultB?: CurveCollection | CurvePrimitive;
96
69
  protected modifyOriginal: boolean;
97
- protected get wantAccuSnap(): boolean;
70
+ protected get wantDynamics(): boolean;
98
71
  protected get wantModifyOriginal(): boolean;
99
72
  protected acceptCurve(curve: CurveCollection | CurvePrimitive): boolean;
100
73
  protected doBreakCurve(ev: BeButtonEvent): void;
101
- protected modifyCurve(_ev: BeButtonEvent, _isAccept: boolean): CurveCollection | CurvePrimitive | undefined;
74
+ protected modifyCurve(_ev: BeButtonEvent, _isAccept: boolean): GeometryQuery | undefined;
102
75
  processAgenda(ev: BeButtonEvent): Promise<void>;
103
76
  protected provideToolAssistance(_mainInstrText?: string, _additionalInstr?: ToolAssistanceInstruction[]): void;
104
77
  onRestartTool(): Promise<void>;
105
78
  }
106
- /** @alpha Tool for extending/shortening curves. */
79
+ /** @alpha Tool to extend or trim a path or open curve */
107
80
  export declare class ExtendCurveTool extends ModifyCurveTool {
108
81
  static toolId: string;
109
82
  static iconSpec: string;
110
- protected get wantAccuSnap(): boolean;
111
- protected get wantDynamics(): boolean;
83
+ protected modifyingEnd?: CurvePrimitive;
112
84
  protected get wantAgendaAppearanceOverride(): boolean;
113
85
  protected acceptCurve(curve: CurveCollection | CurvePrimitive): boolean;
114
- protected modifyCurve(ev: BeButtonEvent, _isAccept: boolean): CurveCollection | CurvePrimitive | undefined;
86
+ protected extendCurve(geom: CurvePrimitive, pickPoint: Point3d, spacePoint: Point3d): CurvePrimitive | undefined;
87
+ protected extendPathEnd(geom: Path, closeDetail: CurveLocationDetail, isStart: boolean): Path | undefined;
88
+ protected extendPath(geom: Path, pickPoint: Point3d, spacePoint: Point3d): Path | CurvePrimitive | undefined;
89
+ protected modifyCurve(ev: BeButtonEvent, _isAccept: boolean): GeometryQuery | undefined;
90
+ protected onAgendaModified(): Promise<void>;
115
91
  protected setupAccuDraw(): void;
116
92
  protected provideToolAssistance(_mainInstrText?: string, _additionalInstr?: ToolAssistanceInstruction[]): void;
117
93
  onRestartTool(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"ModifyCurveTools.d.ts","sourceRoot":"","sources":["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,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,yBAAyB,EAAE,GAAG,IAAI;IAO1G,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAK5C;AAED,yDAAyD;AACzD,qBAAa,eAAgB,SAAQ,eAAe;IAClD,OAAuB,MAAM,SAAiB;IAC9C,OAAuB,QAAQ,SAAgB;IAE/C,SAAS,CAAC,YAAY,CAAC,EAAE,cAAc,CAAC;IAExC,cAAuB,4BAA4B,IAAI,OAAO,CAAiB;cAE5D,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,cAAc,GAAG,OAAO;IAOhF,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS;IA4BhH,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS;IAiBzG,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI,GAAG,cAAc,GAAG,SAAS;cAwCzF,WAAW,CAAC,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS;cA6BvE,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;cAKvC,aAAa,IAAI,IAAI;cA8CrB,qBAAqB,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,yBAAyB,EAAE,GAAG,IAAI;IAO1G,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAK5C"}
@@ -2,14 +2,14 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { AccuDrawHintBuilder, ElementSetTool, IModelApp, LengthDescription, NotifyMessageDetails, OutputMessagePriority } from "@itwin/core-frontend";
6
- import { BentleyError, Code, ElementGeometry, ElementGeometryOpcode, FeatureAppearance } from "@itwin/core-common";
7
- import { EditTools } from "./EditTool";
8
- import { AngleSweep, Arc3d, AxisOrder, CurvePrimitive, FrameBuilder, Geometry, JointOptions, LineSegment3d, LineString3d, Loop, Matrix3d, Path, RegionOps, Vector3d } from "@itwin/core-geometry";
9
- import { editorBuiltInCmdIds } from "@itwin/editor-common";
10
- import { computeChordToleranceFromPoint, DynamicGraphicsProvider } from "./CreateElementTool";
11
5
  import { DialogProperty, PropertyDescriptionHelper } from "@itwin/appui-abstract";
12
- import { Id64 } from "@itwin/core-bentley";
6
+ import { BentleyError, Code, ElementGeometry, ElementGeometryOpcode, } from "@itwin/core-common";
7
+ import { AccuDrawHintBuilder, IModelApp, LengthDescription, NotifyMessageDetails, OutputMessagePriority, } from "@itwin/core-frontend";
8
+ import { AngleSweep, Arc3d, AxisOrder, CurveChainWithDistanceIndex, CurvePrimitive, FrameBuilder, Geometry, JointOptions, LineSegment3d, LineString3d, Loop, Matrix3d, Path, RegionOps, Vector3d, } from "@itwin/core-geometry";
9
+ import { editorBuiltInCmdIds } from "@itwin/editor-common";
10
+ import { EditTools } from "./EditTool";
11
+ import { basicManipulationIpc } from "./EditToolIpc";
12
+ import { ModifyElementWithDynamicsTool } from "./ModifyElementTool";
13
13
  /** @alpha */
14
14
  export class CurveData {
15
15
  constructor(props, params, geom) {
@@ -18,79 +18,13 @@ export class CurveData {
18
18
  this.geom = geom;
19
19
  }
20
20
  }
21
- /** @alpha Base class for applying an offset to path and loops. */
22
- export class ModifyCurveTool extends ElementSetTool {
23
- constructor() {
24
- super(...arguments);
25
- this._checkedIds = new Map();
26
- this._firstResult = true;
27
- }
28
- allowView(_vp) { return true; }
29
- isCompatibleViewport(vp, isSelectedViewChange) { return (super.isCompatibleViewport(vp, isSelectedViewChange) && undefined !== vp && this.allowView(vp)); }
21
+ /** @alpha Base class for modifying all types of curve geometry. */
22
+ export class ModifyCurveTool extends ModifyElementWithDynamicsTool {
30
23
  async startCommand() {
31
24
  if (undefined !== this._startedCmd)
32
25
  return this._startedCmd;
33
26
  return EditTools.startCommand(editorBuiltInCmdIds.cmdBasicManipulation, this.iModel.key);
34
27
  }
35
- static callCommand(method, ...args) {
36
- return EditTools.callCommand(method, ...args);
37
- }
38
- agendaAppearance(isDynamics) {
39
- if (isDynamics) {
40
- if (undefined === this._agendaAppearanceDynamic)
41
- this._agendaAppearanceDynamic = FeatureAppearance.fromTransparency(0.0);
42
- return this._agendaAppearanceDynamic;
43
- }
44
- if (undefined === this._agendaAppearanceDefault)
45
- this._agendaAppearanceDefault = FeatureAppearance.fromTransparency(0.9);
46
- return this._agendaAppearanceDefault;
47
- }
48
- get wantAgendaAppearanceOverride() { return false; }
49
- addFeatureOverrides(overrides, _vp) {
50
- if (this.agenda.isEmpty)
51
- return;
52
- const appearance = this.agendaAppearance(false);
53
- this.agenda.elements.forEach((elementId) => overrides.override({ elementId, appearance }));
54
- }
55
- updateAgendaAppearanceProvider(drop) {
56
- if (!this.wantAgendaAppearanceOverride)
57
- return;
58
- for (const vp of IModelApp.viewManager) {
59
- if (!this.allowView(vp))
60
- continue;
61
- if (drop || this.agenda.isEmpty)
62
- vp.dropFeatureOverrideProvider(this);
63
- else if (!vp.addFeatureOverrideProvider(this))
64
- vp.setFeatureOverrideProviderChanged();
65
- }
66
- }
67
- clearGraphics() {
68
- if (undefined === this._graphicsProvider)
69
- return;
70
- this._graphicsProvider.cleanupGraphic();
71
- this._graphicsProvider = undefined;
72
- }
73
- async createGraphics(ev) {
74
- if (!IModelApp.viewManager.inDynamicsMode)
75
- return; // Don't need to create graphic if dynamics aren't yet active...
76
- const geometry = this.getGeometryProps(ev, false);
77
- if (undefined === geometry)
78
- return;
79
- const elemProps = this.getElementProps(ev);
80
- if (undefined === (elemProps === null || elemProps === void 0 ? void 0 : elemProps.placement))
81
- return;
82
- if (undefined === this._graphicsProvider) {
83
- if (this._firstResult) {
84
- this.updateAgendaAppearanceProvider();
85
- this._firstResult = false;
86
- }
87
- this._graphicsProvider = new DynamicGraphicsProvider(this.iModel, this.toolId);
88
- }
89
- // Set chord tolerance for non-linear curve primitives...
90
- if (ev.viewport)
91
- this._graphicsProvider.chordTolerance = computeChordToleranceFromPoint(ev.viewport, ev.point);
92
- await this._graphicsProvider.createGraphic(elemProps.category, elemProps.placement, geometry);
93
- }
94
28
  static isSingleCurve(info) {
95
29
  const it = new ElementGeometry.Iterator(info);
96
30
  it.requestWorldCoordinates();
@@ -114,7 +48,7 @@ export class ModifyCurveTool extends ElementSetTool {
114
48
  try {
115
49
  this._startedCmd = await this.startCommand();
116
50
  const reject = [ElementGeometryOpcode.Polyface, ElementGeometryOpcode.SolidPrimitive, ElementGeometryOpcode.BsplineSurface, ElementGeometryOpcode.BRep];
117
- const info = await ModifyCurveTool.callCommand("requestElementGeometry", id, { maxDisplayable: 1, reject, geometry: { curves: true, surfaces: true, solids: false } });
51
+ const info = await basicManipulationIpc.requestElementGeometry(id, { maxDisplayable: 1, reject, geometry: { curves: true, surfaces: true, solids: false } });
118
52
  if (undefined === info)
119
53
  return undefined;
120
54
  const data = ModifyCurveTool.isSingleCurve(info);
@@ -132,23 +66,8 @@ export class ModifyCurveTool extends ElementSetTool {
132
66
  return undefined;
133
67
  }
134
68
  }
135
- onGeometryFilterChanged() { this._checkedIds.clear(); }
136
- async acceptElementForOperation(id) {
137
- if (Id64.isInvalid(id) || Id64.isTransient(id))
138
- return false;
139
- let accept = this._checkedIds.get(id);
140
- if (undefined === accept) {
141
- if (this.agenda.isEmpty && this._checkedIds.size > 1000)
142
- this._checkedIds.clear(); // Limit auto-locate cache size to something reasonable...
143
- accept = (undefined !== await this.getCurveData(id));
144
- this._checkedIds.set(id, accept);
145
- }
146
- return accept;
147
- }
148
- async isElementValidForOperation(hit, out) {
149
- if (!await super.isElementValidForOperation(hit, out))
150
- return false;
151
- return this.acceptElementForOperation(hit.sourceId);
69
+ async doAcceptElementForOperation(id) {
70
+ return (undefined !== await this.getCurveData(id));
152
71
  }
153
72
  async onAgendaModified() {
154
73
  this.curveData = undefined;
@@ -157,33 +76,22 @@ export class ModifyCurveTool extends ElementSetTool {
157
76
  const id = this.agenda.elements[this.agenda.length - 1];
158
77
  this.curveData = await this.getCurveData(id);
159
78
  }
160
- onDynamicFrame(_ev, context) {
161
- if (undefined !== this._graphicsProvider)
162
- this._graphicsProvider.addGraphic(context);
163
- }
164
- async onMouseMotion(ev) {
165
- return this.createGraphics(ev);
166
- }
167
79
  setupAccuDraw() {
168
80
  const hints = new AccuDrawHintBuilder();
169
81
  hints.enableSmartRotation = true;
170
82
  hints.sendHints(false);
171
83
  }
172
- setupAndPromptForNextAction() {
173
- this.setupAccuDraw();
174
- super.setupAndPromptForNextAction();
175
- }
176
84
  getGeometryProps(ev, isAccept) {
177
85
  if (undefined === this.curveData)
178
86
  return;
179
- const offset = this.modifyCurve(ev, isAccept);
180
- if (undefined === offset)
87
+ const geom = this.modifyCurve(ev, isAccept);
88
+ if (undefined === geom)
181
89
  return;
182
90
  const builder = new ElementGeometry.Builder();
183
91
  builder.setLocalToWorldFromPlacement(this.curveData.props.placement);
184
92
  if (!builder.appendGeometryParamsChange(this.curveData.params))
185
93
  return;
186
- if (!builder.appendGeometryQuery(offset))
94
+ if (!builder.appendGeometryQuery(geom))
187
95
  return;
188
96
  return { format: "flatbuffer", data: builder.entries };
189
97
  }
@@ -198,29 +106,19 @@ export class ModifyCurveTool extends ElementSetTool {
198
106
  }
199
107
  return this.curveData.props;
200
108
  }
201
- async applyAgendaOperation(ev) {
202
- const geometry = this.getGeometryProps(ev, true);
203
- if (undefined === geometry)
204
- return false;
205
- const elemProps = this.getElementProps(ev);
206
- if (undefined === elemProps)
207
- return false;
208
- if ("flatbuffer" === geometry.format)
209
- elemProps.elementGeometryBuilderParams = { entryArray: geometry.data };
210
- else
211
- elemProps.geom = geometry.data;
109
+ async doUpdateElement(elemProps) {
212
110
  try {
213
111
  this._startedCmd = await this.startCommand();
214
112
  if (undefined === elemProps.id) {
215
113
  const repeatOperation = this.wantContinueWithPreviousResult;
216
114
  if (repeatOperation)
217
115
  this.agenda.clear();
218
- const newId = await ModifyCurveTool.callCommand("insertGeometricElement", elemProps);
116
+ const newId = await basicManipulationIpc.insertGeometricElement(elemProps);
219
117
  if (repeatOperation && this.agenda.add(newId))
220
118
  await this.onAgendaModified();
221
119
  }
222
120
  else {
223
- await ModifyCurveTool.callCommand("updateGeometricElement", elemProps);
121
+ await basicManipulationIpc.updateGeometricElement(elemProps);
224
122
  }
225
123
  return true;
226
124
  }
@@ -229,10 +127,6 @@ export class ModifyCurveTool extends ElementSetTool {
229
127
  return false;
230
128
  }
231
129
  }
232
- async processAgenda(ev) {
233
- if (await this.applyAgendaOperation(ev))
234
- return this.saveChanges();
235
- }
236
130
  get wantModifyOriginal() { return true; }
237
131
  get wantContinueWithPreviousResult() { return false; }
238
132
  async onProcessComplete() {
@@ -241,31 +135,9 @@ export class ModifyCurveTool extends ElementSetTool {
241
135
  return;
242
136
  return super.onProcessComplete();
243
137
  }
244
- async onUnsuspend() {
245
- if (!this._firstResult)
246
- this.updateAgendaAppearanceProvider();
247
- return super.onUnsuspend();
248
- }
249
- async onSuspend() {
250
- if (!this._firstResult)
251
- this.updateAgendaAppearanceProvider(true);
252
- return super.onSuspend();
253
- }
254
- async onPostInstall() {
255
- await super.onPostInstall();
256
- if (this.wantAgendaAppearanceOverride)
257
- this.agenda.manageHiliteState = false;
258
- }
259
- async onCleanup() {
260
- this.clearGraphics();
261
- this.updateAgendaAppearanceProvider(true);
262
- return super.onCleanup();
263
- }
264
138
  }
265
139
  /** @alpha Tool for applying an offset to paths and loops. */
266
140
  export class OffsetCurveTool extends ModifyCurveTool {
267
- get wantAccuSnap() { return true; }
268
- get wantDynamics() { return true; }
269
141
  get useDistanceProperty() {
270
142
  if (!this._useDistanceProperty)
271
143
  this._useDistanceProperty = new DialogProperty(PropertyDescriptionHelper.buildLockPropertyDescription("useOffsetDistance"), false);
@@ -429,7 +301,7 @@ export class BreakCurveTool extends ModifyCurveTool {
429
301
  super(...arguments);
430
302
  this.modifyOriginal = true;
431
303
  }
432
- get wantAccuSnap() { return true; }
304
+ get wantDynamics() { return false; }
433
305
  get wantModifyOriginal() { return this.modifyOriginal; }
434
306
  acceptCurve(curve) {
435
307
  if ("curvePrimitive" === curve.geometryCategory)
@@ -556,34 +428,16 @@ export class BreakCurveTool extends ModifyCurveTool {
556
428
  }
557
429
  BreakCurveTool.toolId = "BreakCurve";
558
430
  BreakCurveTool.iconSpec = "icon-scale"; // Need better icon...
559
- /** @alpha Tool for extending/shortening curves. */
431
+ /** @alpha Tool to extend or trim a path or open curve */
560
432
  export class ExtendCurveTool extends ModifyCurveTool {
561
- get wantAccuSnap() { return true; }
562
- get wantDynamics() { return true; }
563
433
  get wantAgendaAppearanceOverride() { return true; }
564
434
  acceptCurve(curve) {
565
- if ("curvePrimitive" !== curve.geometryCategory)
566
- return false;
567
- return curve.isExtensibleFractionSpace;
435
+ if ("curvePrimitive" === curve.geometryCategory)
436
+ return curve.isExtensibleFractionSpace;
437
+ return ("path" === curve.curveCollectionType);
568
438
  }
569
- modifyCurve(ev, _isAccept) {
570
- var _a;
571
- if (undefined === ev.viewport || undefined === this.anchorPoint)
572
- return undefined;
573
- const geom = (_a = this.curveData) === null || _a === void 0 ? void 0 : _a.geom;
574
- if (undefined === geom)
575
- return undefined;
576
- const matrix = AccuDrawHintBuilder.getCurrentRotation(ev.viewport, true, true);
577
- const localToWorld = FrameBuilder.createRightHandedFrame(matrix === null || matrix === void 0 ? void 0 : matrix.getColumn(2), geom);
578
- if (undefined === localToWorld)
579
- return undefined;
580
- const worldToLocal = localToWorld.inverse();
581
- if (undefined === worldToLocal)
582
- return undefined;
583
- const spacePoint = AccuDrawHintBuilder.projectPointToPlaneInView(ev.point, localToWorld.getOrigin(), localToWorld.matrix.getColumn(2), ev.viewport);
584
- if (undefined === spacePoint)
585
- return undefined;
586
- const pickDetail = geom.closestPoint(this.anchorPoint, false);
439
+ extendCurve(geom, pickPoint, spacePoint) {
440
+ const pickDetail = geom.closestPoint(pickPoint, false);
587
441
  if (undefined === (pickDetail === null || pickDetail === void 0 ? void 0 : pickDetail.curve))
588
442
  return undefined;
589
443
  const closeDetail = geom.closestPoint(spacePoint, true);
@@ -606,41 +460,126 @@ export class ExtendCurveTool extends ModifyCurveTool {
606
460
  return fullArc;
607
461
  }
608
462
  }
609
- return closeDetail.curve.clonePartialCurve(pickDetail.fraction > 0.5 ? 0.0 : 1.0, closeDetail.fraction);
463
+ return geom.clonePartialCurve(pickDetail.fraction > 0.5 ? 0.0 : 1.0, closeDetail.fraction);
610
464
  }
611
- setupAccuDraw() {
465
+ extendPathEnd(geom, closeDetail, isStart) {
466
+ if (undefined === closeDetail.curve)
467
+ return undefined;
468
+ const curve = closeDetail.curve.clonePartialCurve(isStart ? closeDetail.fraction : 0.0, isStart ? 1.0 : closeDetail.fraction);
469
+ if (undefined === curve)
470
+ return undefined;
471
+ if (curve instanceof Arc3d && closeDetail.curve instanceof Arc3d && (curve.sweep.isCCW !== closeDetail.curve.sweep.isCCW))
472
+ curve.sweep.cloneComplement(true, curve.sweep); // Preserve current sweep direction...
473
+ const result = geom.clone();
474
+ result.children[isStart ? 0 : geom.children.length - 1] = curve;
475
+ return result;
476
+ }
477
+ extendPath(geom, pickPoint, spacePoint) {
478
+ var _a;
479
+ if (geom.children.length < 2)
480
+ return this.extendCurve(geom.children[0], pickPoint, spacePoint);
481
+ const pathAsPrimitive = CurveChainWithDistanceIndex.createCapture(geom);
482
+ const closeDetail = pathAsPrimitive.closestPoint(spacePoint, true);
483
+ if (undefined === (closeDetail === null || closeDetail === void 0 ? void 0 : closeDetail.curve) || undefined === ((_a = closeDetail.childDetail) === null || _a === void 0 ? void 0 : _a.curve))
484
+ return undefined;
485
+ if (undefined !== this.modifyingEnd) {
486
+ if (closeDetail.childDetail.curve === this.modifyingEnd) {
487
+ this.modifyingEnd = undefined; // Ok to unlock extending first/last curve in path...
488
+ }
489
+ else {
490
+ const pathEndDetail = this.modifyingEnd.closestPoint(spacePoint, true);
491
+ if (undefined === (pathEndDetail === null || pathEndDetail === void 0 ? void 0 : pathEndDetail.curve))
492
+ return undefined;
493
+ return this.extendPathEnd(geom, pathEndDetail, (pathEndDetail.curve === geom.children[0]));
494
+ }
495
+ }
496
+ // NOTE: Special case extend instead of using CurveChainWithDistanceIndex.clonePartialCurve...
497
+ if (closeDetail.fraction < 0.0) {
498
+ this.modifyingEnd = closeDetail.childDetail.curve;
499
+ return this.extendPathEnd(geom, closeDetail.childDetail, true);
500
+ }
501
+ else if (closeDetail.fraction > 1.0) {
502
+ this.modifyingEnd = closeDetail.childDetail.curve;
503
+ return this.extendPathEnd(geom, closeDetail.childDetail, false);
504
+ }
505
+ const pickDetail = pathAsPrimitive.closestPoint(pickPoint, false);
506
+ if (undefined === (pickDetail === null || pickDetail === void 0 ? void 0 : pickDetail.curve))
507
+ return undefined;
508
+ const result = pathAsPrimitive.clonePartialCurve(pickDetail.fraction > 0.5 ? 0.0 : 1.0, closeDetail.fraction);
509
+ if (undefined === result)
510
+ return undefined;
511
+ return Path.create(...result.path.children);
512
+ }
513
+ modifyCurve(ev, _isAccept) {
612
514
  var _a;
515
+ if (undefined === ev.viewport || undefined === this.anchorPoint)
516
+ return undefined;
517
+ const geom = (_a = this.curveData) === null || _a === void 0 ? void 0 : _a.geom;
518
+ if (undefined === geom)
519
+ return undefined;
520
+ const matrix = AccuDrawHintBuilder.getCurrentRotation(ev.viewport, true, true);
521
+ const localToWorld = FrameBuilder.createRightHandedFrame(matrix === null || matrix === void 0 ? void 0 : matrix.getColumn(2), geom);
522
+ if (undefined === localToWorld)
523
+ return undefined;
524
+ const worldToLocal = localToWorld.inverse();
525
+ if (undefined === worldToLocal)
526
+ return undefined;
527
+ const spacePoint = AccuDrawHintBuilder.projectPointToPlaneInView(ev.point, localToWorld.getOrigin(), localToWorld.matrix.getColumn(2), ev.viewport);
528
+ if (undefined === spacePoint)
529
+ return undefined;
530
+ if (geom instanceof CurvePrimitive)
531
+ return this.extendCurve(geom, this.anchorPoint, spacePoint);
532
+ else if (geom instanceof Path)
533
+ return this.extendPath(geom, this.anchorPoint, spacePoint);
534
+ return undefined;
535
+ }
536
+ async onAgendaModified() {
537
+ IModelApp.accuSnap.neverFlash(this.agenda.elements); // Don't flash snapped segment for better preview when trimming curve/path...
538
+ return super.onAgendaModified();
539
+ }
540
+ setupAccuDraw() {
541
+ var _a, _b, _c;
613
542
  const hints = new AccuDrawHintBuilder();
614
543
  if (this.agenda.isEmpty) {
615
544
  hints.enableSmartRotation = true;
616
545
  }
617
546
  else {
618
547
  const geom = (_a = this.curveData) === null || _a === void 0 ? void 0 : _a.geom;
619
- if (undefined === geom || "curvePrimitive" !== geom.geometryCategory)
548
+ if (undefined === geom || undefined === this.anchorPoint)
549
+ return;
550
+ let pickDetail;
551
+ if (geom instanceof CurvePrimitive)
552
+ pickDetail = geom.closestPoint(this.anchorPoint, false);
553
+ else if (geom instanceof Path)
554
+ pickDetail = CurveChainWithDistanceIndex.createCapture(geom).closestPoint(this.anchorPoint, false);
555
+ if (undefined === (pickDetail === null || pickDetail === void 0 ? void 0 : pickDetail.curve))
620
556
  return;
621
- if (geom instanceof Arc3d) {
622
- const matrix = geom.matrixClone();
557
+ const curve = (undefined !== ((_b = pickDetail.childDetail) === null || _b === void 0 ? void 0 : _b.curve) ? (_c = pickDetail.childDetail) === null || _c === void 0 ? void 0 : _c.curve : pickDetail.curve);
558
+ if (curve instanceof Arc3d) {
559
+ const matrix = curve.matrixClone();
623
560
  matrix.normalizeColumnsInPlace();
624
- hints.setOrigin(geom.center);
561
+ hints.setOrigin(curve.center);
625
562
  hints.setMatrix(matrix);
626
563
  hints.setModePolar();
627
564
  }
628
- else if (geom instanceof LineSegment3d) {
629
- const pickDetail = (undefined !== this.anchorPoint ? geom.closestPoint(this.anchorPoint, false) : undefined);
630
- if (undefined !== (pickDetail === null || pickDetail === void 0 ? void 0 : pickDetail.curve)) {
631
- hints.setOrigin(pickDetail.fraction > 0.5 ? geom.point0Ref : geom.point1Ref);
632
- hints.setXAxis(Vector3d.createStartEnd(pickDetail.fraction > 0.5 ? geom.point0Ref : geom.point1Ref, pickDetail.fraction > 0.5 ? geom.point1Ref : geom.point0Ref));
633
- }
565
+ else if (curve instanceof LineSegment3d) {
566
+ hints.setOrigin(pickDetail.fraction > 0.5 ? curve.point0Ref : curve.point1Ref);
567
+ hints.setXAxis(Vector3d.createStartEnd(pickDetail.fraction > 0.5 ? curve.point0Ref : curve.point1Ref, pickDetail.fraction > 0.5 ? curve.point1Ref : curve.point0Ref));
634
568
  hints.setModeRectangular();
635
569
  }
636
- else if (geom instanceof LineString3d) {
637
- const pickDetail = (undefined !== this.anchorPoint ? geom.closestPoint(this.anchorPoint, false) : undefined);
638
- if (undefined !== (pickDetail === null || pickDetail === void 0 ? void 0 : pickDetail.curve) && geom.numPoints() > 1) {
639
- hints.setOrigin(geom.packedPoints.getPoint3dAtUncheckedPointIndex(pickDetail.fraction > 0.5 ? geom.numPoints() - 2 : 1));
640
- hints.setXAxis(Vector3d.createStartEnd(geom.packedPoints.getPoint3dAtUncheckedPointIndex(pickDetail.fraction > 0.5 ? geom.numPoints() - 2 : 1), geom.packedPoints.getPoint3dAtUncheckedPointIndex(pickDetail.fraction > 0.5 ? geom.numPoints() - 1 : 0)));
570
+ else if (curve instanceof LineString3d) {
571
+ if (curve.numPoints() > 1) {
572
+ hints.setOrigin(curve.packedPoints.getPoint3dAtUncheckedPointIndex(pickDetail.fraction > 0.5 ? curve.numPoints() - 2 : 1));
573
+ hints.setXAxis(Vector3d.createStartEnd(curve.packedPoints.getPoint3dAtUncheckedPointIndex(pickDetail.fraction > 0.5 ? curve.numPoints() - 2 : 1), curve.packedPoints.getPoint3dAtUncheckedPointIndex(pickDetail.fraction > 0.5 ? curve.numPoints() - 1 : 0)));
641
574
  }
642
575
  hints.setModeRectangular();
643
576
  }
577
+ else {
578
+ const ray = curve.fractionToPointAndUnitTangent(pickDetail.fraction > 0.5 ? 0.0 : 1.0);
579
+ hints.setOrigin(ray.origin);
580
+ hints.setXAxis(ray.direction);
581
+ hints.setModeRectangular();
582
+ }
644
583
  }
645
584
  hints.sendHints(false);
646
585
  }