@itwin/editor-frontend 4.0.0-dev.51 → 4.0.0-dev.54
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/CreateElementTool.d.ts +100 -100
- package/lib/cjs/CreateElementTool.js +325 -325
- package/lib/cjs/DeleteElementsTool.d.ts +13 -13
- package/lib/cjs/DeleteElementsTool.js +38 -38
- package/lib/cjs/DeleteElementsTool.js.map +1 -1
- package/lib/cjs/EditTool.d.ts +38 -38
- package/lib/cjs/EditTool.js +80 -80
- package/lib/cjs/EditTool.js.map +1 -1
- package/lib/cjs/EditToolIpc.d.ts +18 -18
- package/lib/cjs/EditToolIpc.js +28 -28
- package/lib/cjs/ElementGeometryTool.d.ts +147 -147
- package/lib/cjs/ElementGeometryTool.js +704 -704
- package/lib/cjs/ModifyCurveTools.d.ts +139 -139
- package/lib/cjs/ModifyCurveTools.js +776 -776
- package/lib/cjs/ModifyCurveTools.js.map +1 -1
- package/lib/cjs/ModifyElementTool.d.ts +47 -47
- package/lib/cjs/ModifyElementTool.js +177 -177
- package/lib/cjs/ProjectLocation/ProjectExtentsDecoration.d.ts +135 -135
- package/lib/cjs/ProjectLocation/ProjectExtentsDecoration.js +822 -822
- package/lib/cjs/ProjectLocation/ProjectExtentsDecoration.js.map +1 -1
- package/lib/cjs/ProjectLocation/ProjectGeolocation.d.ts +135 -135
- package/lib/cjs/ProjectLocation/ProjectGeolocation.js +532 -532
- package/lib/cjs/ProjectLocation/ProjectGeolocation.js.map +1 -1
- package/lib/cjs/SketchTools.d.ts +304 -304
- package/lib/cjs/SketchTools.js +1704 -1704
- package/lib/cjs/SketchTools.js.map +1 -1
- package/lib/cjs/SolidModelingTools.d.ts +380 -380
- package/lib/cjs/SolidModelingTools.js +1452 -1452
- package/lib/cjs/SolidModelingTools.js.map +1 -1
- package/lib/cjs/SolidPrimitiveTools.d.ts +318 -318
- package/lib/cjs/SolidPrimitiveTools.js +1372 -1372
- package/lib/cjs/SolidPrimitiveTools.js.map +1 -1
- package/lib/cjs/TransformElementsTool.d.ts +164 -164
- package/lib/cjs/TransformElementsTool.js +652 -652
- package/lib/cjs/TransformElementsTool.js.map +1 -1
- package/lib/cjs/UndoRedoTool.d.ts +16 -16
- package/lib/cjs/UndoRedoTool.js +41 -41
- package/lib/cjs/UndoRedoTool.js.map +1 -1
- package/lib/cjs/editor-frontend.d.ts +17 -17
- package/lib/cjs/editor-frontend.js +37 -33
- package/lib/cjs/editor-frontend.js.map +1 -1
- package/lib/esm/CreateElementTool.d.ts +100 -100
- package/lib/esm/CreateElementTool.js +317 -317
- package/lib/esm/DeleteElementsTool.d.ts +13 -13
- package/lib/esm/DeleteElementsTool.js +35 -34
- package/lib/esm/DeleteElementsTool.js.map +1 -1
- package/lib/esm/EditTool.d.ts +38 -38
- package/lib/esm/EditTool.js +77 -76
- package/lib/esm/EditTool.js.map +1 -1
- package/lib/esm/EditToolIpc.d.ts +18 -18
- package/lib/esm/EditToolIpc.js +24 -24
- package/lib/esm/ElementGeometryTool.d.ts +147 -147
- package/lib/esm/ElementGeometryTool.js +696 -696
- package/lib/esm/ModifyCurveTools.d.ts +139 -139
- package/lib/esm/ModifyCurveTools.js +771 -767
- package/lib/esm/ModifyCurveTools.js.map +1 -1
- package/lib/esm/ModifyElementTool.d.ts +47 -47
- package/lib/esm/ModifyElementTool.js +172 -172
- package/lib/esm/ProjectLocation/ProjectExtentsDecoration.d.ts +135 -135
- package/lib/esm/ProjectLocation/ProjectExtentsDecoration.js +818 -814
- package/lib/esm/ProjectLocation/ProjectExtentsDecoration.js.map +1 -1
- package/lib/esm/ProjectLocation/ProjectGeolocation.d.ts +135 -135
- package/lib/esm/ProjectLocation/ProjectGeolocation.js +529 -526
- package/lib/esm/ProjectLocation/ProjectGeolocation.js.map +1 -1
- package/lib/esm/SketchTools.d.ts +304 -304
- package/lib/esm/SketchTools.js +1700 -1694
- package/lib/esm/SketchTools.js.map +1 -1
- package/lib/esm/SolidModelingTools.d.ts +380 -380
- package/lib/esm/SolidModelingTools.js +1444 -1427
- package/lib/esm/SolidModelingTools.js.map +1 -1
- package/lib/esm/SolidPrimitiveTools.d.ts +318 -318
- package/lib/esm/SolidPrimitiveTools.js +1368 -1361
- package/lib/esm/SolidPrimitiveTools.js.map +1 -1
- package/lib/esm/TransformElementsTool.d.ts +164 -164
- package/lib/esm/TransformElementsTool.js +647 -644
- package/lib/esm/TransformElementsTool.js.map +1 -1
- package/lib/esm/UndoRedoTool.d.ts +16 -16
- package/lib/esm/UndoRedoTool.js +38 -35
- package/lib/esm/UndoRedoTool.js.map +1 -1
- package/lib/esm/editor-frontend.d.ts +17 -17
- package/lib/esm/editor-frontend.js +21 -21
- package/package.json +16 -16
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ModifyElementWithDynamicsTool = exports.ModifyElementTool = void 0;
|
|
4
|
-
/*---------------------------------------------------------------------------------------------
|
|
5
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
-
*--------------------------------------------------------------------------------------------*/
|
|
8
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
9
|
-
const core_common_1 = require("@itwin/core-common");
|
|
10
|
-
const core_frontend_1 = require("@itwin/core-frontend");
|
|
11
|
-
const CreateElementTool_1 = require("./CreateElementTool");
|
|
12
|
-
/** @alpha Edit tool base class for updating existing elements. */
|
|
13
|
-
class ModifyElementTool extends core_frontend_1.ElementSetTool {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this._checkedIds = new Map();
|
|
17
|
-
}
|
|
18
|
-
allowView(_vp) { return true; }
|
|
19
|
-
isCompatibleViewport(vp, isSelectedViewChange) { return (super.isCompatibleViewport(vp, isSelectedViewChange) && undefined !== vp && this.allowView(vp)); }
|
|
20
|
-
onGeometryFilterChanged() { this._checkedIds.clear(); }
|
|
21
|
-
async doAcceptElementForOperation(_id) { return false; }
|
|
22
|
-
async acceptElementForOperation(id) {
|
|
23
|
-
if (core_bentley_1.Id64.isInvalid(id) || core_bentley_1.Id64.isTransient(id))
|
|
24
|
-
return false;
|
|
25
|
-
let accept = this._checkedIds.get(id);
|
|
26
|
-
if (undefined === accept) {
|
|
27
|
-
if (this.agenda.isEmpty && this._checkedIds.size > 1000)
|
|
28
|
-
this._checkedIds.clear(); // Limit auto-locate cache size to something reasonable...
|
|
29
|
-
accept = await this.doAcceptElementForOperation(id);
|
|
30
|
-
this._checkedIds.set(id, accept);
|
|
31
|
-
}
|
|
32
|
-
return accept;
|
|
33
|
-
}
|
|
34
|
-
async isElementValidForOperation(hit, out) {
|
|
35
|
-
if (!await super.isElementValidForOperation(hit, out))
|
|
36
|
-
return false;
|
|
37
|
-
return this.acceptElementForOperation(hit.sourceId);
|
|
38
|
-
}
|
|
39
|
-
async postFilterIds(arg) {
|
|
40
|
-
const ids = [];
|
|
41
|
-
for (const id of core_bentley_1.Id64.iterable(arg)) {
|
|
42
|
-
if (await this.acceptElementForOperation(id))
|
|
43
|
-
ids.push(id);
|
|
44
|
-
}
|
|
45
|
-
return ids;
|
|
46
|
-
}
|
|
47
|
-
async getGroupIds(id) {
|
|
48
|
-
return this.postFilterIds(await super.getGroupIds(id));
|
|
49
|
-
}
|
|
50
|
-
async getSelectionSetCandidates(ss) {
|
|
51
|
-
return this.postFilterIds(await super.getSelectionSetCandidates(ss));
|
|
52
|
-
}
|
|
53
|
-
async getDragSelectCandidates(vp, origin, corner, method, overlap) {
|
|
54
|
-
return this.postFilterIds(await super.getDragSelectCandidates(vp, origin, corner, method, overlap));
|
|
55
|
-
}
|
|
56
|
-
setupAccuDraw() { }
|
|
57
|
-
setupAndPromptForNextAction() {
|
|
58
|
-
this.setupAccuDraw();
|
|
59
|
-
super.setupAndPromptForNextAction();
|
|
60
|
-
}
|
|
61
|
-
async doUpdateElement(_props) { return false; }
|
|
62
|
-
async applyAgendaOperation(ev) {
|
|
63
|
-
const geometry = this.getGeometryProps(ev, true);
|
|
64
|
-
if (undefined === geometry)
|
|
65
|
-
return false;
|
|
66
|
-
const elemProps = this.getElementProps(ev);
|
|
67
|
-
if (undefined === elemProps)
|
|
68
|
-
return false;
|
|
69
|
-
if ("flatbuffer" === geometry.format)
|
|
70
|
-
elemProps.elementGeometryBuilderParams = { entryArray: geometry.data };
|
|
71
|
-
else
|
|
72
|
-
elemProps.geom = geometry.data;
|
|
73
|
-
return this.doUpdateElement(elemProps);
|
|
74
|
-
}
|
|
75
|
-
async processAgenda(ev) {
|
|
76
|
-
if (await this.applyAgendaOperation(ev))
|
|
77
|
-
return this.saveChanges();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
exports.ModifyElementTool = ModifyElementTool;
|
|
81
|
-
/** @alpha Edit tool base class for updating existing elements that use dynamics to show intermediate results. */
|
|
82
|
-
class ModifyElementWithDynamicsTool extends ModifyElementTool {
|
|
83
|
-
constructor() {
|
|
84
|
-
super(...arguments);
|
|
85
|
-
this._firstResult = true;
|
|
86
|
-
}
|
|
87
|
-
get wantAccuSnap() { return true; }
|
|
88
|
-
get wantDynamics() { return true; }
|
|
89
|
-
agendaAppearance(isDynamics) {
|
|
90
|
-
if (isDynamics) {
|
|
91
|
-
if (undefined === this._agendaAppearanceDynamic)
|
|
92
|
-
this._agendaAppearanceDynamic = core_common_1.FeatureAppearance.fromTransparency(0.0);
|
|
93
|
-
return this._agendaAppearanceDynamic;
|
|
94
|
-
}
|
|
95
|
-
if (undefined === this._agendaAppearanceDefault)
|
|
96
|
-
this._agendaAppearanceDefault = core_common_1.FeatureAppearance.fromTransparency(0.9);
|
|
97
|
-
return this._agendaAppearanceDefault;
|
|
98
|
-
}
|
|
99
|
-
get wantAgendaAppearanceOverride() { return false; }
|
|
100
|
-
addFeatureOverrides(overrides, _vp) {
|
|
101
|
-
if (this.agenda.isEmpty)
|
|
102
|
-
return;
|
|
103
|
-
const appearance = this.agendaAppearance(false);
|
|
104
|
-
this.agenda.elements.forEach((elementId) => overrides.override({ elementId, appearance }));
|
|
105
|
-
}
|
|
106
|
-
updateAgendaAppearanceProvider(drop) {
|
|
107
|
-
if (!this.wantAgendaAppearanceOverride)
|
|
108
|
-
return;
|
|
109
|
-
for (const vp of core_frontend_1.IModelApp.viewManager) {
|
|
110
|
-
if (!this.allowView(vp))
|
|
111
|
-
continue;
|
|
112
|
-
if (drop || this.agenda.isEmpty)
|
|
113
|
-
vp.dropFeatureOverrideProvider(this);
|
|
114
|
-
else if (!vp.addFeatureOverrideProvider(this))
|
|
115
|
-
vp.setFeatureOverrideProviderChanged();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
clearGraphics() {
|
|
119
|
-
if (undefined === this._graphicsProvider)
|
|
120
|
-
return;
|
|
121
|
-
this._graphicsProvider.cleanupGraphic();
|
|
122
|
-
this._graphicsProvider = undefined;
|
|
123
|
-
}
|
|
124
|
-
async createGraphics(ev) {
|
|
125
|
-
if (!core_frontend_1.IModelApp.viewManager.inDynamicsMode)
|
|
126
|
-
return; // Don't need to create graphic if dynamics aren't yet active...
|
|
127
|
-
const geometry = this.getGeometryProps(ev, false);
|
|
128
|
-
if (undefined === geometry) {
|
|
129
|
-
this.clearGraphics();
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const elemProps = this.getElementProps(ev);
|
|
133
|
-
if (undefined === elemProps?.placement) {
|
|
134
|
-
this.clearGraphics();
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (undefined === this._graphicsProvider) {
|
|
138
|
-
if (this._firstResult) {
|
|
139
|
-
this.updateAgendaAppearanceProvider();
|
|
140
|
-
this._firstResult = false;
|
|
141
|
-
}
|
|
142
|
-
this._graphicsProvider = new CreateElementTool_1.DynamicGraphicsProvider(this.iModel, this.toolId);
|
|
143
|
-
}
|
|
144
|
-
// Set chord tolerance for non-linear/non-planar geometry...
|
|
145
|
-
if (ev.viewport)
|
|
146
|
-
this._graphicsProvider.chordTolerance = (0, CreateElementTool_1.computeChordToleranceFromPoint)(ev.viewport, ev.point);
|
|
147
|
-
await this._graphicsProvider.createGraphic(elemProps.category, elemProps.placement, geometry);
|
|
148
|
-
}
|
|
149
|
-
onDynamicFrame(_ev, context) {
|
|
150
|
-
if (undefined !== this._graphicsProvider)
|
|
151
|
-
this._graphicsProvider.addGraphic(context);
|
|
152
|
-
}
|
|
153
|
-
async onMouseMotion(ev) {
|
|
154
|
-
return this.createGraphics(ev);
|
|
155
|
-
}
|
|
156
|
-
async onUnsuspend() {
|
|
157
|
-
if (!this._firstResult)
|
|
158
|
-
this.updateAgendaAppearanceProvider();
|
|
159
|
-
return super.onUnsuspend();
|
|
160
|
-
}
|
|
161
|
-
async onSuspend() {
|
|
162
|
-
if (!this._firstResult)
|
|
163
|
-
this.updateAgendaAppearanceProvider(true);
|
|
164
|
-
return super.onSuspend();
|
|
165
|
-
}
|
|
166
|
-
async onPostInstall() {
|
|
167
|
-
await super.onPostInstall();
|
|
168
|
-
if (this.wantAgendaAppearanceOverride)
|
|
169
|
-
this.agenda.manageHiliteState = false;
|
|
170
|
-
}
|
|
171
|
-
async onCleanup() {
|
|
172
|
-
this.clearGraphics();
|
|
173
|
-
this.updateAgendaAppearanceProvider(true);
|
|
174
|
-
return super.onCleanup();
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
exports.ModifyElementWithDynamicsTool = ModifyElementWithDynamicsTool;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModifyElementWithDynamicsTool = exports.ModifyElementTool = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
9
|
+
const core_common_1 = require("@itwin/core-common");
|
|
10
|
+
const core_frontend_1 = require("@itwin/core-frontend");
|
|
11
|
+
const CreateElementTool_1 = require("./CreateElementTool");
|
|
12
|
+
/** @alpha Edit tool base class for updating existing elements. */
|
|
13
|
+
class ModifyElementTool extends core_frontend_1.ElementSetTool {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this._checkedIds = new Map();
|
|
17
|
+
}
|
|
18
|
+
allowView(_vp) { return true; }
|
|
19
|
+
isCompatibleViewport(vp, isSelectedViewChange) { return (super.isCompatibleViewport(vp, isSelectedViewChange) && undefined !== vp && this.allowView(vp)); }
|
|
20
|
+
onGeometryFilterChanged() { this._checkedIds.clear(); }
|
|
21
|
+
async doAcceptElementForOperation(_id) { return false; }
|
|
22
|
+
async acceptElementForOperation(id) {
|
|
23
|
+
if (core_bentley_1.Id64.isInvalid(id) || core_bentley_1.Id64.isTransient(id))
|
|
24
|
+
return false;
|
|
25
|
+
let accept = this._checkedIds.get(id);
|
|
26
|
+
if (undefined === accept) {
|
|
27
|
+
if (this.agenda.isEmpty && this._checkedIds.size > 1000)
|
|
28
|
+
this._checkedIds.clear(); // Limit auto-locate cache size to something reasonable...
|
|
29
|
+
accept = await this.doAcceptElementForOperation(id);
|
|
30
|
+
this._checkedIds.set(id, accept);
|
|
31
|
+
}
|
|
32
|
+
return accept;
|
|
33
|
+
}
|
|
34
|
+
async isElementValidForOperation(hit, out) {
|
|
35
|
+
if (!await super.isElementValidForOperation(hit, out))
|
|
36
|
+
return false;
|
|
37
|
+
return this.acceptElementForOperation(hit.sourceId);
|
|
38
|
+
}
|
|
39
|
+
async postFilterIds(arg) {
|
|
40
|
+
const ids = [];
|
|
41
|
+
for (const id of core_bentley_1.Id64.iterable(arg)) {
|
|
42
|
+
if (await this.acceptElementForOperation(id))
|
|
43
|
+
ids.push(id);
|
|
44
|
+
}
|
|
45
|
+
return ids;
|
|
46
|
+
}
|
|
47
|
+
async getGroupIds(id) {
|
|
48
|
+
return this.postFilterIds(await super.getGroupIds(id));
|
|
49
|
+
}
|
|
50
|
+
async getSelectionSetCandidates(ss) {
|
|
51
|
+
return this.postFilterIds(await super.getSelectionSetCandidates(ss));
|
|
52
|
+
}
|
|
53
|
+
async getDragSelectCandidates(vp, origin, corner, method, overlap) {
|
|
54
|
+
return this.postFilterIds(await super.getDragSelectCandidates(vp, origin, corner, method, overlap));
|
|
55
|
+
}
|
|
56
|
+
setupAccuDraw() { }
|
|
57
|
+
setupAndPromptForNextAction() {
|
|
58
|
+
this.setupAccuDraw();
|
|
59
|
+
super.setupAndPromptForNextAction();
|
|
60
|
+
}
|
|
61
|
+
async doUpdateElement(_props) { return false; }
|
|
62
|
+
async applyAgendaOperation(ev) {
|
|
63
|
+
const geometry = this.getGeometryProps(ev, true);
|
|
64
|
+
if (undefined === geometry)
|
|
65
|
+
return false;
|
|
66
|
+
const elemProps = this.getElementProps(ev);
|
|
67
|
+
if (undefined === elemProps)
|
|
68
|
+
return false;
|
|
69
|
+
if ("flatbuffer" === geometry.format)
|
|
70
|
+
elemProps.elementGeometryBuilderParams = { entryArray: geometry.data };
|
|
71
|
+
else
|
|
72
|
+
elemProps.geom = geometry.data;
|
|
73
|
+
return this.doUpdateElement(elemProps);
|
|
74
|
+
}
|
|
75
|
+
async processAgenda(ev) {
|
|
76
|
+
if (await this.applyAgendaOperation(ev))
|
|
77
|
+
return this.saveChanges();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.ModifyElementTool = ModifyElementTool;
|
|
81
|
+
/** @alpha Edit tool base class for updating existing elements that use dynamics to show intermediate results. */
|
|
82
|
+
class ModifyElementWithDynamicsTool extends ModifyElementTool {
|
|
83
|
+
constructor() {
|
|
84
|
+
super(...arguments);
|
|
85
|
+
this._firstResult = true;
|
|
86
|
+
}
|
|
87
|
+
get wantAccuSnap() { return true; }
|
|
88
|
+
get wantDynamics() { return true; }
|
|
89
|
+
agendaAppearance(isDynamics) {
|
|
90
|
+
if (isDynamics) {
|
|
91
|
+
if (undefined === this._agendaAppearanceDynamic)
|
|
92
|
+
this._agendaAppearanceDynamic = core_common_1.FeatureAppearance.fromTransparency(0.0);
|
|
93
|
+
return this._agendaAppearanceDynamic;
|
|
94
|
+
}
|
|
95
|
+
if (undefined === this._agendaAppearanceDefault)
|
|
96
|
+
this._agendaAppearanceDefault = core_common_1.FeatureAppearance.fromTransparency(0.9);
|
|
97
|
+
return this._agendaAppearanceDefault;
|
|
98
|
+
}
|
|
99
|
+
get wantAgendaAppearanceOverride() { return false; }
|
|
100
|
+
addFeatureOverrides(overrides, _vp) {
|
|
101
|
+
if (this.agenda.isEmpty)
|
|
102
|
+
return;
|
|
103
|
+
const appearance = this.agendaAppearance(false);
|
|
104
|
+
this.agenda.elements.forEach((elementId) => overrides.override({ elementId, appearance }));
|
|
105
|
+
}
|
|
106
|
+
updateAgendaAppearanceProvider(drop) {
|
|
107
|
+
if (!this.wantAgendaAppearanceOverride)
|
|
108
|
+
return;
|
|
109
|
+
for (const vp of core_frontend_1.IModelApp.viewManager) {
|
|
110
|
+
if (!this.allowView(vp))
|
|
111
|
+
continue;
|
|
112
|
+
if (drop || this.agenda.isEmpty)
|
|
113
|
+
vp.dropFeatureOverrideProvider(this);
|
|
114
|
+
else if (!vp.addFeatureOverrideProvider(this))
|
|
115
|
+
vp.setFeatureOverrideProviderChanged();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
clearGraphics() {
|
|
119
|
+
if (undefined === this._graphicsProvider)
|
|
120
|
+
return;
|
|
121
|
+
this._graphicsProvider.cleanupGraphic();
|
|
122
|
+
this._graphicsProvider = undefined;
|
|
123
|
+
}
|
|
124
|
+
async createGraphics(ev) {
|
|
125
|
+
if (!core_frontend_1.IModelApp.viewManager.inDynamicsMode)
|
|
126
|
+
return; // Don't need to create graphic if dynamics aren't yet active...
|
|
127
|
+
const geometry = this.getGeometryProps(ev, false);
|
|
128
|
+
if (undefined === geometry) {
|
|
129
|
+
this.clearGraphics();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const elemProps = this.getElementProps(ev);
|
|
133
|
+
if (undefined === elemProps?.placement) {
|
|
134
|
+
this.clearGraphics();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (undefined === this._graphicsProvider) {
|
|
138
|
+
if (this._firstResult) {
|
|
139
|
+
this.updateAgendaAppearanceProvider();
|
|
140
|
+
this._firstResult = false;
|
|
141
|
+
}
|
|
142
|
+
this._graphicsProvider = new CreateElementTool_1.DynamicGraphicsProvider(this.iModel, this.toolId);
|
|
143
|
+
}
|
|
144
|
+
// Set chord tolerance for non-linear/non-planar geometry...
|
|
145
|
+
if (ev.viewport)
|
|
146
|
+
this._graphicsProvider.chordTolerance = (0, CreateElementTool_1.computeChordToleranceFromPoint)(ev.viewport, ev.point);
|
|
147
|
+
await this._graphicsProvider.createGraphic(elemProps.category, elemProps.placement, geometry);
|
|
148
|
+
}
|
|
149
|
+
onDynamicFrame(_ev, context) {
|
|
150
|
+
if (undefined !== this._graphicsProvider)
|
|
151
|
+
this._graphicsProvider.addGraphic(context);
|
|
152
|
+
}
|
|
153
|
+
async onMouseMotion(ev) {
|
|
154
|
+
return this.createGraphics(ev);
|
|
155
|
+
}
|
|
156
|
+
async onUnsuspend() {
|
|
157
|
+
if (!this._firstResult)
|
|
158
|
+
this.updateAgendaAppearanceProvider();
|
|
159
|
+
return super.onUnsuspend();
|
|
160
|
+
}
|
|
161
|
+
async onSuspend() {
|
|
162
|
+
if (!this._firstResult)
|
|
163
|
+
this.updateAgendaAppearanceProvider(true);
|
|
164
|
+
return super.onSuspend();
|
|
165
|
+
}
|
|
166
|
+
async onPostInstall() {
|
|
167
|
+
await super.onPostInstall();
|
|
168
|
+
if (this.wantAgendaAppearanceOverride)
|
|
169
|
+
this.agenda.manageHiliteState = false;
|
|
170
|
+
}
|
|
171
|
+
async onCleanup() {
|
|
172
|
+
this.clearGraphics();
|
|
173
|
+
this.updateAgendaAppearanceProvider(true);
|
|
174
|
+
return super.onCleanup();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.ModifyElementWithDynamicsTool = ModifyElementWithDynamicsTool;
|
|
178
178
|
//# sourceMappingURL=ModifyElementTool.js.map
|
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Editing
|
|
3
|
-
*/
|
|
4
|
-
import { BeEvent } from "@itwin/core-bentley";
|
|
5
|
-
import { Cartographic, EcefLocation, EcefLocationProps } from "@itwin/core-common";
|
|
6
|
-
import { BeButtonEvent, BriefcaseConnection, DecorateContext, EditManipulator, EventHandled, HitDetail, IModelConnection, ScreenViewport, Tool, ViewClipControlArrow } from "@itwin/core-frontend";
|
|
7
|
-
import { Angle, ClipShape, ClipVector, Point3d, Range1d, Range3d, Range3dProps, Ray3d } from "@itwin/core-geometry";
|
|
8
|
-
declare class ProjectExtentsControlArrow extends ViewClipControlArrow {
|
|
9
|
-
extentValid: boolean;
|
|
10
|
-
}
|
|
11
|
-
/** Values for [[ProjectExtentsClipDecoration.onChanged] event.
|
|
12
|
-
* @beta
|
|
13
|
-
*/
|
|
14
|
-
export declare enum ProjectLocationChanged {
|
|
15
|
-
/** Extents has been modified (unsaved changes) */
|
|
16
|
-
Extents = 0,
|
|
17
|
-
/** Geolocation has been modified (unsaved changes) */
|
|
18
|
-
Geolocation = 1,
|
|
19
|
-
/** Abandon unsaved changes to extents */
|
|
20
|
-
ResetExtents = 2,
|
|
21
|
-
/** Abandon unsaved changes to geolocation */
|
|
22
|
-
ResetGeolocation = 3,
|
|
23
|
-
/** Decoration hidden (unsaved changes preserved) */
|
|
24
|
-
Hide = 4,
|
|
25
|
-
/** Decoration shown (unsaved changes restored) */
|
|
26
|
-
Show = 5,
|
|
27
|
-
/** Save changes to extents and geolocation */
|
|
28
|
-
Save = 6
|
|
29
|
-
}
|
|
30
|
-
/** Controls to modify project extents shown using view clip
|
|
31
|
-
* @beta
|
|
32
|
-
*/
|
|
33
|
-
export declare class ProjectExtentsClipDecoration extends EditManipulator.HandleProvider {
|
|
34
|
-
viewport: ScreenViewport;
|
|
35
|
-
private static _decorator?;
|
|
36
|
-
protected _clip?: ClipVector;
|
|
37
|
-
protected _clipId?: string;
|
|
38
|
-
protected _clipShape?: ClipShape;
|
|
39
|
-
protected _clipShapeExtents?: Range1d;
|
|
40
|
-
protected _clipRange?: Range3d;
|
|
41
|
-
protected _extentsLengthValid: boolean;
|
|
42
|
-
protected _extentsWidthValid: boolean;
|
|
43
|
-
protected _extentsHeightValid: boolean;
|
|
44
|
-
protected _ecefLocation?: EcefLocation;
|
|
45
|
-
protected _allowEcefLocationChange: boolean;
|
|
46
|
-
protected _controlIds: string[];
|
|
47
|
-
protected _controls: ProjectExtentsControlArrow[];
|
|
48
|
-
protected _monumentPoint?: Point3d;
|
|
49
|
-
protected _northDirection?: Ray3d;
|
|
50
|
-
protected _monumentId?: string;
|
|
51
|
-
protected _northId?: string;
|
|
52
|
-
protected _suspendDecorator: boolean;
|
|
53
|
-
protected _removeViewCloseListener?: () => void;
|
|
54
|
-
suspendGeolocationDecorations: boolean;
|
|
55
|
-
/** Called when project extents or geolocation is modified */
|
|
56
|
-
readonly onChanged: BeEvent<(iModel: IModelConnection, ev: ProjectLocationChanged) => void>;
|
|
57
|
-
constructor(viewport: ScreenViewport);
|
|
58
|
-
protected start(): void;
|
|
59
|
-
protected stop(): void;
|
|
60
|
-
protected init(): boolean;
|
|
61
|
-
onViewClose(vp: ScreenViewport): void;
|
|
62
|
-
private getClipData;
|
|
63
|
-
private ensureNumControls;
|
|
64
|
-
private createClipShapeControls;
|
|
65
|
-
/** Allow project extents for map projections to be larger since curvature of the earth is accounted for. */
|
|
66
|
-
protected get maxExtentLength(): number;
|
|
67
|
-
/** Impose some reasonable height limit for project extents. */
|
|
68
|
-
protected get maxExtentHeight(): number;
|
|
69
|
-
protected hasValidGCS(): boolean;
|
|
70
|
-
protected createControls(): Promise<boolean>;
|
|
71
|
-
protected clearControls(): void;
|
|
72
|
-
protected modifyControls(hit: HitDetail, _ev: BeButtonEvent): Promise<boolean>;
|
|
73
|
-
protected onRightClick(_hit: HitDetail, _ev: BeButtonEvent): Promise<EventHandled>;
|
|
74
|
-
protected onTouchTap(hit: HitDetail, ev: BeButtonEvent): Promise<EventHandled>;
|
|
75
|
-
onDecorationButtonEvent(hit: HitDetail, ev: BeButtonEvent): Promise<EventHandled>;
|
|
76
|
-
onManipulatorEvent(eventType: EditManipulator.EventType): void;
|
|
77
|
-
getDecorationToolTip(hit: HitDetail): Promise<HTMLElement | string>;
|
|
78
|
-
testDecorationHit(id: string): boolean;
|
|
79
|
-
protected updateDecorationListener(_add: boolean): void;
|
|
80
|
-
getMonumentPoint(): Point3d;
|
|
81
|
-
getClockwiseAngleToNorth(): Angle;
|
|
82
|
-
getNorthAngle(): Angle;
|
|
83
|
-
getNorthDirection(refOrigin?: Point3d): Ray3d;
|
|
84
|
-
drawNorthArrow(context: DecorateContext, northDir: Ray3d, id?: string): void;
|
|
85
|
-
drawMonumentPoint(context: DecorateContext, point: Point3d, scaleFactor: number, id?: string): void;
|
|
86
|
-
protected drawAreaTooLargeIndicator(context: DecorateContext): void;
|
|
87
|
-
protected drawExtentTooLargeIndicator(context: DecorateContext, worldPoint: Point3d, sizePixels: number): void;
|
|
88
|
-
decorate(context: DecorateContext): void;
|
|
89
|
-
resetViewClip(): boolean;
|
|
90
|
-
resetGeolocation(): boolean;
|
|
91
|
-
updateEcefLocation(origin: Cartographic, point?: Point3d, angle?: Angle): boolean;
|
|
92
|
-
updateNorthDirection(northDir: Ray3d): boolean;
|
|
93
|
-
getModifiedEcefLocation(): EcefLocation | undefined;
|
|
94
|
-
getModifiedExtents(): Range3d | undefined;
|
|
95
|
-
static allowEcefLocationChange(requireExisting: boolean, outputError?: boolean): boolean;
|
|
96
|
-
fitExtents(): void;
|
|
97
|
-
static get(): ProjectExtentsClipDecoration | undefined;
|
|
98
|
-
static show(vp: ScreenViewport, fitExtents?: boolean): boolean;
|
|
99
|
-
static hide(): void;
|
|
100
|
-
static clear(clearClip?: boolean, resetGeolocation?: boolean): void;
|
|
101
|
-
static update(): Promise<void>;
|
|
102
|
-
}
|
|
103
|
-
/** Show project location decoration. Project extents represented by view clip.
|
|
104
|
-
* @beta
|
|
105
|
-
*/
|
|
106
|
-
export declare class ProjectLocationShowTool extends Tool {
|
|
107
|
-
static toolId: string;
|
|
108
|
-
run(): Promise<boolean>;
|
|
109
|
-
}
|
|
110
|
-
/** Hide project location decoration. Preserves changes to project extents view clip and geolocation.
|
|
111
|
-
* @beta
|
|
112
|
-
*/
|
|
113
|
-
export declare class ProjectLocationHideTool extends Tool {
|
|
114
|
-
static toolId: string;
|
|
115
|
-
run(): Promise<boolean>;
|
|
116
|
-
}
|
|
117
|
-
/** Clear project location decoration. Restore modified geolocation and remove view clip.
|
|
118
|
-
* @beta
|
|
119
|
-
*/
|
|
120
|
-
export declare class ProjectLocationCancelTool extends Tool {
|
|
121
|
-
static toolId: string;
|
|
122
|
-
run(): Promise<boolean>;
|
|
123
|
-
}
|
|
124
|
-
/** Save modified project extents and geolocation. Updates decoration to reflect saved state.
|
|
125
|
-
* @note Allowing this change to be undone is both problematic and undesirable.
|
|
126
|
-
* Warns the user if called with previous changes to cancel restarting the TxnManager session.
|
|
127
|
-
* @beta
|
|
128
|
-
*/
|
|
129
|
-
export declare class ProjectLocationSaveTool extends Tool {
|
|
130
|
-
static toolId: string;
|
|
131
|
-
protected allowRestartTxnSession(iModel: BriefcaseConnection): Promise<boolean>;
|
|
132
|
-
protected saveChanges(deco: ProjectExtentsClipDecoration, extents?: Range3dProps, ecefLocation?: EcefLocationProps): Promise<void>;
|
|
133
|
-
run(): Promise<boolean>;
|
|
134
|
-
}
|
|
135
|
-
export {};
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Editing
|
|
3
|
+
*/
|
|
4
|
+
import { BeEvent } from "@itwin/core-bentley";
|
|
5
|
+
import { Cartographic, EcefLocation, EcefLocationProps } from "@itwin/core-common";
|
|
6
|
+
import { BeButtonEvent, BriefcaseConnection, DecorateContext, EditManipulator, EventHandled, HitDetail, IModelConnection, ScreenViewport, Tool, ViewClipControlArrow } from "@itwin/core-frontend";
|
|
7
|
+
import { Angle, ClipShape, ClipVector, Point3d, Range1d, Range3d, Range3dProps, Ray3d } from "@itwin/core-geometry";
|
|
8
|
+
declare class ProjectExtentsControlArrow extends ViewClipControlArrow {
|
|
9
|
+
extentValid: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Values for [[ProjectExtentsClipDecoration.onChanged] event.
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export declare enum ProjectLocationChanged {
|
|
15
|
+
/** Extents has been modified (unsaved changes) */
|
|
16
|
+
Extents = 0,
|
|
17
|
+
/** Geolocation has been modified (unsaved changes) */
|
|
18
|
+
Geolocation = 1,
|
|
19
|
+
/** Abandon unsaved changes to extents */
|
|
20
|
+
ResetExtents = 2,
|
|
21
|
+
/** Abandon unsaved changes to geolocation */
|
|
22
|
+
ResetGeolocation = 3,
|
|
23
|
+
/** Decoration hidden (unsaved changes preserved) */
|
|
24
|
+
Hide = 4,
|
|
25
|
+
/** Decoration shown (unsaved changes restored) */
|
|
26
|
+
Show = 5,
|
|
27
|
+
/** Save changes to extents and geolocation */
|
|
28
|
+
Save = 6
|
|
29
|
+
}
|
|
30
|
+
/** Controls to modify project extents shown using view clip
|
|
31
|
+
* @beta
|
|
32
|
+
*/
|
|
33
|
+
export declare class ProjectExtentsClipDecoration extends EditManipulator.HandleProvider {
|
|
34
|
+
viewport: ScreenViewport;
|
|
35
|
+
private static _decorator?;
|
|
36
|
+
protected _clip?: ClipVector;
|
|
37
|
+
protected _clipId?: string;
|
|
38
|
+
protected _clipShape?: ClipShape;
|
|
39
|
+
protected _clipShapeExtents?: Range1d;
|
|
40
|
+
protected _clipRange?: Range3d;
|
|
41
|
+
protected _extentsLengthValid: boolean;
|
|
42
|
+
protected _extentsWidthValid: boolean;
|
|
43
|
+
protected _extentsHeightValid: boolean;
|
|
44
|
+
protected _ecefLocation?: EcefLocation;
|
|
45
|
+
protected _allowEcefLocationChange: boolean;
|
|
46
|
+
protected _controlIds: string[];
|
|
47
|
+
protected _controls: ProjectExtentsControlArrow[];
|
|
48
|
+
protected _monumentPoint?: Point3d;
|
|
49
|
+
protected _northDirection?: Ray3d;
|
|
50
|
+
protected _monumentId?: string;
|
|
51
|
+
protected _northId?: string;
|
|
52
|
+
protected _suspendDecorator: boolean;
|
|
53
|
+
protected _removeViewCloseListener?: () => void;
|
|
54
|
+
suspendGeolocationDecorations: boolean;
|
|
55
|
+
/** Called when project extents or geolocation is modified */
|
|
56
|
+
readonly onChanged: BeEvent<(iModel: IModelConnection, ev: ProjectLocationChanged) => void>;
|
|
57
|
+
constructor(viewport: ScreenViewport);
|
|
58
|
+
protected start(): void;
|
|
59
|
+
protected stop(): void;
|
|
60
|
+
protected init(): boolean;
|
|
61
|
+
onViewClose(vp: ScreenViewport): void;
|
|
62
|
+
private getClipData;
|
|
63
|
+
private ensureNumControls;
|
|
64
|
+
private createClipShapeControls;
|
|
65
|
+
/** Allow project extents for map projections to be larger since curvature of the earth is accounted for. */
|
|
66
|
+
protected get maxExtentLength(): number;
|
|
67
|
+
/** Impose some reasonable height limit for project extents. */
|
|
68
|
+
protected get maxExtentHeight(): number;
|
|
69
|
+
protected hasValidGCS(): boolean;
|
|
70
|
+
protected createControls(): Promise<boolean>;
|
|
71
|
+
protected clearControls(): void;
|
|
72
|
+
protected modifyControls(hit: HitDetail, _ev: BeButtonEvent): Promise<boolean>;
|
|
73
|
+
protected onRightClick(_hit: HitDetail, _ev: BeButtonEvent): Promise<EventHandled>;
|
|
74
|
+
protected onTouchTap(hit: HitDetail, ev: BeButtonEvent): Promise<EventHandled>;
|
|
75
|
+
onDecorationButtonEvent(hit: HitDetail, ev: BeButtonEvent): Promise<EventHandled>;
|
|
76
|
+
onManipulatorEvent(eventType: EditManipulator.EventType): void;
|
|
77
|
+
getDecorationToolTip(hit: HitDetail): Promise<HTMLElement | string>;
|
|
78
|
+
testDecorationHit(id: string): boolean;
|
|
79
|
+
protected updateDecorationListener(_add: boolean): void;
|
|
80
|
+
getMonumentPoint(): Point3d;
|
|
81
|
+
getClockwiseAngleToNorth(): Angle;
|
|
82
|
+
getNorthAngle(): Angle;
|
|
83
|
+
getNorthDirection(refOrigin?: Point3d): Ray3d;
|
|
84
|
+
drawNorthArrow(context: DecorateContext, northDir: Ray3d, id?: string): void;
|
|
85
|
+
drawMonumentPoint(context: DecorateContext, point: Point3d, scaleFactor: number, id?: string): void;
|
|
86
|
+
protected drawAreaTooLargeIndicator(context: DecorateContext): void;
|
|
87
|
+
protected drawExtentTooLargeIndicator(context: DecorateContext, worldPoint: Point3d, sizePixels: number): void;
|
|
88
|
+
decorate(context: DecorateContext): void;
|
|
89
|
+
resetViewClip(): boolean;
|
|
90
|
+
resetGeolocation(): boolean;
|
|
91
|
+
updateEcefLocation(origin: Cartographic, point?: Point3d, angle?: Angle): boolean;
|
|
92
|
+
updateNorthDirection(northDir: Ray3d): boolean;
|
|
93
|
+
getModifiedEcefLocation(): EcefLocation | undefined;
|
|
94
|
+
getModifiedExtents(): Range3d | undefined;
|
|
95
|
+
static allowEcefLocationChange(requireExisting: boolean, outputError?: boolean): boolean;
|
|
96
|
+
fitExtents(): void;
|
|
97
|
+
static get(): ProjectExtentsClipDecoration | undefined;
|
|
98
|
+
static show(vp: ScreenViewport, fitExtents?: boolean): boolean;
|
|
99
|
+
static hide(): void;
|
|
100
|
+
static clear(clearClip?: boolean, resetGeolocation?: boolean): void;
|
|
101
|
+
static update(): Promise<void>;
|
|
102
|
+
}
|
|
103
|
+
/** Show project location decoration. Project extents represented by view clip.
|
|
104
|
+
* @beta
|
|
105
|
+
*/
|
|
106
|
+
export declare class ProjectLocationShowTool extends Tool {
|
|
107
|
+
static toolId: string;
|
|
108
|
+
run(): Promise<boolean>;
|
|
109
|
+
}
|
|
110
|
+
/** Hide project location decoration. Preserves changes to project extents view clip and geolocation.
|
|
111
|
+
* @beta
|
|
112
|
+
*/
|
|
113
|
+
export declare class ProjectLocationHideTool extends Tool {
|
|
114
|
+
static toolId: string;
|
|
115
|
+
run(): Promise<boolean>;
|
|
116
|
+
}
|
|
117
|
+
/** Clear project location decoration. Restore modified geolocation and remove view clip.
|
|
118
|
+
* @beta
|
|
119
|
+
*/
|
|
120
|
+
export declare class ProjectLocationCancelTool extends Tool {
|
|
121
|
+
static toolId: string;
|
|
122
|
+
run(): Promise<boolean>;
|
|
123
|
+
}
|
|
124
|
+
/** Save modified project extents and geolocation. Updates decoration to reflect saved state.
|
|
125
|
+
* @note Allowing this change to be undone is both problematic and undesirable.
|
|
126
|
+
* Warns the user if called with previous changes to cancel restarting the TxnManager session.
|
|
127
|
+
* @beta
|
|
128
|
+
*/
|
|
129
|
+
export declare class ProjectLocationSaveTool extends Tool {
|
|
130
|
+
static toolId: string;
|
|
131
|
+
protected allowRestartTxnSession(iModel: BriefcaseConnection): Promise<boolean>;
|
|
132
|
+
protected saveChanges(deco: ProjectExtentsClipDecoration, extents?: Range3dProps, ecefLocation?: EcefLocationProps): Promise<void>;
|
|
133
|
+
run(): Promise<boolean>;
|
|
134
|
+
}
|
|
135
|
+
export {};
|
|
136
136
|
//# sourceMappingURL=ProjectExtentsDecoration.d.ts.map
|