@itwin/editor-frontend 3.5.0-dev.35 → 3.5.0-dev.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/ModifyCurveTools.d.ts +15 -37
- package/lib/cjs/ModifyCurveTools.d.ts.map +1 -1
- package/lib/cjs/ModifyCurveTools.js +115 -174
- package/lib/cjs/ModifyCurveTools.js.map +1 -1
- package/lib/cjs/ModifyElementTool.d.ts +43 -0
- package/lib/cjs/ModifyElementTool.d.ts.map +1 -0
- package/lib/cjs/ModifyElementTool.js +157 -0
- package/lib/cjs/ModifyElementTool.js.map +1 -0
- package/lib/cjs/editor-frontend.d.ts +1 -0
- package/lib/cjs/editor-frontend.d.ts.map +1 -1
- package/lib/cjs/editor-frontend.js +1 -0
- package/lib/cjs/editor-frontend.js.map +1 -1
- package/lib/esm/ModifyCurveTools.d.ts +15 -37
- package/lib/esm/ModifyCurveTools.d.ts.map +1 -1
- package/lib/esm/ModifyCurveTools.js +118 -177
- package/lib/esm/ModifyCurveTools.js.map +1 -1
- package/lib/esm/ModifyElementTool.d.ts +43 -0
- package/lib/esm/ModifyElementTool.d.ts.map +1 -0
- package/lib/esm/ModifyElementTool.js +152 -0
- package/lib/esm/ModifyElementTool.js.map +1 -0
- package/lib/esm/editor-frontend.d.ts +1 -0
- package/lib/esm/editor-frontend.d.ts.map +1 -1
- package/lib/esm/editor-frontend.js +1 -0
- package/lib/esm/editor-frontend.js.map +1 -1
- package/package.json +15 -15
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DialogItem, DialogProperty, DialogPropertySyncItem } from "@itwin/appui-abstract";
|
|
2
2
|
import { Id64String } from "@itwin/core-bentley";
|
|
3
|
-
import { ElementGeometryInfo,
|
|
4
|
-
import { BeButtonEvent,
|
|
5
|
-
import { CurveCollection, CurvePrimitive } from "@itwin/core-geometry";
|
|
6
|
-
import {
|
|
3
|
+
import { ElementGeometryInfo, FlatBufferGeometryStream, GeometricElementProps, GeometryParams, JsonGeometryStream } from "@itwin/core-common";
|
|
4
|
+
import { BeButtonEvent, ToolAssistanceInstruction } from "@itwin/core-frontend";
|
|
5
|
+
import { CurveCollection, CurveLocationDetail, CurvePrimitive, Path, Point3d } from "@itwin/core-geometry";
|
|
6
|
+
import { ModifyElementWithDynamicsTool } from "./ModifyElementTool";
|
|
7
7
|
/** @alpha */
|
|
8
8
|
export declare class CurveData {
|
|
9
9
|
props: GeometricElementProps;
|
|
@@ -11,24 +11,11 @@ export declare class CurveData {
|
|
|
11
11
|
geom: CurveCollection | CurvePrimitive;
|
|
12
12
|
constructor(props: GeometricElementProps, params: GeometryParams, geom: CurveCollection | CurvePrimitive);
|
|
13
13
|
}
|
|
14
|
-
/** @alpha Base class for
|
|
15
|
-
export declare abstract class ModifyCurveTool extends
|
|
14
|
+
/** @alpha Base class for modifying all types of curve geometry. */
|
|
15
|
+
export declare abstract class ModifyCurveTool extends ModifyElementWithDynamicsTool {
|
|
16
16
|
protected _startedCmd?: string;
|
|
17
|
-
protected readonly _checkedIds: Map<string, boolean>;
|
|
18
17
|
protected curveData?: CurveData;
|
|
19
|
-
protected _graphicsProvider?: DynamicGraphicsProvider;
|
|
20
|
-
protected _firstResult: boolean;
|
|
21
|
-
protected _agendaAppearanceDefault?: FeatureAppearance;
|
|
22
|
-
protected _agendaAppearanceDynamic?: FeatureAppearance;
|
|
23
|
-
protected allowView(_vp: Viewport): boolean;
|
|
24
|
-
isCompatibleViewport(vp: Viewport | undefined, isSelectedViewChange: boolean): boolean;
|
|
25
18
|
protected startCommand(): Promise<string>;
|
|
26
|
-
protected agendaAppearance(isDynamics: boolean): FeatureAppearance;
|
|
27
|
-
protected get wantAgendaAppearanceOverride(): boolean;
|
|
28
|
-
addFeatureOverrides(overrides: FeatureSymbology.Overrides, _vp: Viewport): void;
|
|
29
|
-
protected updateAgendaAppearanceProvider(drop?: true): void;
|
|
30
|
-
protected clearGraphics(): void;
|
|
31
|
-
protected createGraphics(ev: BeButtonEvent): Promise<void>;
|
|
32
19
|
static isSingleCurve(info: ElementGeometryInfo): {
|
|
33
20
|
curve: CurveCollection | CurvePrimitive;
|
|
34
21
|
params: GeometryParams;
|
|
@@ -36,32 +23,20 @@ export declare abstract class ModifyCurveTool extends ElementSetTool implements
|
|
|
36
23
|
protected acceptCurve(_curve: CurveCollection | CurvePrimitive): boolean;
|
|
37
24
|
protected modifyCurve(_ev: BeButtonEvent, _isAccept: boolean): CurveCollection | CurvePrimitive | undefined;
|
|
38
25
|
protected getCurveData(id: Id64String): Promise<CurveData | undefined>;
|
|
39
|
-
protected
|
|
40
|
-
protected acceptElementForOperation(id: Id64String): Promise<boolean>;
|
|
41
|
-
protected isElementValidForOperation(hit: HitDetail, out?: LocateResponse): Promise<boolean>;
|
|
26
|
+
protected doAcceptElementForOperation(id: Id64String): Promise<boolean>;
|
|
42
27
|
protected onAgendaModified(): Promise<void>;
|
|
43
|
-
onDynamicFrame(_ev: BeButtonEvent, context: DynamicsContext): void;
|
|
44
|
-
onMouseMotion(ev: BeButtonEvent): Promise<void>;
|
|
45
28
|
protected setupAccuDraw(): void;
|
|
46
|
-
protected setupAndPromptForNextAction(): void;
|
|
47
29
|
protected getGeometryProps(ev: BeButtonEvent, isAccept: boolean): JsonGeometryStream | FlatBufferGeometryStream | undefined;
|
|
48
30
|
protected getElementProps(ev: BeButtonEvent): GeometricElementProps | undefined;
|
|
49
|
-
protected
|
|
50
|
-
processAgenda(ev: BeButtonEvent): Promise<void>;
|
|
31
|
+
protected doUpdateElement(elemProps: GeometricElementProps): Promise<boolean>;
|
|
51
32
|
protected get wantModifyOriginal(): boolean;
|
|
52
33
|
protected get wantContinueWithPreviousResult(): boolean;
|
|
53
34
|
onProcessComplete(): Promise<void>;
|
|
54
|
-
onUnsuspend(): Promise<void>;
|
|
55
|
-
onSuspend(): Promise<void>;
|
|
56
|
-
onPostInstall(): Promise<void>;
|
|
57
|
-
onCleanup(): Promise<void>;
|
|
58
35
|
}
|
|
59
36
|
/** @alpha Tool for applying an offset to paths and loops. */
|
|
60
37
|
export declare class OffsetCurveTool extends ModifyCurveTool {
|
|
61
38
|
static toolId: string;
|
|
62
39
|
static iconSpec: string;
|
|
63
|
-
protected get wantAccuSnap(): boolean;
|
|
64
|
-
protected get wantDynamics(): boolean;
|
|
65
40
|
private _useDistanceProperty;
|
|
66
41
|
get useDistanceProperty(): DialogProperty<boolean>;
|
|
67
42
|
get useDistance(): boolean;
|
|
@@ -92,7 +67,7 @@ export declare class BreakCurveTool extends ModifyCurveTool {
|
|
|
92
67
|
protected resultA?: CurveCollection | CurvePrimitive;
|
|
93
68
|
protected resultB?: CurveCollection | CurvePrimitive;
|
|
94
69
|
protected modifyOriginal: boolean;
|
|
95
|
-
protected get
|
|
70
|
+
protected get wantDynamics(): boolean;
|
|
96
71
|
protected get wantModifyOriginal(): boolean;
|
|
97
72
|
protected acceptCurve(curve: CurveCollection | CurvePrimitive): boolean;
|
|
98
73
|
protected doBreakCurve(ev: BeButtonEvent): void;
|
|
@@ -101,15 +76,18 @@ export declare class BreakCurveTool extends ModifyCurveTool {
|
|
|
101
76
|
protected provideToolAssistance(_mainInstrText?: string, _additionalInstr?: ToolAssistanceInstruction[]): void;
|
|
102
77
|
onRestartTool(): Promise<void>;
|
|
103
78
|
}
|
|
104
|
-
/** @alpha Tool
|
|
79
|
+
/** @alpha Tool to extend or trim a path or open curve */
|
|
105
80
|
export declare class ExtendCurveTool extends ModifyCurveTool {
|
|
106
81
|
static toolId: string;
|
|
107
82
|
static iconSpec: string;
|
|
108
|
-
protected
|
|
109
|
-
protected get wantDynamics(): boolean;
|
|
83
|
+
protected modifyingEnd?: CurvePrimitive;
|
|
110
84
|
protected get wantAgendaAppearanceOverride(): boolean;
|
|
111
85
|
protected acceptCurve(curve: CurveCollection | CurvePrimitive): boolean;
|
|
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;
|
|
112
89
|
protected modifyCurve(ev: BeButtonEvent, _isAccept: boolean): CurveCollection | CurvePrimitive | undefined;
|
|
90
|
+
protected onAgendaModified(): Promise<void>;
|
|
113
91
|
protected setupAccuDraw(): void;
|
|
114
92
|
protected provideToolAssistance(_mainInstrText?: string, _additionalInstr?: ToolAssistanceInstruction[]): void;
|
|
115
93
|
onRestartTool(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModifyCurveTools.d.ts","sourceRoot":"","sources":["../../src/ModifyCurveTools.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,sBAAsB,EAA6B,MAAM,uBAAuB,CAAC;AACtH,OAAO,
|
|
1
|
+
{"version":3,"file":"ModifyCurveTools.d.ts","sourceRoot":"","sources":["../../src/ModifyCurveTools.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,sBAAsB,EAA6B,MAAM,uBAAuB,CAAC;AACtH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACgC,mBAAmB,EAAyB,wBAAwB,EAAE,qBAAqB,EAChI,cAAc,EAAE,kBAAkB,EACnC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACgB,aAAa,EAC8B,yBAAyB,EAC1F,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACsD,eAAe,EAAE,mBAAmB,EAAE,cAAc,EAC/G,IAAI,EAAE,OAAO,EACd,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAEpE,aAAa;AACb,qBAAa,SAAS;IACb,KAAK,EAAE,qBAAqB,CAAC;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,EA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AAE,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,eAAe,GAAG,cAAc,GAAG,SAAS;cA6B1F,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"}
|
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ExtendCurveTool = exports.BreakCurveTool = exports.OffsetCurveTool = exports.ModifyCurveTool = exports.CurveData = void 0;
|
|
8
8
|
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
9
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
10
9
|
const core_common_1 = require("@itwin/core-common");
|
|
11
10
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
12
11
|
const core_geometry_1 = require("@itwin/core-geometry");
|
|
13
12
|
const editor_common_1 = require("@itwin/editor-common");
|
|
14
|
-
const CreateElementTool_1 = require("./CreateElementTool");
|
|
15
13
|
const EditTool_1 = require("./EditTool");
|
|
16
14
|
const EditToolIpc_1 = require("./EditToolIpc");
|
|
15
|
+
const ModifyElementTool_1 = require("./ModifyElementTool");
|
|
17
16
|
/** @alpha */
|
|
18
17
|
class CurveData {
|
|
19
18
|
constructor(props, params, geom) {
|
|
@@ -23,76 +22,13 @@ class CurveData {
|
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
exports.CurveData = CurveData;
|
|
26
|
-
/** @alpha Base class for
|
|
27
|
-
class ModifyCurveTool extends
|
|
28
|
-
constructor() {
|
|
29
|
-
super(...arguments);
|
|
30
|
-
this._checkedIds = new Map();
|
|
31
|
-
this._firstResult = true;
|
|
32
|
-
}
|
|
33
|
-
allowView(_vp) { return true; }
|
|
34
|
-
isCompatibleViewport(vp, isSelectedViewChange) { return (super.isCompatibleViewport(vp, isSelectedViewChange) && undefined !== vp && this.allowView(vp)); }
|
|
25
|
+
/** @alpha Base class for modifying all types of curve geometry. */
|
|
26
|
+
class ModifyCurveTool extends ModifyElementTool_1.ModifyElementWithDynamicsTool {
|
|
35
27
|
async startCommand() {
|
|
36
28
|
if (undefined !== this._startedCmd)
|
|
37
29
|
return this._startedCmd;
|
|
38
30
|
return EditTool_1.EditTools.startCommand(editor_common_1.editorBuiltInCmdIds.cmdBasicManipulation, this.iModel.key);
|
|
39
31
|
}
|
|
40
|
-
agendaAppearance(isDynamics) {
|
|
41
|
-
if (isDynamics) {
|
|
42
|
-
if (undefined === this._agendaAppearanceDynamic)
|
|
43
|
-
this._agendaAppearanceDynamic = core_common_1.FeatureAppearance.fromTransparency(0.0);
|
|
44
|
-
return this._agendaAppearanceDynamic;
|
|
45
|
-
}
|
|
46
|
-
if (undefined === this._agendaAppearanceDefault)
|
|
47
|
-
this._agendaAppearanceDefault = core_common_1.FeatureAppearance.fromTransparency(0.9);
|
|
48
|
-
return this._agendaAppearanceDefault;
|
|
49
|
-
}
|
|
50
|
-
get wantAgendaAppearanceOverride() { return false; }
|
|
51
|
-
addFeatureOverrides(overrides, _vp) {
|
|
52
|
-
if (this.agenda.isEmpty)
|
|
53
|
-
return;
|
|
54
|
-
const appearance = this.agendaAppearance(false);
|
|
55
|
-
this.agenda.elements.forEach((elementId) => overrides.override({ elementId, appearance }));
|
|
56
|
-
}
|
|
57
|
-
updateAgendaAppearanceProvider(drop) {
|
|
58
|
-
if (!this.wantAgendaAppearanceOverride)
|
|
59
|
-
return;
|
|
60
|
-
for (const vp of core_frontend_1.IModelApp.viewManager) {
|
|
61
|
-
if (!this.allowView(vp))
|
|
62
|
-
continue;
|
|
63
|
-
if (drop || this.agenda.isEmpty)
|
|
64
|
-
vp.dropFeatureOverrideProvider(this);
|
|
65
|
-
else if (!vp.addFeatureOverrideProvider(this))
|
|
66
|
-
vp.setFeatureOverrideProviderChanged();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
clearGraphics() {
|
|
70
|
-
if (undefined === this._graphicsProvider)
|
|
71
|
-
return;
|
|
72
|
-
this._graphicsProvider.cleanupGraphic();
|
|
73
|
-
this._graphicsProvider = undefined;
|
|
74
|
-
}
|
|
75
|
-
async createGraphics(ev) {
|
|
76
|
-
if (!core_frontend_1.IModelApp.viewManager.inDynamicsMode)
|
|
77
|
-
return; // Don't need to create graphic if dynamics aren't yet active...
|
|
78
|
-
const geometry = this.getGeometryProps(ev, false);
|
|
79
|
-
if (undefined === geometry)
|
|
80
|
-
return;
|
|
81
|
-
const elemProps = this.getElementProps(ev);
|
|
82
|
-
if (undefined === (elemProps === null || elemProps === void 0 ? void 0 : elemProps.placement))
|
|
83
|
-
return;
|
|
84
|
-
if (undefined === this._graphicsProvider) {
|
|
85
|
-
if (this._firstResult) {
|
|
86
|
-
this.updateAgendaAppearanceProvider();
|
|
87
|
-
this._firstResult = false;
|
|
88
|
-
}
|
|
89
|
-
this._graphicsProvider = new CreateElementTool_1.DynamicGraphicsProvider(this.iModel, this.toolId);
|
|
90
|
-
}
|
|
91
|
-
// Set chord tolerance for non-linear curve primitives...
|
|
92
|
-
if (ev.viewport)
|
|
93
|
-
this._graphicsProvider.chordTolerance = (0, CreateElementTool_1.computeChordToleranceFromPoint)(ev.viewport, ev.point);
|
|
94
|
-
await this._graphicsProvider.createGraphic(elemProps.category, elemProps.placement, geometry);
|
|
95
|
-
}
|
|
96
32
|
static isSingleCurve(info) {
|
|
97
33
|
const it = new core_common_1.ElementGeometry.Iterator(info);
|
|
98
34
|
it.requestWorldCoordinates();
|
|
@@ -134,23 +70,8 @@ class ModifyCurveTool extends core_frontend_1.ElementSetTool {
|
|
|
134
70
|
return undefined;
|
|
135
71
|
}
|
|
136
72
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (core_bentley_1.Id64.isInvalid(id) || core_bentley_1.Id64.isTransient(id))
|
|
140
|
-
return false;
|
|
141
|
-
let accept = this._checkedIds.get(id);
|
|
142
|
-
if (undefined === accept) {
|
|
143
|
-
if (this.agenda.isEmpty && this._checkedIds.size > 1000)
|
|
144
|
-
this._checkedIds.clear(); // Limit auto-locate cache size to something reasonable...
|
|
145
|
-
accept = (undefined !== await this.getCurveData(id));
|
|
146
|
-
this._checkedIds.set(id, accept);
|
|
147
|
-
}
|
|
148
|
-
return accept;
|
|
149
|
-
}
|
|
150
|
-
async isElementValidForOperation(hit, out) {
|
|
151
|
-
if (!await super.isElementValidForOperation(hit, out))
|
|
152
|
-
return false;
|
|
153
|
-
return this.acceptElementForOperation(hit.sourceId);
|
|
73
|
+
async doAcceptElementForOperation(id) {
|
|
74
|
+
return (undefined !== await this.getCurveData(id));
|
|
154
75
|
}
|
|
155
76
|
async onAgendaModified() {
|
|
156
77
|
this.curveData = undefined;
|
|
@@ -159,22 +80,11 @@ class ModifyCurveTool extends core_frontend_1.ElementSetTool {
|
|
|
159
80
|
const id = this.agenda.elements[this.agenda.length - 1];
|
|
160
81
|
this.curveData = await this.getCurveData(id);
|
|
161
82
|
}
|
|
162
|
-
onDynamicFrame(_ev, context) {
|
|
163
|
-
if (undefined !== this._graphicsProvider)
|
|
164
|
-
this._graphicsProvider.addGraphic(context);
|
|
165
|
-
}
|
|
166
|
-
async onMouseMotion(ev) {
|
|
167
|
-
return this.createGraphics(ev);
|
|
168
|
-
}
|
|
169
83
|
setupAccuDraw() {
|
|
170
84
|
const hints = new core_frontend_1.AccuDrawHintBuilder();
|
|
171
85
|
hints.enableSmartRotation = true;
|
|
172
86
|
hints.sendHints(false);
|
|
173
87
|
}
|
|
174
|
-
setupAndPromptForNextAction() {
|
|
175
|
-
this.setupAccuDraw();
|
|
176
|
-
super.setupAndPromptForNextAction();
|
|
177
|
-
}
|
|
178
88
|
getGeometryProps(ev, isAccept) {
|
|
179
89
|
if (undefined === this.curveData)
|
|
180
90
|
return;
|
|
@@ -200,17 +110,7 @@ class ModifyCurveTool extends core_frontend_1.ElementSetTool {
|
|
|
200
110
|
}
|
|
201
111
|
return this.curveData.props;
|
|
202
112
|
}
|
|
203
|
-
async
|
|
204
|
-
const geometry = this.getGeometryProps(ev, true);
|
|
205
|
-
if (undefined === geometry)
|
|
206
|
-
return false;
|
|
207
|
-
const elemProps = this.getElementProps(ev);
|
|
208
|
-
if (undefined === elemProps)
|
|
209
|
-
return false;
|
|
210
|
-
if ("flatbuffer" === geometry.format)
|
|
211
|
-
elemProps.elementGeometryBuilderParams = { entryArray: geometry.data };
|
|
212
|
-
else
|
|
213
|
-
elemProps.geom = geometry.data;
|
|
113
|
+
async doUpdateElement(elemProps) {
|
|
214
114
|
try {
|
|
215
115
|
this._startedCmd = await this.startCommand();
|
|
216
116
|
if (undefined === elemProps.id) {
|
|
@@ -231,10 +131,6 @@ class ModifyCurveTool extends core_frontend_1.ElementSetTool {
|
|
|
231
131
|
return false;
|
|
232
132
|
}
|
|
233
133
|
}
|
|
234
|
-
async processAgenda(ev) {
|
|
235
|
-
if (await this.applyAgendaOperation(ev))
|
|
236
|
-
return this.saveChanges();
|
|
237
|
-
}
|
|
238
134
|
get wantModifyOriginal() { return true; }
|
|
239
135
|
get wantContinueWithPreviousResult() { return false; }
|
|
240
136
|
async onProcessComplete() {
|
|
@@ -243,32 +139,10 @@ class ModifyCurveTool extends core_frontend_1.ElementSetTool {
|
|
|
243
139
|
return;
|
|
244
140
|
return super.onProcessComplete();
|
|
245
141
|
}
|
|
246
|
-
async onUnsuspend() {
|
|
247
|
-
if (!this._firstResult)
|
|
248
|
-
this.updateAgendaAppearanceProvider();
|
|
249
|
-
return super.onUnsuspend();
|
|
250
|
-
}
|
|
251
|
-
async onSuspend() {
|
|
252
|
-
if (!this._firstResult)
|
|
253
|
-
this.updateAgendaAppearanceProvider(true);
|
|
254
|
-
return super.onSuspend();
|
|
255
|
-
}
|
|
256
|
-
async onPostInstall() {
|
|
257
|
-
await super.onPostInstall();
|
|
258
|
-
if (this.wantAgendaAppearanceOverride)
|
|
259
|
-
this.agenda.manageHiliteState = false;
|
|
260
|
-
}
|
|
261
|
-
async onCleanup() {
|
|
262
|
-
this.clearGraphics();
|
|
263
|
-
this.updateAgendaAppearanceProvider(true);
|
|
264
|
-
return super.onCleanup();
|
|
265
|
-
}
|
|
266
142
|
}
|
|
267
143
|
exports.ModifyCurveTool = ModifyCurveTool;
|
|
268
144
|
/** @alpha Tool for applying an offset to paths and loops. */
|
|
269
145
|
class OffsetCurveTool extends ModifyCurveTool {
|
|
270
|
-
get wantAccuSnap() { return true; }
|
|
271
|
-
get wantDynamics() { return true; }
|
|
272
146
|
get useDistanceProperty() {
|
|
273
147
|
if (!this._useDistanceProperty)
|
|
274
148
|
this._useDistanceProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildLockPropertyDescription("useOffsetDistance"), false);
|
|
@@ -433,7 +307,7 @@ class BreakCurveTool extends ModifyCurveTool {
|
|
|
433
307
|
super(...arguments);
|
|
434
308
|
this.modifyOriginal = true;
|
|
435
309
|
}
|
|
436
|
-
get
|
|
310
|
+
get wantDynamics() { return false; }
|
|
437
311
|
get wantModifyOriginal() { return this.modifyOriginal; }
|
|
438
312
|
acceptCurve(curve) {
|
|
439
313
|
if ("curvePrimitive" === curve.geometryCategory)
|
|
@@ -561,34 +435,16 @@ class BreakCurveTool extends ModifyCurveTool {
|
|
|
561
435
|
exports.BreakCurveTool = BreakCurveTool;
|
|
562
436
|
BreakCurveTool.toolId = "BreakCurve";
|
|
563
437
|
BreakCurveTool.iconSpec = "icon-scale"; // Need better icon...
|
|
564
|
-
/** @alpha Tool
|
|
438
|
+
/** @alpha Tool to extend or trim a path or open curve */
|
|
565
439
|
class ExtendCurveTool extends ModifyCurveTool {
|
|
566
|
-
get wantAccuSnap() { return true; }
|
|
567
|
-
get wantDynamics() { return true; }
|
|
568
440
|
get wantAgendaAppearanceOverride() { return true; }
|
|
569
441
|
acceptCurve(curve) {
|
|
570
|
-
if ("curvePrimitive"
|
|
571
|
-
return
|
|
572
|
-
return curve.
|
|
442
|
+
if ("curvePrimitive" === curve.geometryCategory)
|
|
443
|
+
return curve.isExtensibleFractionSpace;
|
|
444
|
+
return ("path" === curve.curveCollectionType);
|
|
573
445
|
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
if (undefined === ev.viewport || undefined === this.anchorPoint)
|
|
577
|
-
return undefined;
|
|
578
|
-
const geom = (_a = this.curveData) === null || _a === void 0 ? void 0 : _a.geom;
|
|
579
|
-
if (undefined === geom)
|
|
580
|
-
return undefined;
|
|
581
|
-
const matrix = core_frontend_1.AccuDrawHintBuilder.getCurrentRotation(ev.viewport, true, true);
|
|
582
|
-
const localToWorld = core_geometry_1.FrameBuilder.createRightHandedFrame(matrix === null || matrix === void 0 ? void 0 : matrix.getColumn(2), geom);
|
|
583
|
-
if (undefined === localToWorld)
|
|
584
|
-
return undefined;
|
|
585
|
-
const worldToLocal = localToWorld.inverse();
|
|
586
|
-
if (undefined === worldToLocal)
|
|
587
|
-
return undefined;
|
|
588
|
-
const spacePoint = core_frontend_1.AccuDrawHintBuilder.projectPointToPlaneInView(ev.point, localToWorld.getOrigin(), localToWorld.matrix.getColumn(2), ev.viewport);
|
|
589
|
-
if (undefined === spacePoint)
|
|
590
|
-
return undefined;
|
|
591
|
-
const pickDetail = geom.closestPoint(this.anchorPoint, false);
|
|
446
|
+
extendCurve(geom, pickPoint, spacePoint) {
|
|
447
|
+
const pickDetail = geom.closestPoint(pickPoint, false);
|
|
592
448
|
if (undefined === (pickDetail === null || pickDetail === void 0 ? void 0 : pickDetail.curve))
|
|
593
449
|
return undefined;
|
|
594
450
|
const closeDetail = geom.closestPoint(spacePoint, true);
|
|
@@ -611,41 +467,126 @@ class ExtendCurveTool extends ModifyCurveTool {
|
|
|
611
467
|
return fullArc;
|
|
612
468
|
}
|
|
613
469
|
}
|
|
614
|
-
return
|
|
470
|
+
return geom.clonePartialCurve(pickDetail.fraction > 0.5 ? 0.0 : 1.0, closeDetail.fraction);
|
|
615
471
|
}
|
|
616
|
-
|
|
472
|
+
extendPathEnd(geom, closeDetail, isStart) {
|
|
473
|
+
if (undefined === closeDetail.curve)
|
|
474
|
+
return undefined;
|
|
475
|
+
const curve = closeDetail.curve.clonePartialCurve(isStart ? closeDetail.fraction : 0.0, isStart ? 1.0 : closeDetail.fraction);
|
|
476
|
+
if (undefined === curve)
|
|
477
|
+
return undefined;
|
|
478
|
+
if (curve instanceof core_geometry_1.Arc3d && closeDetail.curve instanceof core_geometry_1.Arc3d && (curve.sweep.isCCW !== closeDetail.curve.sweep.isCCW))
|
|
479
|
+
curve.sweep.cloneComplement(true, curve.sweep); // Preserve current sweep direction...
|
|
480
|
+
const result = geom.clone();
|
|
481
|
+
result.children[isStart ? 0 : geom.children.length - 1] = curve;
|
|
482
|
+
return result;
|
|
483
|
+
}
|
|
484
|
+
extendPath(geom, pickPoint, spacePoint) {
|
|
617
485
|
var _a;
|
|
486
|
+
if (geom.children.length < 2)
|
|
487
|
+
return this.extendCurve(geom.children[0], pickPoint, spacePoint);
|
|
488
|
+
const pathAsPrimitive = core_geometry_1.CurveChainWithDistanceIndex.createCapture(geom);
|
|
489
|
+
const closeDetail = pathAsPrimitive.closestPoint(spacePoint, true);
|
|
490
|
+
if (undefined === (closeDetail === null || closeDetail === void 0 ? void 0 : closeDetail.curve) || undefined === ((_a = closeDetail.childDetail) === null || _a === void 0 ? void 0 : _a.curve))
|
|
491
|
+
return undefined;
|
|
492
|
+
if (undefined !== this.modifyingEnd) {
|
|
493
|
+
if (closeDetail.childDetail.curve === this.modifyingEnd) {
|
|
494
|
+
this.modifyingEnd = undefined; // Ok to unlock extending first/last curve in path...
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
const pathEndDetail = this.modifyingEnd.closestPoint(spacePoint, true);
|
|
498
|
+
if (undefined === (pathEndDetail === null || pathEndDetail === void 0 ? void 0 : pathEndDetail.curve))
|
|
499
|
+
return undefined;
|
|
500
|
+
return this.extendPathEnd(geom, pathEndDetail, (pathEndDetail.curve === geom.children[0]));
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
// NOTE: Special case extend instead of using CurveChainWithDistanceIndex.clonePartialCurve...
|
|
504
|
+
if (closeDetail.fraction < 0.0) {
|
|
505
|
+
this.modifyingEnd = closeDetail.childDetail.curve;
|
|
506
|
+
return this.extendPathEnd(geom, closeDetail.childDetail, true);
|
|
507
|
+
}
|
|
508
|
+
else if (closeDetail.fraction > 1.0) {
|
|
509
|
+
this.modifyingEnd = closeDetail.childDetail.curve;
|
|
510
|
+
return this.extendPathEnd(geom, closeDetail.childDetail, false);
|
|
511
|
+
}
|
|
512
|
+
const pickDetail = pathAsPrimitive.closestPoint(pickPoint, false);
|
|
513
|
+
if (undefined === (pickDetail === null || pickDetail === void 0 ? void 0 : pickDetail.curve))
|
|
514
|
+
return undefined;
|
|
515
|
+
const result = pathAsPrimitive.clonePartialCurve(pickDetail.fraction > 0.5 ? 0.0 : 1.0, closeDetail.fraction);
|
|
516
|
+
if (undefined === result)
|
|
517
|
+
return undefined;
|
|
518
|
+
return core_geometry_1.Path.create(...result.path.children);
|
|
519
|
+
}
|
|
520
|
+
modifyCurve(ev, _isAccept) {
|
|
521
|
+
var _a;
|
|
522
|
+
if (undefined === ev.viewport || undefined === this.anchorPoint)
|
|
523
|
+
return undefined;
|
|
524
|
+
const geom = (_a = this.curveData) === null || _a === void 0 ? void 0 : _a.geom;
|
|
525
|
+
if (undefined === geom)
|
|
526
|
+
return undefined;
|
|
527
|
+
const matrix = core_frontend_1.AccuDrawHintBuilder.getCurrentRotation(ev.viewport, true, true);
|
|
528
|
+
const localToWorld = core_geometry_1.FrameBuilder.createRightHandedFrame(matrix === null || matrix === void 0 ? void 0 : matrix.getColumn(2), geom);
|
|
529
|
+
if (undefined === localToWorld)
|
|
530
|
+
return undefined;
|
|
531
|
+
const worldToLocal = localToWorld.inverse();
|
|
532
|
+
if (undefined === worldToLocal)
|
|
533
|
+
return undefined;
|
|
534
|
+
const spacePoint = core_frontend_1.AccuDrawHintBuilder.projectPointToPlaneInView(ev.point, localToWorld.getOrigin(), localToWorld.matrix.getColumn(2), ev.viewport);
|
|
535
|
+
if (undefined === spacePoint)
|
|
536
|
+
return undefined;
|
|
537
|
+
if (geom instanceof core_geometry_1.CurvePrimitive)
|
|
538
|
+
return this.extendCurve(geom, this.anchorPoint, spacePoint);
|
|
539
|
+
else if (geom instanceof core_geometry_1.Path)
|
|
540
|
+
return this.extendPath(geom, this.anchorPoint, spacePoint);
|
|
541
|
+
return undefined;
|
|
542
|
+
}
|
|
543
|
+
async onAgendaModified() {
|
|
544
|
+
core_frontend_1.IModelApp.accuSnap.neverFlash(this.agenda.elements); // Don't flash snapped segment for better preview when trimming curve/path...
|
|
545
|
+
return super.onAgendaModified();
|
|
546
|
+
}
|
|
547
|
+
setupAccuDraw() {
|
|
548
|
+
var _a, _b, _c;
|
|
618
549
|
const hints = new core_frontend_1.AccuDrawHintBuilder();
|
|
619
550
|
if (this.agenda.isEmpty) {
|
|
620
551
|
hints.enableSmartRotation = true;
|
|
621
552
|
}
|
|
622
553
|
else {
|
|
623
554
|
const geom = (_a = this.curveData) === null || _a === void 0 ? void 0 : _a.geom;
|
|
624
|
-
if (undefined === geom ||
|
|
555
|
+
if (undefined === geom || undefined === this.anchorPoint)
|
|
625
556
|
return;
|
|
626
|
-
|
|
627
|
-
|
|
557
|
+
let pickDetail;
|
|
558
|
+
if (geom instanceof core_geometry_1.CurvePrimitive)
|
|
559
|
+
pickDetail = geom.closestPoint(this.anchorPoint, false);
|
|
560
|
+
else if (geom instanceof core_geometry_1.Path)
|
|
561
|
+
pickDetail = core_geometry_1.CurveChainWithDistanceIndex.createCapture(geom).closestPoint(this.anchorPoint, false);
|
|
562
|
+
if (undefined === (pickDetail === null || pickDetail === void 0 ? void 0 : pickDetail.curve))
|
|
563
|
+
return;
|
|
564
|
+
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);
|
|
565
|
+
if (curve instanceof core_geometry_1.Arc3d) {
|
|
566
|
+
const matrix = curve.matrixClone();
|
|
628
567
|
matrix.normalizeColumnsInPlace();
|
|
629
|
-
hints.setOrigin(
|
|
568
|
+
hints.setOrigin(curve.center);
|
|
630
569
|
hints.setMatrix(matrix);
|
|
631
570
|
hints.setModePolar();
|
|
632
571
|
}
|
|
633
|
-
else if (
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
hints.setOrigin(pickDetail.fraction > 0.5 ? geom.point0Ref : geom.point1Ref);
|
|
637
|
-
hints.setXAxis(core_geometry_1.Vector3d.createStartEnd(pickDetail.fraction > 0.5 ? geom.point0Ref : geom.point1Ref, pickDetail.fraction > 0.5 ? geom.point1Ref : geom.point0Ref));
|
|
638
|
-
}
|
|
572
|
+
else if (curve instanceof core_geometry_1.LineSegment3d) {
|
|
573
|
+
hints.setOrigin(pickDetail.fraction > 0.5 ? curve.point0Ref : curve.point1Ref);
|
|
574
|
+
hints.setXAxis(core_geometry_1.Vector3d.createStartEnd(pickDetail.fraction > 0.5 ? curve.point0Ref : curve.point1Ref, pickDetail.fraction > 0.5 ? curve.point1Ref : curve.point0Ref));
|
|
639
575
|
hints.setModeRectangular();
|
|
640
576
|
}
|
|
641
|
-
else if (
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
hints.
|
|
645
|
-
hints.setXAxis(core_geometry_1.Vector3d.createStartEnd(geom.packedPoints.getPoint3dAtUncheckedPointIndex(pickDetail.fraction > 0.5 ? geom.numPoints() - 2 : 1), geom.packedPoints.getPoint3dAtUncheckedPointIndex(pickDetail.fraction > 0.5 ? geom.numPoints() - 1 : 0)));
|
|
577
|
+
else if (curve instanceof core_geometry_1.LineString3d) {
|
|
578
|
+
if (curve.numPoints() > 1) {
|
|
579
|
+
hints.setOrigin(curve.packedPoints.getPoint3dAtUncheckedPointIndex(pickDetail.fraction > 0.5 ? curve.numPoints() - 2 : 1));
|
|
580
|
+
hints.setXAxis(core_geometry_1.Vector3d.createStartEnd(curve.packedPoints.getPoint3dAtUncheckedPointIndex(pickDetail.fraction > 0.5 ? curve.numPoints() - 2 : 1), curve.packedPoints.getPoint3dAtUncheckedPointIndex(pickDetail.fraction > 0.5 ? curve.numPoints() - 1 : 0)));
|
|
646
581
|
}
|
|
647
582
|
hints.setModeRectangular();
|
|
648
583
|
}
|
|
584
|
+
else {
|
|
585
|
+
const ray = curve.fractionToPointAndUnitTangent(pickDetail.fraction > 0.5 ? 0.0 : 1.0);
|
|
586
|
+
hints.setOrigin(ray.origin);
|
|
587
|
+
hints.setXAxis(ray.direction);
|
|
588
|
+
hints.setModeRectangular();
|
|
589
|
+
}
|
|
649
590
|
}
|
|
650
591
|
hints.sendHints(false);
|
|
651
592
|
}
|