@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"}
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { DialogProperty, PropertyDescriptionHelper } from "@itwin/appui-abstract";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { AngleSweep, Arc3d, AxisOrder, CurvePrimitive, FrameBuilder, Geometry, JointOptions, LineSegment3d, LineString3d, Loop, Matrix3d, Path, RegionOps, Vector3d, } from "@itwin/core-geometry";
|
|
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";
|
|
10
9
|
import { editorBuiltInCmdIds } from "@itwin/editor-common";
|
|
11
|
-
import { computeChordToleranceFromPoint, DynamicGraphicsProvider } from "./CreateElementTool";
|
|
12
10
|
import { EditTools } from "./EditTool";
|
|
13
11
|
import { basicManipulationIpc } from "./EditToolIpc";
|
|
12
|
+
import { ModifyElementWithDynamicsTool } from "./ModifyElementTool";
|
|
14
13
|
/** @alpha */
|
|
15
14
|
export class CurveData {
|
|
16
15
|
constructor(props, params, geom) {
|
|
@@ -19,76 +18,13 @@ export class CurveData {
|
|
|
19
18
|
this.geom = geom;
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
|
-
/** @alpha Base class for
|
|
23
|
-
export class ModifyCurveTool extends
|
|
24
|
-
constructor() {
|
|
25
|
-
super(...arguments);
|
|
26
|
-
this._checkedIds = new Map();
|
|
27
|
-
this._firstResult = true;
|
|
28
|
-
}
|
|
29
|
-
allowView(_vp) { return true; }
|
|
30
|
-
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 {
|
|
31
23
|
async startCommand() {
|
|
32
24
|
if (undefined !== this._startedCmd)
|
|
33
25
|
return this._startedCmd;
|
|
34
26
|
return EditTools.startCommand(editorBuiltInCmdIds.cmdBasicManipulation, this.iModel.key);
|
|
35
27
|
}
|
|
36
|
-
agendaAppearance(isDynamics) {
|
|
37
|
-
if (isDynamics) {
|
|
38
|
-
if (undefined === this._agendaAppearanceDynamic)
|
|
39
|
-
this._agendaAppearanceDynamic = FeatureAppearance.fromTransparency(0.0);
|
|
40
|
-
return this._agendaAppearanceDynamic;
|
|
41
|
-
}
|
|
42
|
-
if (undefined === this._agendaAppearanceDefault)
|
|
43
|
-
this._agendaAppearanceDefault = FeatureAppearance.fromTransparency(0.9);
|
|
44
|
-
return this._agendaAppearanceDefault;
|
|
45
|
-
}
|
|
46
|
-
get wantAgendaAppearanceOverride() { return false; }
|
|
47
|
-
addFeatureOverrides(overrides, _vp) {
|
|
48
|
-
if (this.agenda.isEmpty)
|
|
49
|
-
return;
|
|
50
|
-
const appearance = this.agendaAppearance(false);
|
|
51
|
-
this.agenda.elements.forEach((elementId) => overrides.override({ elementId, appearance }));
|
|
52
|
-
}
|
|
53
|
-
updateAgendaAppearanceProvider(drop) {
|
|
54
|
-
if (!this.wantAgendaAppearanceOverride)
|
|
55
|
-
return;
|
|
56
|
-
for (const vp of IModelApp.viewManager) {
|
|
57
|
-
if (!this.allowView(vp))
|
|
58
|
-
continue;
|
|
59
|
-
if (drop || this.agenda.isEmpty)
|
|
60
|
-
vp.dropFeatureOverrideProvider(this);
|
|
61
|
-
else if (!vp.addFeatureOverrideProvider(this))
|
|
62
|
-
vp.setFeatureOverrideProviderChanged();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
clearGraphics() {
|
|
66
|
-
if (undefined === this._graphicsProvider)
|
|
67
|
-
return;
|
|
68
|
-
this._graphicsProvider.cleanupGraphic();
|
|
69
|
-
this._graphicsProvider = undefined;
|
|
70
|
-
}
|
|
71
|
-
async createGraphics(ev) {
|
|
72
|
-
if (!IModelApp.viewManager.inDynamicsMode)
|
|
73
|
-
return; // Don't need to create graphic if dynamics aren't yet active...
|
|
74
|
-
const geometry = this.getGeometryProps(ev, false);
|
|
75
|
-
if (undefined === geometry)
|
|
76
|
-
return;
|
|
77
|
-
const elemProps = this.getElementProps(ev);
|
|
78
|
-
if (undefined === (elemProps === null || elemProps === void 0 ? void 0 : elemProps.placement))
|
|
79
|
-
return;
|
|
80
|
-
if (undefined === this._graphicsProvider) {
|
|
81
|
-
if (this._firstResult) {
|
|
82
|
-
this.updateAgendaAppearanceProvider();
|
|
83
|
-
this._firstResult = false;
|
|
84
|
-
}
|
|
85
|
-
this._graphicsProvider = new DynamicGraphicsProvider(this.iModel, this.toolId);
|
|
86
|
-
}
|
|
87
|
-
// Set chord tolerance for non-linear curve primitives...
|
|
88
|
-
if (ev.viewport)
|
|
89
|
-
this._graphicsProvider.chordTolerance = computeChordToleranceFromPoint(ev.viewport, ev.point);
|
|
90
|
-
await this._graphicsProvider.createGraphic(elemProps.category, elemProps.placement, geometry);
|
|
91
|
-
}
|
|
92
28
|
static isSingleCurve(info) {
|
|
93
29
|
const it = new ElementGeometry.Iterator(info);
|
|
94
30
|
it.requestWorldCoordinates();
|
|
@@ -130,23 +66,8 @@ export class ModifyCurveTool extends ElementSetTool {
|
|
|
130
66
|
return undefined;
|
|
131
67
|
}
|
|
132
68
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (Id64.isInvalid(id) || Id64.isTransient(id))
|
|
136
|
-
return false;
|
|
137
|
-
let accept = this._checkedIds.get(id);
|
|
138
|
-
if (undefined === accept) {
|
|
139
|
-
if (this.agenda.isEmpty && this._checkedIds.size > 1000)
|
|
140
|
-
this._checkedIds.clear(); // Limit auto-locate cache size to something reasonable...
|
|
141
|
-
accept = (undefined !== await this.getCurveData(id));
|
|
142
|
-
this._checkedIds.set(id, accept);
|
|
143
|
-
}
|
|
144
|
-
return accept;
|
|
145
|
-
}
|
|
146
|
-
async isElementValidForOperation(hit, out) {
|
|
147
|
-
if (!await super.isElementValidForOperation(hit, out))
|
|
148
|
-
return false;
|
|
149
|
-
return this.acceptElementForOperation(hit.sourceId);
|
|
69
|
+
async doAcceptElementForOperation(id) {
|
|
70
|
+
return (undefined !== await this.getCurveData(id));
|
|
150
71
|
}
|
|
151
72
|
async onAgendaModified() {
|
|
152
73
|
this.curveData = undefined;
|
|
@@ -155,22 +76,11 @@ export class ModifyCurveTool extends ElementSetTool {
|
|
|
155
76
|
const id = this.agenda.elements[this.agenda.length - 1];
|
|
156
77
|
this.curveData = await this.getCurveData(id);
|
|
157
78
|
}
|
|
158
|
-
onDynamicFrame(_ev, context) {
|
|
159
|
-
if (undefined !== this._graphicsProvider)
|
|
160
|
-
this._graphicsProvider.addGraphic(context);
|
|
161
|
-
}
|
|
162
|
-
async onMouseMotion(ev) {
|
|
163
|
-
return this.createGraphics(ev);
|
|
164
|
-
}
|
|
165
79
|
setupAccuDraw() {
|
|
166
80
|
const hints = new AccuDrawHintBuilder();
|
|
167
81
|
hints.enableSmartRotation = true;
|
|
168
82
|
hints.sendHints(false);
|
|
169
83
|
}
|
|
170
|
-
setupAndPromptForNextAction() {
|
|
171
|
-
this.setupAccuDraw();
|
|
172
|
-
super.setupAndPromptForNextAction();
|
|
173
|
-
}
|
|
174
84
|
getGeometryProps(ev, isAccept) {
|
|
175
85
|
if (undefined === this.curveData)
|
|
176
86
|
return;
|
|
@@ -196,17 +106,7 @@ export class ModifyCurveTool extends ElementSetTool {
|
|
|
196
106
|
}
|
|
197
107
|
return this.curveData.props;
|
|
198
108
|
}
|
|
199
|
-
async
|
|
200
|
-
const geometry = this.getGeometryProps(ev, true);
|
|
201
|
-
if (undefined === geometry)
|
|
202
|
-
return false;
|
|
203
|
-
const elemProps = this.getElementProps(ev);
|
|
204
|
-
if (undefined === elemProps)
|
|
205
|
-
return false;
|
|
206
|
-
if ("flatbuffer" === geometry.format)
|
|
207
|
-
elemProps.elementGeometryBuilderParams = { entryArray: geometry.data };
|
|
208
|
-
else
|
|
209
|
-
elemProps.geom = geometry.data;
|
|
109
|
+
async doUpdateElement(elemProps) {
|
|
210
110
|
try {
|
|
211
111
|
this._startedCmd = await this.startCommand();
|
|
212
112
|
if (undefined === elemProps.id) {
|
|
@@ -227,10 +127,6 @@ export class ModifyCurveTool extends ElementSetTool {
|
|
|
227
127
|
return false;
|
|
228
128
|
}
|
|
229
129
|
}
|
|
230
|
-
async processAgenda(ev) {
|
|
231
|
-
if (await this.applyAgendaOperation(ev))
|
|
232
|
-
return this.saveChanges();
|
|
233
|
-
}
|
|
234
130
|
get wantModifyOriginal() { return true; }
|
|
235
131
|
get wantContinueWithPreviousResult() { return false; }
|
|
236
132
|
async onProcessComplete() {
|
|
@@ -239,31 +135,9 @@ export class ModifyCurveTool extends ElementSetTool {
|
|
|
239
135
|
return;
|
|
240
136
|
return super.onProcessComplete();
|
|
241
137
|
}
|
|
242
|
-
async onUnsuspend() {
|
|
243
|
-
if (!this._firstResult)
|
|
244
|
-
this.updateAgendaAppearanceProvider();
|
|
245
|
-
return super.onUnsuspend();
|
|
246
|
-
}
|
|
247
|
-
async onSuspend() {
|
|
248
|
-
if (!this._firstResult)
|
|
249
|
-
this.updateAgendaAppearanceProvider(true);
|
|
250
|
-
return super.onSuspend();
|
|
251
|
-
}
|
|
252
|
-
async onPostInstall() {
|
|
253
|
-
await super.onPostInstall();
|
|
254
|
-
if (this.wantAgendaAppearanceOverride)
|
|
255
|
-
this.agenda.manageHiliteState = false;
|
|
256
|
-
}
|
|
257
|
-
async onCleanup() {
|
|
258
|
-
this.clearGraphics();
|
|
259
|
-
this.updateAgendaAppearanceProvider(true);
|
|
260
|
-
return super.onCleanup();
|
|
261
|
-
}
|
|
262
138
|
}
|
|
263
139
|
/** @alpha Tool for applying an offset to paths and loops. */
|
|
264
140
|
export class OffsetCurveTool extends ModifyCurveTool {
|
|
265
|
-
get wantAccuSnap() { return true; }
|
|
266
|
-
get wantDynamics() { return true; }
|
|
267
141
|
get useDistanceProperty() {
|
|
268
142
|
if (!this._useDistanceProperty)
|
|
269
143
|
this._useDistanceProperty = new DialogProperty(PropertyDescriptionHelper.buildLockPropertyDescription("useOffsetDistance"), false);
|
|
@@ -427,7 +301,7 @@ export class BreakCurveTool extends ModifyCurveTool {
|
|
|
427
301
|
super(...arguments);
|
|
428
302
|
this.modifyOriginal = true;
|
|
429
303
|
}
|
|
430
|
-
get
|
|
304
|
+
get wantDynamics() { return false; }
|
|
431
305
|
get wantModifyOriginal() { return this.modifyOriginal; }
|
|
432
306
|
acceptCurve(curve) {
|
|
433
307
|
if ("curvePrimitive" === curve.geometryCategory)
|
|
@@ -554,34 +428,16 @@ export class BreakCurveTool extends ModifyCurveTool {
|
|
|
554
428
|
}
|
|
555
429
|
BreakCurveTool.toolId = "BreakCurve";
|
|
556
430
|
BreakCurveTool.iconSpec = "icon-scale"; // Need better icon...
|
|
557
|
-
/** @alpha Tool
|
|
431
|
+
/** @alpha Tool to extend or trim a path or open curve */
|
|
558
432
|
export class ExtendCurveTool extends ModifyCurveTool {
|
|
559
|
-
get wantAccuSnap() { return true; }
|
|
560
|
-
get wantDynamics() { return true; }
|
|
561
433
|
get wantAgendaAppearanceOverride() { return true; }
|
|
562
434
|
acceptCurve(curve) {
|
|
563
|
-
if ("curvePrimitive"
|
|
564
|
-
return
|
|
565
|
-
return curve.
|
|
435
|
+
if ("curvePrimitive" === curve.geometryCategory)
|
|
436
|
+
return curve.isExtensibleFractionSpace;
|
|
437
|
+
return ("path" === curve.curveCollectionType);
|
|
566
438
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
if (undefined === ev.viewport || undefined === this.anchorPoint)
|
|
570
|
-
return undefined;
|
|
571
|
-
const geom = (_a = this.curveData) === null || _a === void 0 ? void 0 : _a.geom;
|
|
572
|
-
if (undefined === geom)
|
|
573
|
-
return undefined;
|
|
574
|
-
const matrix = AccuDrawHintBuilder.getCurrentRotation(ev.viewport, true, true);
|
|
575
|
-
const localToWorld = FrameBuilder.createRightHandedFrame(matrix === null || matrix === void 0 ? void 0 : matrix.getColumn(2), geom);
|
|
576
|
-
if (undefined === localToWorld)
|
|
577
|
-
return undefined;
|
|
578
|
-
const worldToLocal = localToWorld.inverse();
|
|
579
|
-
if (undefined === worldToLocal)
|
|
580
|
-
return undefined;
|
|
581
|
-
const spacePoint = AccuDrawHintBuilder.projectPointToPlaneInView(ev.point, localToWorld.getOrigin(), localToWorld.matrix.getColumn(2), ev.viewport);
|
|
582
|
-
if (undefined === spacePoint)
|
|
583
|
-
return undefined;
|
|
584
|
-
const pickDetail = geom.closestPoint(this.anchorPoint, false);
|
|
439
|
+
extendCurve(geom, pickPoint, spacePoint) {
|
|
440
|
+
const pickDetail = geom.closestPoint(pickPoint, false);
|
|
585
441
|
if (undefined === (pickDetail === null || pickDetail === void 0 ? void 0 : pickDetail.curve))
|
|
586
442
|
return undefined;
|
|
587
443
|
const closeDetail = geom.closestPoint(spacePoint, true);
|
|
@@ -604,41 +460,126 @@ export class ExtendCurveTool extends ModifyCurveTool {
|
|
|
604
460
|
return fullArc;
|
|
605
461
|
}
|
|
606
462
|
}
|
|
607
|
-
return
|
|
463
|
+
return geom.clonePartialCurve(pickDetail.fraction > 0.5 ? 0.0 : 1.0, closeDetail.fraction);
|
|
608
464
|
}
|
|
609
|
-
|
|
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) {
|
|
610
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) {
|
|
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;
|
|
611
542
|
const hints = new AccuDrawHintBuilder();
|
|
612
543
|
if (this.agenda.isEmpty) {
|
|
613
544
|
hints.enableSmartRotation = true;
|
|
614
545
|
}
|
|
615
546
|
else {
|
|
616
547
|
const geom = (_a = this.curveData) === null || _a === void 0 ? void 0 : _a.geom;
|
|
617
|
-
if (undefined === geom ||
|
|
548
|
+
if (undefined === geom || undefined === this.anchorPoint)
|
|
618
549
|
return;
|
|
619
|
-
|
|
620
|
-
|
|
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))
|
|
556
|
+
return;
|
|
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();
|
|
621
560
|
matrix.normalizeColumnsInPlace();
|
|
622
|
-
hints.setOrigin(
|
|
561
|
+
hints.setOrigin(curve.center);
|
|
623
562
|
hints.setMatrix(matrix);
|
|
624
563
|
hints.setModePolar();
|
|
625
564
|
}
|
|
626
|
-
else if (
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
hints.setOrigin(pickDetail.fraction > 0.5 ? geom.point0Ref : geom.point1Ref);
|
|
630
|
-
hints.setXAxis(Vector3d.createStartEnd(pickDetail.fraction > 0.5 ? geom.point0Ref : geom.point1Ref, pickDetail.fraction > 0.5 ? geom.point1Ref : geom.point0Ref));
|
|
631
|
-
}
|
|
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));
|
|
632
568
|
hints.setModeRectangular();
|
|
633
569
|
}
|
|
634
|
-
else if (
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
hints.
|
|
638
|
-
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)));
|
|
639
574
|
}
|
|
640
575
|
hints.setModeRectangular();
|
|
641
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
|
+
}
|
|
642
583
|
}
|
|
643
584
|
hints.sendHints(false);
|
|
644
585
|
}
|