@itwin/editor-frontend 4.5.0-dev.8 → 4.6.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -1
- package/LICENSE.md +1 -1
- package/README.md +0 -29
- package/lib/cjs/CreateElementTool.d.ts +64 -2
- package/lib/cjs/CreateElementTool.d.ts.map +1 -1
- package/lib/cjs/CreateElementTool.js +65 -4
- package/lib/cjs/CreateElementTool.js.map +1 -1
- package/lib/cjs/EditTool.d.ts +5 -0
- package/lib/cjs/EditTool.d.ts.map +1 -1
- package/lib/cjs/EditTool.js +10 -14
- package/lib/cjs/EditTool.js.map +1 -1
- package/lib/cjs/EditToolIpc.d.ts +1 -5
- package/lib/cjs/EditToolIpc.d.ts.map +1 -1
- package/lib/cjs/EditToolIpc.js +1 -5
- package/lib/cjs/EditToolIpc.js.map +1 -1
- package/lib/cjs/TransformElementsTool.d.ts +17 -98
- package/lib/cjs/TransformElementsTool.d.ts.map +1 -1
- package/lib/cjs/TransformElementsTool.js +15 -412
- package/lib/cjs/TransformElementsTool.js.map +1 -1
- package/lib/cjs/editor-frontend.d.ts +0 -6
- package/lib/cjs/editor-frontend.d.ts.map +1 -1
- package/lib/cjs/editor-frontend.js +0 -6
- package/lib/cjs/editor-frontend.js.map +1 -1
- package/lib/esm/CreateElementTool.d.ts +64 -2
- package/lib/esm/CreateElementTool.d.ts.map +1 -1
- package/lib/esm/CreateElementTool.js +65 -4
- package/lib/esm/CreateElementTool.js.map +1 -1
- package/lib/esm/EditTool.d.ts +5 -0
- package/lib/esm/EditTool.d.ts.map +1 -1
- package/lib/esm/EditTool.js +10 -14
- package/lib/esm/EditTool.js.map +1 -1
- package/lib/esm/EditToolIpc.d.ts +1 -5
- package/lib/esm/EditToolIpc.d.ts.map +1 -1
- package/lib/esm/EditToolIpc.js +0 -4
- package/lib/esm/EditToolIpc.js.map +1 -1
- package/lib/esm/TransformElementsTool.d.ts +17 -98
- package/lib/esm/TransformElementsTool.d.ts.map +1 -1
- package/lib/esm/TransformElementsTool.js +16 -413
- package/lib/esm/TransformElementsTool.js.map +1 -1
- package/lib/esm/editor-frontend.d.ts +0 -6
- package/lib/esm/editor-frontend.d.ts.map +1 -1
- package/lib/esm/editor-frontend.js +0 -6
- package/lib/esm/editor-frontend.js.map +1 -1
- package/lib/public/locales/en/Editor.json +0 -411
- package/package.json +14 -14
- package/lib/cjs/DeleteElementsTool.d.ts +0 -14
- package/lib/cjs/DeleteElementsTool.d.ts.map +0 -1
- package/lib/cjs/DeleteElementsTool.js +0 -42
- package/lib/cjs/DeleteElementsTool.js.map +0 -1
- package/lib/cjs/ElementGeometryTool.d.ts +0 -148
- package/lib/cjs/ElementGeometryTool.d.ts.map +0 -1
- package/lib/cjs/ElementGeometryTool.js +0 -705
- package/lib/cjs/ElementGeometryTool.js.map +0 -1
- package/lib/cjs/ModifyCurveTools.d.ts +0 -140
- package/lib/cjs/ModifyCurveTools.d.ts.map +0 -1
- package/lib/cjs/ModifyCurveTools.js +0 -777
- package/lib/cjs/ModifyCurveTools.js.map +0 -1
- package/lib/cjs/SketchTools.d.ts +0 -308
- package/lib/cjs/SketchTools.d.ts.map +0 -1
- package/lib/cjs/SketchTools.js +0 -1708
- package/lib/cjs/SketchTools.js.map +0 -1
- package/lib/cjs/SolidModelingTools.d.ts +0 -381
- package/lib/cjs/SolidModelingTools.d.ts.map +0 -1
- package/lib/cjs/SolidModelingTools.js +0 -1453
- package/lib/cjs/SolidModelingTools.js.map +0 -1
- package/lib/cjs/SolidPrimitiveTools.d.ts +0 -322
- package/lib/cjs/SolidPrimitiveTools.d.ts.map +0 -1
- package/lib/cjs/SolidPrimitiveTools.js +0 -1376
- package/lib/cjs/SolidPrimitiveTools.js.map +0 -1
- package/lib/esm/DeleteElementsTool.d.ts +0 -14
- package/lib/esm/DeleteElementsTool.d.ts.map +0 -1
- package/lib/esm/DeleteElementsTool.js +0 -39
- package/lib/esm/DeleteElementsTool.js.map +0 -1
- package/lib/esm/ElementGeometryTool.d.ts +0 -148
- package/lib/esm/ElementGeometryTool.d.ts.map +0 -1
- package/lib/esm/ElementGeometryTool.js +0 -697
- package/lib/esm/ElementGeometryTool.js.map +0 -1
- package/lib/esm/ModifyCurveTools.d.ts +0 -140
- package/lib/esm/ModifyCurveTools.d.ts.map +0 -1
- package/lib/esm/ModifyCurveTools.js +0 -772
- package/lib/esm/ModifyCurveTools.js.map +0 -1
- package/lib/esm/SketchTools.d.ts +0 -308
- package/lib/esm/SketchTools.d.ts.map +0 -1
- package/lib/esm/SketchTools.js +0 -1704
- package/lib/esm/SketchTools.js.map +0 -1
- package/lib/esm/SolidModelingTools.d.ts +0 -381
- package/lib/esm/SolidModelingTools.d.ts.map +0 -1
- package/lib/esm/SolidModelingTools.js +0 -1445
- package/lib/esm/SolidModelingTools.js.map +0 -1
- package/lib/esm/SolidPrimitiveTools.d.ts +0 -322
- package/lib/esm/SolidPrimitiveTools.d.ts.map +0 -1
- package/lib/esm/SolidPrimitiveTools.js +0 -1372
- package/lib/esm/SolidPrimitiveTools.js.map +0 -1
|
@@ -1,705 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module Editing
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.LocateSubEntityTool = exports.ElementGeometryCacheTool = exports.SubEntityData = exports.isSameSubEntity = exports.ElementGeometryGraphicsProvider = void 0;
|
|
11
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
-
const core_common_1 = require("@itwin/core-common");
|
|
13
|
-
const core_frontend_1 = require("@itwin/core-frontend");
|
|
14
|
-
const core_geometry_1 = require("@itwin/core-geometry");
|
|
15
|
-
const editor_common_1 = require("@itwin/editor-common");
|
|
16
|
-
const CreateElementTool_1 = require("./CreateElementTool");
|
|
17
|
-
const EditTool_1 = require("./EditTool");
|
|
18
|
-
const EditToolIpc_1 = require("./EditToolIpc");
|
|
19
|
-
/** @alpha */
|
|
20
|
-
class ElementGeometryGraphicsProvider {
|
|
21
|
-
constructor(iModel) {
|
|
22
|
-
this.iModel = iModel;
|
|
23
|
-
}
|
|
24
|
-
/** Call to request a RenderGraphic for the supplied graphic data.
|
|
25
|
-
* @see [[cleanupGraphic]] Must be called when the tool exits.
|
|
26
|
-
*/
|
|
27
|
-
async createGraphic(graphicData) {
|
|
28
|
-
try {
|
|
29
|
-
const graphic = await (0, core_frontend_1.readElementGraphics)(graphicData, this.iModel, core_bentley_1.Id64.invalid, true, { noFlash: true, noHilite: true });
|
|
30
|
-
const graphicOwner = graphic ? core_frontend_1.IModelApp.renderSystem.createGraphicOwner(graphic) : undefined;
|
|
31
|
-
this.cleanupGraphic();
|
|
32
|
-
return (undefined !== (this.graphic = graphicOwner));
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/** Call to dispose of [[RenderGraphic]] held by [[RenderGraphicOwner]].
|
|
39
|
-
* @note Must be called when the tool exits to avoid leaks of graphics memory or other webgl resources.
|
|
40
|
-
*/
|
|
41
|
-
cleanupGraphic() {
|
|
42
|
-
if (undefined === this.graphic)
|
|
43
|
-
return;
|
|
44
|
-
this.graphic.disposeGraphic();
|
|
45
|
-
this.graphic = undefined;
|
|
46
|
-
}
|
|
47
|
-
addGraphic(context, transform, opts) {
|
|
48
|
-
if (undefined === this.graphic)
|
|
49
|
-
return;
|
|
50
|
-
if (undefined === transform && undefined === opts) {
|
|
51
|
-
context.addGraphic(this.graphic);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const branch = new core_frontend_1.GraphicBranch(false);
|
|
55
|
-
branch.add(this.graphic);
|
|
56
|
-
const branchGraphic = context.createGraphicBranch(branch, transform ? transform : core_geometry_1.Transform.createIdentity(), opts);
|
|
57
|
-
context.addGraphic(branchGraphic);
|
|
58
|
-
}
|
|
59
|
-
addDecoration(context, type, transform, opts) {
|
|
60
|
-
if (undefined === this.graphic)
|
|
61
|
-
return;
|
|
62
|
-
const branch = new core_frontend_1.GraphicBranch(false);
|
|
63
|
-
branch.add(this.graphic);
|
|
64
|
-
const branchGraphic = context.createGraphicBranch(branch, transform ? transform : core_geometry_1.Transform.createIdentity(), opts);
|
|
65
|
-
context.addDecoration(type, branchGraphic);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.ElementGeometryGraphicsProvider = ElementGeometryGraphicsProvider;
|
|
69
|
-
/** @alpha */
|
|
70
|
-
function isSameSubEntity(a, b) {
|
|
71
|
-
if (a.type !== b.type)
|
|
72
|
-
return false;
|
|
73
|
-
if (a.id !== b.id)
|
|
74
|
-
return false;
|
|
75
|
-
if ((undefined !== a.index ? a.index : 0) !== (undefined !== b.index ? b.index : 0))
|
|
76
|
-
return false;
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
exports.isSameSubEntity = isSameSubEntity;
|
|
80
|
-
/** @alpha */
|
|
81
|
-
class SubEntityData {
|
|
82
|
-
constructor(props) { this._props = props; }
|
|
83
|
-
get props() { return this._props; }
|
|
84
|
-
set props(value) {
|
|
85
|
-
this.cleanupGraphic();
|
|
86
|
-
this._props = value;
|
|
87
|
-
}
|
|
88
|
-
get geometry() { return this._geometry; }
|
|
89
|
-
set geometry(value) { this._geometry = value; }
|
|
90
|
-
isSame(other) { return isSameSubEntity(this._props, other); }
|
|
91
|
-
getAppearance(vp, accepted) {
|
|
92
|
-
const color = vp.hilite.color;
|
|
93
|
-
const rgb = core_common_1.RgbColor.fromColorDef(accepted ? color.inverse() : color);
|
|
94
|
-
const transparency = 0.25;
|
|
95
|
-
const emphasized = true; // Necessary for obscured sub-entities w/SceneGraphic...
|
|
96
|
-
let weight;
|
|
97
|
-
switch (this.props.type) {
|
|
98
|
-
case editor_common_1.SubEntityType.Face:
|
|
99
|
-
break;
|
|
100
|
-
case editor_common_1.SubEntityType.Edge:
|
|
101
|
-
const edgeWeight = accepted ? 1 : 3;
|
|
102
|
-
weight = this._geometry?.appearance?.weight ? Math.min(this._geometry.appearance.weight + edgeWeight, 31) : edgeWeight;
|
|
103
|
-
break;
|
|
104
|
-
case editor_common_1.SubEntityType.Vertex:
|
|
105
|
-
const vertexWeight = accepted ? 8 : 10;
|
|
106
|
-
weight = this._geometry?.appearance?.weight ? Math.min(this._geometry.appearance.weight + vertexWeight, 31) : vertexWeight;
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
return core_common_1.FeatureAppearance.fromJSON({ rgb, transparency, weight, emphasized, nonLocatable: true });
|
|
110
|
-
}
|
|
111
|
-
async createGraphic(iModel) {
|
|
112
|
-
if (undefined === this._geometry?.graphic)
|
|
113
|
-
return false;
|
|
114
|
-
if (undefined === this._graphicsProvider)
|
|
115
|
-
this._graphicsProvider = new ElementGeometryGraphicsProvider(iModel);
|
|
116
|
-
return this._graphicsProvider.createGraphic(this._geometry.graphic);
|
|
117
|
-
}
|
|
118
|
-
cleanupGraphic() {
|
|
119
|
-
if (undefined === this._graphicsProvider)
|
|
120
|
-
return;
|
|
121
|
-
this._graphicsProvider.cleanupGraphic();
|
|
122
|
-
this._graphicsProvider = undefined;
|
|
123
|
-
}
|
|
124
|
-
get hasGraphic() {
|
|
125
|
-
return (undefined !== this._graphicsProvider?.graphic);
|
|
126
|
-
}
|
|
127
|
-
display(context, accepted) {
|
|
128
|
-
if (undefined === this._graphicsProvider?.graphic)
|
|
129
|
-
return;
|
|
130
|
-
const range = (this._geometry?.range ? core_geometry_1.Range3d.fromJSON(this._geometry.range) : undefined);
|
|
131
|
-
const pixelSize = context.viewport.getPixelSizeAtPoint(range ? range.center : undefined);
|
|
132
|
-
const offsetDir = context.viewport.view.getZVector();
|
|
133
|
-
offsetDir.scaleToLength(3 * pixelSize, offsetDir);
|
|
134
|
-
const offsetTrans = core_geometry_1.Transform.createTranslation(offsetDir);
|
|
135
|
-
const appearanceProvider = core_common_1.FeatureAppearanceProvider.supplement((app) => {
|
|
136
|
-
return app.extendAppearance(this.getAppearance(context.viewport, accepted));
|
|
137
|
-
});
|
|
138
|
-
this._graphicsProvider.addDecoration(context, core_frontend_1.GraphicType.Scene, offsetTrans, { appearanceProvider });
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
exports.SubEntityData = SubEntityData;
|
|
142
|
-
/** @alpha Base class for tools that want to use the backend geometry cache. */
|
|
143
|
-
class ElementGeometryCacheTool extends core_frontend_1.ElementSetTool {
|
|
144
|
-
constructor() {
|
|
145
|
-
super(...arguments);
|
|
146
|
-
this._checkedIds = new Map();
|
|
147
|
-
this._firstResult = true;
|
|
148
|
-
}
|
|
149
|
-
allowView(vp) { return vp.view.is3d(); }
|
|
150
|
-
isCompatibleViewport(vp, isSelectedViewChange) { return (super.isCompatibleViewport(vp, isSelectedViewChange) && undefined !== vp && this.allowView(vp)); }
|
|
151
|
-
async startCommand() {
|
|
152
|
-
if (undefined !== this._startedCmd)
|
|
153
|
-
return this._startedCmd;
|
|
154
|
-
return EditTool_1.EditTools.startCommand({ commandId: editor_common_1.editorBuiltInCmdIds.cmdSolidModeling, iModelKey: this.iModel.key });
|
|
155
|
-
}
|
|
156
|
-
agendaAppearance(isDynamics) {
|
|
157
|
-
if (isDynamics) {
|
|
158
|
-
if (undefined === this._agendaAppearanceDynamic)
|
|
159
|
-
this._agendaAppearanceDynamic = core_common_1.FeatureAppearance.fromTransparency(0.0);
|
|
160
|
-
return this._agendaAppearanceDynamic;
|
|
161
|
-
}
|
|
162
|
-
if (undefined === this._agendaAppearanceDefault)
|
|
163
|
-
this._agendaAppearanceDefault = core_common_1.FeatureAppearance.fromTransparency(0.9);
|
|
164
|
-
return this._agendaAppearanceDefault;
|
|
165
|
-
}
|
|
166
|
-
get wantAgendaAppearanceOverride() { return false; }
|
|
167
|
-
addFeatureOverrides(overrides, _vp) {
|
|
168
|
-
if (this.agenda.isEmpty)
|
|
169
|
-
return;
|
|
170
|
-
const appearance = this.agendaAppearance(false);
|
|
171
|
-
this.agenda.elements.forEach((elementId) => overrides.override({ elementId, appearance }));
|
|
172
|
-
}
|
|
173
|
-
updateAgendaAppearanceProvider(drop) {
|
|
174
|
-
if (!this.wantAgendaAppearanceOverride)
|
|
175
|
-
return;
|
|
176
|
-
for (const vp of core_frontend_1.IModelApp.viewManager) {
|
|
177
|
-
if (!this.allowView(vp))
|
|
178
|
-
continue;
|
|
179
|
-
if (drop || this.agenda.isEmpty)
|
|
180
|
-
vp.dropFeatureOverrideProvider(this);
|
|
181
|
-
else if (!vp.addFeatureOverrideProvider(this))
|
|
182
|
-
vp.setFeatureOverrideProviderChanged();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
get geometryCacheFilter() { return undefined; }
|
|
186
|
-
onGeometryCacheFilterChanged() { this._checkedIds.clear(); }
|
|
187
|
-
async createElementGeometryCache(id) {
|
|
188
|
-
// NOTE: Creates cache if it doesn't already exist then test new or existing cache against filter...
|
|
189
|
-
try {
|
|
190
|
-
this._startedCmd = await this.startCommand();
|
|
191
|
-
return await EditToolIpc_1.solidModelingIpc.createElementGeometryCache(id, this.geometryCacheFilter);
|
|
192
|
-
}
|
|
193
|
-
catch (err) {
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
async acceptElementForOperation(id) {
|
|
198
|
-
if (core_bentley_1.Id64.isInvalid(id) || core_bentley_1.Id64.isTransient(id))
|
|
199
|
-
return false;
|
|
200
|
-
let accept = this._checkedIds.get(id);
|
|
201
|
-
if (undefined === accept) {
|
|
202
|
-
if (this.agenda.isEmpty && this._checkedIds.size > 1000)
|
|
203
|
-
this._checkedIds.clear(); // Limit auto-locate cache size to something reasonable...
|
|
204
|
-
accept = await this.createElementGeometryCache(id);
|
|
205
|
-
this._checkedIds.set(id, accept);
|
|
206
|
-
}
|
|
207
|
-
return accept;
|
|
208
|
-
}
|
|
209
|
-
async isElementValidForOperation(hit, out) {
|
|
210
|
-
if (!await super.isElementValidForOperation(hit, out))
|
|
211
|
-
return false;
|
|
212
|
-
return this.acceptElementForOperation(hit.sourceId);
|
|
213
|
-
}
|
|
214
|
-
async postFilterIds(arg) {
|
|
215
|
-
const ids = [];
|
|
216
|
-
for (const id of core_bentley_1.Id64.iterable(arg)) {
|
|
217
|
-
if (await this.acceptElementForOperation(id))
|
|
218
|
-
ids.push(id);
|
|
219
|
-
}
|
|
220
|
-
return ids;
|
|
221
|
-
}
|
|
222
|
-
async getGroupIds(id) {
|
|
223
|
-
return this.postFilterIds(await super.getGroupIds(id));
|
|
224
|
-
}
|
|
225
|
-
async getSelectionSetCandidates(ss) {
|
|
226
|
-
return this.postFilterIds(await super.getSelectionSetCandidates(ss));
|
|
227
|
-
}
|
|
228
|
-
async getDragSelectCandidates(vp, origin, corner, method, overlap) {
|
|
229
|
-
return this.postFilterIds(await super.getDragSelectCandidates(vp, origin, corner, method, overlap));
|
|
230
|
-
}
|
|
231
|
-
onDynamicFrame(_ev, context) {
|
|
232
|
-
if (undefined === this._graphicsProvider)
|
|
233
|
-
return;
|
|
234
|
-
if (!this.wantAgendaAppearanceOverride)
|
|
235
|
-
return this._graphicsProvider.addGraphic(context);
|
|
236
|
-
const appearanceProvider = core_common_1.FeatureAppearanceProvider.supplement((app) => {
|
|
237
|
-
return app.extendAppearance(this.agendaAppearance(true));
|
|
238
|
-
});
|
|
239
|
-
this._graphicsProvider.addGraphic(context, undefined, { appearanceProvider });
|
|
240
|
-
}
|
|
241
|
-
async onMouseMotion(ev) {
|
|
242
|
-
return this.updateGraphic(ev, core_frontend_1.IModelApp.viewManager.inDynamicsMode);
|
|
243
|
-
}
|
|
244
|
-
async getGraphicData(_ev) { return undefined; }
|
|
245
|
-
async updateGraphic(ev, isDynamics) {
|
|
246
|
-
if (!isDynamics || this._graphicsPending)
|
|
247
|
-
return; // Continue displaying previous graphic if new graphic is still pending...
|
|
248
|
-
this._graphicsPending = true;
|
|
249
|
-
const graphicData = await this.getGraphicData(ev);
|
|
250
|
-
this._graphicsPending = undefined;
|
|
251
|
-
if (undefined !== graphicData) {
|
|
252
|
-
if (this._firstResult) {
|
|
253
|
-
this.updateAgendaAppearanceProvider();
|
|
254
|
-
this._firstResult = false;
|
|
255
|
-
}
|
|
256
|
-
return this.createGraphic(graphicData);
|
|
257
|
-
}
|
|
258
|
-
if (undefined !== this._graphicsProvider)
|
|
259
|
-
this._graphicsProvider.cleanupGraphic();
|
|
260
|
-
}
|
|
261
|
-
async createGraphic(graphicData) {
|
|
262
|
-
if (undefined === this._graphicsProvider)
|
|
263
|
-
this._graphicsProvider = new ElementGeometryGraphicsProvider(this.iModel);
|
|
264
|
-
await this._graphicsProvider.createGraphic(graphicData);
|
|
265
|
-
}
|
|
266
|
-
clearGraphic() {
|
|
267
|
-
if (undefined === this._graphicsProvider)
|
|
268
|
-
return;
|
|
269
|
-
this._graphicsProvider.cleanupGraphic();
|
|
270
|
-
this._graphicsProvider = undefined;
|
|
271
|
-
}
|
|
272
|
-
async clearElementGeometryCache() {
|
|
273
|
-
try {
|
|
274
|
-
this._startedCmd = await this.startCommand();
|
|
275
|
-
await EditToolIpc_1.solidModelingIpc.clearElementGeometryCache();
|
|
276
|
-
}
|
|
277
|
-
catch (err) { }
|
|
278
|
-
}
|
|
279
|
-
async onUnsuspend() {
|
|
280
|
-
if (!this._firstResult)
|
|
281
|
-
this.updateAgendaAppearanceProvider();
|
|
282
|
-
return super.onUnsuspend();
|
|
283
|
-
}
|
|
284
|
-
async onSuspend() {
|
|
285
|
-
if (!this._firstResult)
|
|
286
|
-
this.updateAgendaAppearanceProvider(true);
|
|
287
|
-
return super.onSuspend();
|
|
288
|
-
}
|
|
289
|
-
async onPostInstall() {
|
|
290
|
-
await super.onPostInstall();
|
|
291
|
-
if (this.wantAgendaAppearanceOverride)
|
|
292
|
-
this.agenda.manageHiliteState = false;
|
|
293
|
-
}
|
|
294
|
-
async onCleanup() {
|
|
295
|
-
await super.onCleanup();
|
|
296
|
-
await this.clearElementGeometryCache();
|
|
297
|
-
this.updateAgendaAppearanceProvider(true);
|
|
298
|
-
this.clearGraphic();
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
exports.ElementGeometryCacheTool = ElementGeometryCacheTool;
|
|
302
|
-
/** @alpha Base class for tools that need to locate faces, edges, and vertices. */
|
|
303
|
-
class LocateSubEntityTool extends ElementGeometryCacheTool {
|
|
304
|
-
constructor() {
|
|
305
|
-
super(...arguments);
|
|
306
|
-
this._acceptedSubEntities = [];
|
|
307
|
-
this._summaryIds = new Map();
|
|
308
|
-
}
|
|
309
|
-
provideToolAssistance(mainInstrText, additionalInstr) {
|
|
310
|
-
if (this.wantAdditionalSubEntities) {
|
|
311
|
-
const faceKey = this.wantSubEntityType(editor_common_1.SubEntityType.Face) ? "Face" : "";
|
|
312
|
-
const edgeKey = this.wantSubEntityType(editor_common_1.SubEntityType.Edge) ? "Edge" : "";
|
|
313
|
-
const vertexKey = this.wantSubEntityType(editor_common_1.SubEntityType.Vertex) ? "Vertex" : "";
|
|
314
|
-
const subEntityKey = `${faceKey}${edgeKey}${vertexKey}`;
|
|
315
|
-
if (0 === subEntityKey.length) {
|
|
316
|
-
super.provideToolAssistance(mainInstrText, additionalInstr);
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
if (undefined === mainInstrText)
|
|
320
|
-
mainInstrText = EditTool_1.EditTools.translate(`LocateSubEntities.Identify.${subEntityKey}`);
|
|
321
|
-
const leftMsg = EditTool_1.EditTools.translate(`LocateSubEntities.Accept.${subEntityKey}`);
|
|
322
|
-
const rightMsg = this.haveAcceptedSubEntities && this.allowSubEntitySelectNext ? EditTool_1.EditTools.translate(`LocateSubEntities.AcceptNext.${subEntityKey}`) : core_frontend_1.CoreTools.translate("ElementSet.Inputs.Cancel");
|
|
323
|
-
const mouseInstructions = [];
|
|
324
|
-
const touchInstructions = [];
|
|
325
|
-
if (!core_frontend_1.ToolAssistance.createTouchCursorInstructions(touchInstructions))
|
|
326
|
-
touchInstructions.push(core_frontend_1.ToolAssistance.createInstruction(core_frontend_1.ToolAssistanceImage.OneTouchTap, leftMsg, false, core_frontend_1.ToolAssistanceInputMethod.Touch));
|
|
327
|
-
mouseInstructions.push(core_frontend_1.ToolAssistance.createInstruction(core_frontend_1.ToolAssistanceImage.LeftClick, leftMsg, false, core_frontend_1.ToolAssistanceInputMethod.Mouse));
|
|
328
|
-
touchInstructions.push(core_frontend_1.ToolAssistance.createInstruction(core_frontend_1.ToolAssistanceImage.TwoTouchTap, rightMsg, false, core_frontend_1.ToolAssistanceInputMethod.Touch));
|
|
329
|
-
mouseInstructions.push(core_frontend_1.ToolAssistance.createInstruction(core_frontend_1.ToolAssistanceImage.RightClick, rightMsg, false, core_frontend_1.ToolAssistanceInputMethod.Mouse));
|
|
330
|
-
if (this.allowSubEntityControlSelect)
|
|
331
|
-
mouseInstructions.push(core_frontend_1.ToolAssistance.createModifierKeyInstruction(core_frontend_1.ToolAssistance.ctrlKey, core_frontend_1.ToolAssistanceImage.LeftClickDrag, EditTool_1.EditTools.translate(`LocateSubEntities.IdentifyAdditional.${subEntityKey}`), false, core_frontend_1.ToolAssistanceInputMethod.Mouse));
|
|
332
|
-
if (undefined !== additionalInstr) {
|
|
333
|
-
for (const instr of additionalInstr) {
|
|
334
|
-
if (core_frontend_1.ToolAssistanceInputMethod.Touch === instr.inputMethod)
|
|
335
|
-
touchInstructions.push(instr);
|
|
336
|
-
else
|
|
337
|
-
mouseInstructions.push(instr);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
const sections = [];
|
|
341
|
-
sections.push(core_frontend_1.ToolAssistance.createSection(mouseInstructions, core_frontend_1.ToolAssistance.inputsLabel));
|
|
342
|
-
sections.push(core_frontend_1.ToolAssistance.createSection(touchInstructions, core_frontend_1.ToolAssistance.inputsLabel));
|
|
343
|
-
const mainInstruction = core_frontend_1.ToolAssistance.createInstruction(this.iconSpec, mainInstrText);
|
|
344
|
-
const instructions = core_frontend_1.ToolAssistance.createInstructions(mainInstruction, sections);
|
|
345
|
-
core_frontend_1.IModelApp.notifications.setToolAssistance(instructions);
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
super.provideToolAssistance(mainInstrText, additionalInstr);
|
|
349
|
-
}
|
|
350
|
-
get wantAgendaAppearanceOverride() { return true; }
|
|
351
|
-
get wantGeometrySummary() { return false; }
|
|
352
|
-
get wantSubEntitySnap() { return false; }
|
|
353
|
-
wantSubEntityType(type) { return editor_common_1.SubEntityType.Face === type; }
|
|
354
|
-
getMaximumSubEntityHits(type) { return this.wantSubEntityType(type) ? 25 : 0; }
|
|
355
|
-
get requiredSubEntityCount() { return 1; }
|
|
356
|
-
get haveAcceptedSubEntities() { return (0 !== this._acceptedSubEntities.length); }
|
|
357
|
-
get inhibitSubEntityDisplay() { return this.isDynamicsStarted; }
|
|
358
|
-
get allowSubEntityControlSelect() { return true; }
|
|
359
|
-
get allowSubEntityControlDeselect() { return this.allowSubEntityControlSelect; }
|
|
360
|
-
get allowSubEntitySelectNext() { return !this.isDynamicsStarted; }
|
|
361
|
-
getBRepEntityTypeForSubEntity(id, subEntity) {
|
|
362
|
-
const summary = this._summaryIds.get(id);
|
|
363
|
-
if (undefined === summary)
|
|
364
|
-
return editor_common_1.BRepEntityType.Invalid;
|
|
365
|
-
const index = (undefined !== subEntity.index ? subEntity.index : 0);
|
|
366
|
-
if (index >= summary.length)
|
|
367
|
-
return editor_common_1.BRepEntityType.Invalid;
|
|
368
|
-
return summary[index];
|
|
369
|
-
}
|
|
370
|
-
async createElementGeometrySummary(id) {
|
|
371
|
-
let summary = this._summaryIds.get(id);
|
|
372
|
-
if (undefined === summary) {
|
|
373
|
-
if (this.agenda.isEmpty && this._summaryIds.size > 1000)
|
|
374
|
-
this._summaryIds.clear(); // Limit auto-locate cache size to something reasonable...
|
|
375
|
-
try {
|
|
376
|
-
this._startedCmd = await this.startCommand();
|
|
377
|
-
if (undefined === (summary = await EditToolIpc_1.solidModelingIpc.summarizeElementGeometryCache(id)))
|
|
378
|
-
return false;
|
|
379
|
-
}
|
|
380
|
-
catch (err) {
|
|
381
|
-
return false;
|
|
382
|
-
}
|
|
383
|
-
this._summaryIds.set(id, summary);
|
|
384
|
-
}
|
|
385
|
-
return true;
|
|
386
|
-
}
|
|
387
|
-
async createElementGeometryCache(id) {
|
|
388
|
-
const accept = await super.createElementGeometryCache(id);
|
|
389
|
-
return (accept && this.wantGeometrySummary ? this.createElementGeometrySummary(id) : accept);
|
|
390
|
-
}
|
|
391
|
-
getAcceptedSubEntityData(index = -1) {
|
|
392
|
-
if (-1 === index)
|
|
393
|
-
index = this._acceptedSubEntities.length - 1;
|
|
394
|
-
if (index < 0 || index > this._acceptedSubEntities.length - 1)
|
|
395
|
-
return undefined;
|
|
396
|
-
return this._acceptedSubEntities[index];
|
|
397
|
-
}
|
|
398
|
-
getAcceptedSubEntities() {
|
|
399
|
-
const accepted = [];
|
|
400
|
-
this._acceptedSubEntities.forEach((entry) => accepted.push(entry.props));
|
|
401
|
-
return accepted;
|
|
402
|
-
}
|
|
403
|
-
drawSubEntity(context, subEntity, accepted) {
|
|
404
|
-
subEntity.display(context, accepted);
|
|
405
|
-
}
|
|
406
|
-
drawAcceptedSubEntities(context) {
|
|
407
|
-
this._acceptedSubEntities.forEach((entry) => this.drawSubEntity(context, entry, true));
|
|
408
|
-
}
|
|
409
|
-
decorate(context) {
|
|
410
|
-
if (this.inhibitSubEntityDisplay || !this.allowView(context.viewport))
|
|
411
|
-
return;
|
|
412
|
-
if (this.haveAcceptedSubEntities)
|
|
413
|
-
this.drawAcceptedSubEntities(context);
|
|
414
|
-
if (undefined !== this._currentSubEntity)
|
|
415
|
-
this.drawSubEntity(context, this._currentSubEntity, false);
|
|
416
|
-
}
|
|
417
|
-
decorateSuspended(context) {
|
|
418
|
-
if (this.inhibitSubEntityDisplay || !this.allowView(context.viewport))
|
|
419
|
-
return;
|
|
420
|
-
if (this.haveAcceptedSubEntities)
|
|
421
|
-
this.drawAcceptedSubEntities(context);
|
|
422
|
-
}
|
|
423
|
-
getLocateAperture(ev) {
|
|
424
|
-
if (undefined === ev.viewport)
|
|
425
|
-
return 0.0;
|
|
426
|
-
return ev.viewport.pixelsFromInches(core_frontend_1.InputSource.Touch === ev.inputSource ? core_frontend_1.IModelApp.locateManager.touchApertureInches : core_frontend_1.IModelApp.locateManager.apertureInches);
|
|
427
|
-
}
|
|
428
|
-
getMaxRayDistance(ev, aperture) {
|
|
429
|
-
if (undefined === ev.viewport)
|
|
430
|
-
return 0.0;
|
|
431
|
-
// NOTE: Compute a world coordinate radius for ray test, try getting aperture size at point on element...
|
|
432
|
-
const hit = core_frontend_1.IModelApp.accuSnap.currHit;
|
|
433
|
-
const vec = [];
|
|
434
|
-
vec[0] = ev.viewport.worldToView(hit ? hit.hitPoint : ev.point);
|
|
435
|
-
vec[1] = vec[0].clone();
|
|
436
|
-
vec[1].x += 1;
|
|
437
|
-
ev.viewport.viewToWorldArray(vec);
|
|
438
|
-
// The edge and vertex hits get post-filtered on xy distance, so this is fine for perspective views...
|
|
439
|
-
return (aperture * vec[0].distance(vec[1]));
|
|
440
|
-
}
|
|
441
|
-
getRayOrigin(ev) {
|
|
442
|
-
const spacePoint = ev.point.clone();
|
|
443
|
-
const vp = ev.viewport;
|
|
444
|
-
if (undefined === vp)
|
|
445
|
-
return spacePoint;
|
|
446
|
-
vp.worldToNpc(spacePoint, spacePoint);
|
|
447
|
-
spacePoint.z = 1.0;
|
|
448
|
-
vp.npcToWorld(spacePoint, spacePoint);
|
|
449
|
-
return spacePoint;
|
|
450
|
-
}
|
|
451
|
-
wantHiddenEdges(vp) {
|
|
452
|
-
return vp.viewFlags.hiddenEdgesVisible();
|
|
453
|
-
}
|
|
454
|
-
getSubEntityFilter() { return undefined; }
|
|
455
|
-
async pickSubEntities(id, boresite, maxFace, maxEdge, maxVertex, maxDistance, hiddenEdgesVisible, filter) {
|
|
456
|
-
try {
|
|
457
|
-
this._startedCmd = await this.startCommand();
|
|
458
|
-
const opts = {
|
|
459
|
-
maxFace,
|
|
460
|
-
maxEdge,
|
|
461
|
-
maxVertex,
|
|
462
|
-
maxDistance,
|
|
463
|
-
hiddenEdgesVisible,
|
|
464
|
-
filter,
|
|
465
|
-
};
|
|
466
|
-
return await EditToolIpc_1.solidModelingIpc.locateSubEntities(id, boresite.origin, boresite.direction, opts);
|
|
467
|
-
}
|
|
468
|
-
catch (err) {
|
|
469
|
-
return undefined;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
async doPickSubEntities(id, ev) {
|
|
473
|
-
const vp = ev.viewport;
|
|
474
|
-
if (undefined === vp)
|
|
475
|
-
return undefined;
|
|
476
|
-
const maxFace = this.getMaximumSubEntityHits(editor_common_1.SubEntityType.Face);
|
|
477
|
-
const maxEdge = this.getMaximumSubEntityHits(editor_common_1.SubEntityType.Edge);
|
|
478
|
-
const maxVertex = this.getMaximumSubEntityHits(editor_common_1.SubEntityType.Vertex);
|
|
479
|
-
if (0 === maxFace && 0 === maxEdge && 0 === maxVertex)
|
|
480
|
-
return undefined;
|
|
481
|
-
const aperture = this.getLocateAperture(ev);
|
|
482
|
-
const maxDistance = this.getMaxRayDistance(ev, aperture);
|
|
483
|
-
const spacePoint = this.getRayOrigin(ev);
|
|
484
|
-
const boresite = core_frontend_1.AccuDrawHintBuilder.getBoresite(spacePoint, vp);
|
|
485
|
-
const hiddenEdgesVisible = this.wantHiddenEdges(vp);
|
|
486
|
-
const filter = this.getSubEntityFilter();
|
|
487
|
-
let hits = await this.pickSubEntities(id, boresite, maxFace, maxEdge, maxVertex, maxDistance, hiddenEdgesVisible, filter);
|
|
488
|
-
// NOTE: Remove erroneous edge/vertex hits in perspective views by checking real xy distance to hit point...
|
|
489
|
-
if (undefined === hits || !vp.isCameraOn)
|
|
490
|
-
return hits;
|
|
491
|
-
if (maxEdge > 0 && hits.length > 1) {
|
|
492
|
-
const edgeApertureSquared = (aperture * aperture);
|
|
493
|
-
const vertexApertureSquared = ((aperture * 2.0) * (aperture * 2.0));
|
|
494
|
-
const e2 = Math.pow(aperture, 2);
|
|
495
|
-
const v2 = Math.pow(aperture * 2.0, 2);
|
|
496
|
-
if (e2 !== edgeApertureSquared || v2 !== vertexApertureSquared)
|
|
497
|
-
return hits;
|
|
498
|
-
const rayOrigin = vp.worldToView(boresite.origin);
|
|
499
|
-
hits = hits.filter((hit) => {
|
|
500
|
-
if (editor_common_1.SubEntityType.Face === hit.subEntity.type)
|
|
501
|
-
return true;
|
|
502
|
-
const hitPoint = vp.worldToView(core_geometry_1.Point3d.fromJSON(hit.point));
|
|
503
|
-
const distance = hitPoint.distanceSquaredXY(rayOrigin);
|
|
504
|
-
return (distance <= (editor_common_1.SubEntityType.Edge === hit.subEntity.type ? edgeApertureSquared : vertexApertureSquared));
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
return hits;
|
|
508
|
-
}
|
|
509
|
-
async createSubEntityData(id, hit) {
|
|
510
|
-
const data = new SubEntityData(hit.subEntity);
|
|
511
|
-
const chordTolerance = (this.targetView ? (0, CreateElementTool_1.computeChordToleranceFromPoint)(this.targetView, core_geometry_1.Point3d.fromJSON(hit.point)) : undefined);
|
|
512
|
-
await this.createSubEntityGraphic(id, data, chordTolerance);
|
|
513
|
-
return data;
|
|
514
|
-
}
|
|
515
|
-
/** Append specified sub-entity to accepted array. */
|
|
516
|
-
async addSubEntity(id, props) {
|
|
517
|
-
this._acceptedSubEntities.push(await this.createSubEntityData(id, props));
|
|
518
|
-
}
|
|
519
|
-
/** Remove specified sub-entity from accepted array, or pop last sub-entity if undefined. */
|
|
520
|
-
async removeSubEntity(_id, props) {
|
|
521
|
-
if (undefined !== props)
|
|
522
|
-
this._acceptedSubEntities = this._acceptedSubEntities.filter((entry) => !isSameSubEntity(entry.props, props.subEntity));
|
|
523
|
-
else
|
|
524
|
-
this._acceptedSubEntities.pop();
|
|
525
|
-
}
|
|
526
|
-
/** Locate sub-entities for the most recently added (last) agenda entry. Tool sub-classes that wish to identity
|
|
527
|
-
* sub-entities from multiple elements are responsible for maintaining the sub-entities per-element.
|
|
528
|
-
*/
|
|
529
|
-
async doLocateSubEntity(ev, newSearch) {
|
|
530
|
-
if (this.agenda.isEmpty || undefined === ev.viewport)
|
|
531
|
-
return false;
|
|
532
|
-
const id = this.agenda.elements[this.agenda.length - 1];
|
|
533
|
-
if (newSearch) {
|
|
534
|
-
this._locatedSubEntities = await this.doPickSubEntities(id, ev);
|
|
535
|
-
if (undefined === this._locatedSubEntities || 0 === this._locatedSubEntities.length)
|
|
536
|
-
return false;
|
|
537
|
-
/** NOTE: Set last button location to point on sub-entity when not snapping.
|
|
538
|
-
* If dynamics are enabled on this event, onDynamicFrame is called with this location.
|
|
539
|
-
*/
|
|
540
|
-
if (core_frontend_1.CoordSource.ElemSnap !== ev.coordsFrom) {
|
|
541
|
-
ev.point.setFrom(core_geometry_1.Point3d.fromJSON(this._locatedSubEntities[0].point));
|
|
542
|
-
core_frontend_1.IModelApp.toolAdmin.setAdjustedDataPoint(ev);
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
await this.removeSubEntity(id);
|
|
547
|
-
}
|
|
548
|
-
const hit = this._locatedSubEntities?.shift();
|
|
549
|
-
if (undefined !== hit) {
|
|
550
|
-
if (undefined === this._acceptedSubEntities.find((entry) => isSameSubEntity(entry.props, hit.subEntity)))
|
|
551
|
-
await this.addSubEntity(id, hit);
|
|
552
|
-
else if (this.allowSubEntityControlDeselect)
|
|
553
|
-
await this.removeSubEntity(id, hit);
|
|
554
|
-
}
|
|
555
|
-
core_frontend_1.IModelApp.viewManager.invalidateDecorationsAllViews();
|
|
556
|
-
return true;
|
|
557
|
-
}
|
|
558
|
-
async chooseNextHit(ev) {
|
|
559
|
-
if (!this.haveAcceptedSubEntities)
|
|
560
|
-
return super.chooseNextHit(ev);
|
|
561
|
-
if (!this.allowSubEntitySelectNext) {
|
|
562
|
-
await this.onReinitialize(); // Don't cycle through hits after starting dynamics...
|
|
563
|
-
}
|
|
564
|
-
else {
|
|
565
|
-
await this.doLocateSubEntity(ev, false);
|
|
566
|
-
if (!this.haveAcceptedSubEntities)
|
|
567
|
-
await this.onReinitialize();
|
|
568
|
-
}
|
|
569
|
-
return core_frontend_1.EventHandled.No;
|
|
570
|
-
}
|
|
571
|
-
get wantAdditionalSubEntities() {
|
|
572
|
-
return (this._acceptedSubEntities.length < this.requiredSubEntityCount || (this.allowSubEntityControlSelect && this.isControlDown));
|
|
573
|
-
}
|
|
574
|
-
async gatherInput(ev) {
|
|
575
|
-
if (this.wantAdditionalSubEntities) {
|
|
576
|
-
await this.doLocateSubEntity(ev, true);
|
|
577
|
-
if (this.wantAdditionalSubEntities) {
|
|
578
|
-
this.setupAndPromptForNextAction();
|
|
579
|
-
return core_frontend_1.EventHandled.No;
|
|
580
|
-
}
|
|
581
|
-
this.clearCurrentSubEntity();
|
|
582
|
-
}
|
|
583
|
-
return super.gatherInput(ev);
|
|
584
|
-
}
|
|
585
|
-
getCurrentElement() {
|
|
586
|
-
if (!this.agenda.isEmpty)
|
|
587
|
-
return this.agenda.elements[this.agenda.length - 1];
|
|
588
|
-
const hit = core_frontend_1.IModelApp.accuSnap.currHit;
|
|
589
|
-
return (undefined !== hit && hit.isElementHit ? hit.sourceId : undefined);
|
|
590
|
-
}
|
|
591
|
-
clearCurrentSubEntity() {
|
|
592
|
-
if (undefined === this._currentSubEntity)
|
|
593
|
-
return;
|
|
594
|
-
this._currentSubEntity.cleanupGraphic();
|
|
595
|
-
this._currentSubEntity = undefined;
|
|
596
|
-
}
|
|
597
|
-
async setCurrentSubEntity(id, hit, chordTolerance) {
|
|
598
|
-
if (undefined === this._currentSubEntity)
|
|
599
|
-
this._currentSubEntity = new SubEntityData(hit.subEntity);
|
|
600
|
-
else
|
|
601
|
-
this._currentSubEntity.props = hit.subEntity;
|
|
602
|
-
return this.createSubEntityGraphic(id, this._currentSubEntity, chordTolerance);
|
|
603
|
-
}
|
|
604
|
-
async changeCurrentSubEntity(id, current, chordTolerance) {
|
|
605
|
-
if (undefined === id || undefined === current) {
|
|
606
|
-
if (undefined === this._currentSubEntity || !this._currentSubEntity.hasGraphic)
|
|
607
|
-
return false;
|
|
608
|
-
this._currentSubEntity.cleanupGraphic();
|
|
609
|
-
return true;
|
|
610
|
-
}
|
|
611
|
-
if (undefined !== this._currentSubEntity && this._currentSubEntity.hasGraphic && this._currentSubEntity.isSame(current.subEntity))
|
|
612
|
-
return false;
|
|
613
|
-
return this.setCurrentSubEntity(id, current, chordTolerance);
|
|
614
|
-
}
|
|
615
|
-
async updateCurrentSubEntity(ev) {
|
|
616
|
-
if (undefined === ev.viewport)
|
|
617
|
-
return false;
|
|
618
|
-
const id = this.wantAdditionalSubEntities ? this.getCurrentElement() : undefined;
|
|
619
|
-
if (undefined === id)
|
|
620
|
-
return this.changeCurrentSubEntity();
|
|
621
|
-
if (this._subEntityGraphicPending)
|
|
622
|
-
return false;
|
|
623
|
-
this._subEntityGraphicPending = true;
|
|
624
|
-
const current = await this.doPickSubEntities(id, ev);
|
|
625
|
-
const chordTolerance = current ? (0, CreateElementTool_1.computeChordToleranceFromPoint)(ev.viewport, core_geometry_1.Point3d.fromJSON(current[0].point)) : 0.0;
|
|
626
|
-
const status = await this.changeCurrentSubEntity(id, current ? current[0] : undefined, chordTolerance);
|
|
627
|
-
this._subEntityGraphicPending = undefined;
|
|
628
|
-
if (status)
|
|
629
|
-
core_frontend_1.IModelApp.viewManager.invalidateDecorationsAllViews();
|
|
630
|
-
return status;
|
|
631
|
-
}
|
|
632
|
-
async createSubEntityGraphic(id, data, chordTolerance) {
|
|
633
|
-
try {
|
|
634
|
-
const opts = {
|
|
635
|
-
wantGraphic: true,
|
|
636
|
-
wantRange: true,
|
|
637
|
-
wantAppearance: true,
|
|
638
|
-
chordTolerance,
|
|
639
|
-
};
|
|
640
|
-
data.chordTolerance = chordTolerance;
|
|
641
|
-
data.geometry = await EditToolIpc_1.solidModelingIpc.getSubEntityGeometry(id, data.props, opts);
|
|
642
|
-
return await data.createGraphic(this.iModel);
|
|
643
|
-
}
|
|
644
|
-
catch (err) {
|
|
645
|
-
return false;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
async updateGraphic(ev, isDynamics) {
|
|
649
|
-
if (isDynamics)
|
|
650
|
-
return super.updateGraphic(ev, isDynamics);
|
|
651
|
-
await this.updateCurrentSubEntity(ev);
|
|
652
|
-
}
|
|
653
|
-
async getGraphicData(ev) {
|
|
654
|
-
const result = await this.applyAgendaOperation(ev, false);
|
|
655
|
-
return result?.graphic;
|
|
656
|
-
}
|
|
657
|
-
async applyAgendaOperation(_ev, _isAccept) { return undefined; }
|
|
658
|
-
async processAgenda(ev) {
|
|
659
|
-
const result = await this.applyAgendaOperation(ev, true);
|
|
660
|
-
if (result?.elementId)
|
|
661
|
-
await this.saveChanges();
|
|
662
|
-
}
|
|
663
|
-
async onModifierKeyTransition(wentDown, modifier, event) {
|
|
664
|
-
if (core_frontend_1.EventHandled.Yes === await super.onModifierKeyTransition(wentDown, modifier, event))
|
|
665
|
-
return core_frontend_1.EventHandled.Yes;
|
|
666
|
-
if (core_frontend_1.BeModifierKeys.Control !== modifier)
|
|
667
|
-
return core_frontend_1.EventHandled.No;
|
|
668
|
-
if (core_frontend_1.IModelApp.toolAdmin.isLocateCircleOn === this.wantAdditionalSubEntities)
|
|
669
|
-
return core_frontend_1.EventHandled.No;
|
|
670
|
-
this.setupAndPromptForNextAction();
|
|
671
|
-
return core_frontend_1.EventHandled.Yes;
|
|
672
|
-
}
|
|
673
|
-
changeLocateState(enableLocate, enableSnap, cursor, coordLockOvr) {
|
|
674
|
-
super.changeLocateState(enableLocate, enableSnap, cursor, coordLockOvr);
|
|
675
|
-
// Keep showing locate circle when identifying sub-entities even if done locating elements...
|
|
676
|
-
if (!core_frontend_1.IModelApp.toolAdmin.isLocateCircleOn && this.wantAdditionalSubEntities)
|
|
677
|
-
core_frontend_1.IModelApp.toolAdmin.setLocateCircleOn(true);
|
|
678
|
-
}
|
|
679
|
-
get shouldEnableSnap() {
|
|
680
|
-
if (this.isSelectByPoints || !this.wantAccuSnap)
|
|
681
|
-
return false;
|
|
682
|
-
if (this.isDynamicsStarted)
|
|
683
|
-
return true;
|
|
684
|
-
const isCtrlSelect = (this.isControlDown && (this.controlKeyContinuesSelection || this.allowSubEntityControlSelect));
|
|
685
|
-
if (isCtrlSelect || this.wantAdditionalElements || this.wantAdditionalSubEntities)
|
|
686
|
-
return this.wantSubEntitySnap;
|
|
687
|
-
return !this.wantSubEntitySnap;
|
|
688
|
-
}
|
|
689
|
-
setupAccuDraw() { }
|
|
690
|
-
setupAndPromptForNextAction() {
|
|
691
|
-
this.setupAccuDraw();
|
|
692
|
-
super.setupAndPromptForNextAction();
|
|
693
|
-
}
|
|
694
|
-
clearSubEntityGraphics() {
|
|
695
|
-
if (undefined !== this._currentSubEntity)
|
|
696
|
-
this._currentSubEntity.cleanupGraphic();
|
|
697
|
-
this._acceptedSubEntities.forEach((entry) => entry.cleanupGraphic());
|
|
698
|
-
}
|
|
699
|
-
async onCleanup() {
|
|
700
|
-
this.clearSubEntityGraphics();
|
|
701
|
-
return super.onCleanup();
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
exports.LocateSubEntityTool = LocateSubEntityTool;
|
|
705
|
-
//# sourceMappingURL=ElementGeometryTool.js.map
|