@itwin/core-frontend 5.12.0-dev.6 → 5.12.0-dev.7
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 +6 -1
- package/lib/cjs/tools/AccuDrawShortcutTool.d.ts.map +1 -1
- package/lib/cjs/tools/AccuDrawShortcutTool.js +6 -2
- package/lib/cjs/tools/AccuDrawShortcutTool.js.map +1 -1
- package/lib/cjs/tools/AccuDrawTool.d.ts +109 -23
- package/lib/cjs/tools/AccuDrawTool.d.ts.map +1 -1
- package/lib/cjs/tools/AccuDrawTool.js +234 -34
- package/lib/cjs/tools/AccuDrawTool.js.map +1 -1
- package/lib/cjs/tools/ClipViewTool.d.ts +2 -1
- package/lib/cjs/tools/ClipViewTool.d.ts.map +1 -1
- package/lib/cjs/tools/ClipViewTool.js +8 -7
- package/lib/cjs/tools/ClipViewTool.js.map +1 -1
- package/lib/esm/tools/AccuDrawShortcutTool.d.ts.map +1 -1
- package/lib/esm/tools/AccuDrawShortcutTool.js +6 -2
- package/lib/esm/tools/AccuDrawShortcutTool.js.map +1 -1
- package/lib/esm/tools/AccuDrawTool.d.ts +109 -23
- package/lib/esm/tools/AccuDrawTool.d.ts.map +1 -1
- package/lib/esm/tools/AccuDrawTool.js +233 -34
- package/lib/esm/tools/AccuDrawTool.js.map +1 -1
- package/lib/esm/tools/ClipViewTool.d.ts +2 -1
- package/lib/esm/tools/ClipViewTool.d.ts.map +1 -1
- package/lib/esm/tools/ClipViewTool.js +9 -8
- package/lib/esm/tools/ClipViewTool.js.map +1 -1
- package/lib/public/locales/en/CoreTools.json +10 -0
- package/package.json +20 -20
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
* @module Tools
|
|
7
7
|
*/
|
|
8
8
|
import { BentleyStatus } from "@itwin/core-bentley";
|
|
9
|
-
import { Geometry, Matrix3d, Point3d, Transform, Vector3d } from "@itwin/core-geometry";
|
|
9
|
+
import { AxisOrder, Geometry, Matrix3d, Plane3dByOriginAndUnitNormal, Point3d, Transform, Vector3d } from "@itwin/core-geometry";
|
|
10
10
|
import { AccuDraw, AccuDrawFlags, CompassMode, ContextMode, ItemField, KeyinStatus, LockedStates, RotationMode, ThreeAxes } from "../AccuDraw";
|
|
11
11
|
import { TentativeOrAccuSnap } from "../AccuSnap";
|
|
12
12
|
import { ACSDisplayOptions } from "../AuxCoordSys";
|
|
13
13
|
import { IModelApp } from "../IModelApp";
|
|
14
14
|
import { BeButtonEvent, CoreTools, Tool } from "./Tool";
|
|
15
15
|
import { AccuDrawShortcutImplementation, AccuDrawShortcutTool } from "./AccuDrawShortcutTool";
|
|
16
|
+
import { GraphicType } from "../common/render/GraphicType";
|
|
16
17
|
// cSpell:ignore dont unlockedz
|
|
17
18
|
function normalizedDifference(point1, point2, out) {
|
|
18
19
|
return point2.vectorTo(point1).normalizeWithLength(out).mag;
|
|
@@ -75,15 +76,13 @@ export class AccuDrawShortcuts {
|
|
|
75
76
|
}
|
|
76
77
|
static updateACSByPoints(acs, vp, points, isDynamics) {
|
|
77
78
|
const accudraw = IModelApp.accuDraw;
|
|
78
|
-
if (!accudraw.isEnabled)
|
|
79
|
-
return false;
|
|
80
79
|
let accept = false;
|
|
81
80
|
const vec = [new Vector3d(), new Vector3d(), new Vector3d()];
|
|
82
81
|
acs.setOrigin(points[0]);
|
|
83
82
|
switch (points.length) {
|
|
84
83
|
case 1:
|
|
85
84
|
acs.setRotation(vp.rotation);
|
|
86
|
-
if (!isDynamics) {
|
|
85
|
+
if (!isDynamics && accudraw.isEnabled) {
|
|
87
86
|
accudraw.published.origin.setFrom(points[0]);
|
|
88
87
|
accudraw.published.flags = AccuDrawFlags.SetOrigin;
|
|
89
88
|
accudraw.flags.fixedOrg = true;
|
|
@@ -95,7 +94,7 @@ export class AccuDrawShortcuts {
|
|
|
95
94
|
break;
|
|
96
95
|
}
|
|
97
96
|
if (vp.view.is3d()) {
|
|
98
|
-
if (normalizedCrossProduct(accudraw.axes.y, vec[0], vec[1]) < 0.00001) {
|
|
97
|
+
if (accudraw.isEnabled && normalizedCrossProduct(accudraw.axes.y, vec[0], vec[1]) < 0.00001) {
|
|
99
98
|
vec[2].set(0.0, 0.0, 1.0);
|
|
100
99
|
if (normalizedCrossProduct(vec[2], vec[0], vec[1]) < 0.00001) {
|
|
101
100
|
vec[2].set(0.0, 1.0, 0.0);
|
|
@@ -104,7 +103,7 @@ export class AccuDrawShortcuts {
|
|
|
104
103
|
}
|
|
105
104
|
normalizedCrossProduct(vec[0], vec[1], vec[2]);
|
|
106
105
|
acs.setRotation(Matrix3d.createRows(vec[0], vec[1], vec[2]));
|
|
107
|
-
if (!isDynamics) {
|
|
106
|
+
if (!isDynamics && accudraw.isEnabled) {
|
|
108
107
|
accudraw.published.origin.setFrom(points[0]);
|
|
109
108
|
accudraw.published.flags = AccuDrawFlags.SetOrigin | AccuDrawFlags.SetNormal;
|
|
110
109
|
accudraw.published.vector.setFrom(vec[0]);
|
|
@@ -825,7 +824,11 @@ export class AccuDrawShortcuts {
|
|
|
825
824
|
accudraw.unlockAllFields();
|
|
826
825
|
}
|
|
827
826
|
}
|
|
828
|
-
/**
|
|
827
|
+
/**
|
|
828
|
+
* Immediate tool to toggle AccuDraw's availability for the current session.
|
|
829
|
+
* @note AccuDraw is enabled by default
|
|
830
|
+
* @beta
|
|
831
|
+
*/
|
|
829
832
|
export class AccuDrawSessionToggleTool extends Tool {
|
|
830
833
|
static toolId = "AccuDraw.SessionToggle";
|
|
831
834
|
async run() {
|
|
@@ -833,7 +836,11 @@ export class AccuDrawSessionToggleTool extends Tool {
|
|
|
833
836
|
return true;
|
|
834
837
|
}
|
|
835
838
|
}
|
|
836
|
-
/**
|
|
839
|
+
/**
|
|
840
|
+
* Immediate tool to toggle AccuDraw on/off temporarily for the current interactive tool.
|
|
841
|
+
* @note Typically used to disable AccuDraw for a single data button.
|
|
842
|
+
* @beta
|
|
843
|
+
*/
|
|
837
844
|
export class AccuDrawSuspendToggleTool extends Tool {
|
|
838
845
|
static toolId = "AccuDraw.SuspendToggle";
|
|
839
846
|
async run() {
|
|
@@ -841,7 +848,11 @@ export class AccuDrawSuspendToggleTool extends Tool {
|
|
|
841
848
|
return true;
|
|
842
849
|
}
|
|
843
850
|
}
|
|
844
|
-
/**
|
|
851
|
+
/**
|
|
852
|
+
* Immediate tool to enable AccuDraw and position it at the current AccuSnap or Tentative snap location.
|
|
853
|
+
* @note When not snapped, AccuDraw is activated at the last data button location when inactive, or moved to the current cursor location when active.
|
|
854
|
+
* @beta
|
|
855
|
+
*/
|
|
845
856
|
export class AccuDrawSetOriginTool extends Tool {
|
|
846
857
|
static toolId = "AccuDraw.SetOrigin";
|
|
847
858
|
async run() {
|
|
@@ -849,7 +860,11 @@ export class AccuDrawSetOriginTool extends Tool {
|
|
|
849
860
|
return true;
|
|
850
861
|
}
|
|
851
862
|
}
|
|
852
|
-
/**
|
|
863
|
+
/**
|
|
864
|
+
* Immediate tool to lock the closer of the x or y axis based on the current cursor location.
|
|
865
|
+
* @note When an axis is locked, points are projected onto the axis line.
|
|
866
|
+
* @beta
|
|
867
|
+
*/
|
|
853
868
|
export class AccuDrawSetLockSmartTool extends Tool {
|
|
854
869
|
static toolId = "AccuDraw.LockSmart";
|
|
855
870
|
async run() {
|
|
@@ -857,7 +872,10 @@ export class AccuDrawSetLockSmartTool extends Tool {
|
|
|
857
872
|
return true;
|
|
858
873
|
}
|
|
859
874
|
}
|
|
860
|
-
/**
|
|
875
|
+
/**
|
|
876
|
+
* Immediate tool to toggle the locked state of an indexed axis of the AccuDraw compass.
|
|
877
|
+
* @beta
|
|
878
|
+
*/
|
|
861
879
|
export class AccuDrawSetLockIndexTool extends Tool {
|
|
862
880
|
static toolId = "AccuDraw.LockIndex";
|
|
863
881
|
async run() {
|
|
@@ -865,7 +883,10 @@ export class AccuDrawSetLockIndexTool extends Tool {
|
|
|
865
883
|
return true;
|
|
866
884
|
}
|
|
867
885
|
}
|
|
868
|
-
/**
|
|
886
|
+
/**
|
|
887
|
+
* Immediate tool to toggle the locked state of the X text field.
|
|
888
|
+
* @beta
|
|
889
|
+
*/
|
|
869
890
|
export class AccuDrawSetLockXTool extends Tool {
|
|
870
891
|
static toolId = "AccuDraw.LockX";
|
|
871
892
|
async run() {
|
|
@@ -873,7 +894,10 @@ export class AccuDrawSetLockXTool extends Tool {
|
|
|
873
894
|
return true;
|
|
874
895
|
}
|
|
875
896
|
}
|
|
876
|
-
/**
|
|
897
|
+
/**
|
|
898
|
+
* Immediate tool to toggle the locked state of the Y text field.
|
|
899
|
+
* @beta
|
|
900
|
+
*/
|
|
877
901
|
export class AccuDrawSetLockYTool extends Tool {
|
|
878
902
|
static toolId = "AccuDraw.LockY";
|
|
879
903
|
async run() {
|
|
@@ -881,7 +905,10 @@ export class AccuDrawSetLockYTool extends Tool {
|
|
|
881
905
|
return true;
|
|
882
906
|
}
|
|
883
907
|
}
|
|
884
|
-
/**
|
|
908
|
+
/**
|
|
909
|
+
* Immediate tool to toggle the locked state of the Z text field.
|
|
910
|
+
* @beta
|
|
911
|
+
*/
|
|
885
912
|
export class AccuDrawSetLockZTool extends Tool {
|
|
886
913
|
static toolId = "AccuDraw.LockZ";
|
|
887
914
|
async run() {
|
|
@@ -889,7 +916,10 @@ export class AccuDrawSetLockZTool extends Tool {
|
|
|
889
916
|
return true;
|
|
890
917
|
}
|
|
891
918
|
}
|
|
892
|
-
/**
|
|
919
|
+
/**
|
|
920
|
+
* Immediate tool to toggle the locked state of the Distance text field.
|
|
921
|
+
* @beta
|
|
922
|
+
*/
|
|
893
923
|
export class AccuDrawSetLockDistanceTool extends Tool {
|
|
894
924
|
static toolId = "AccuDraw.LockDistance";
|
|
895
925
|
async run() {
|
|
@@ -897,7 +927,10 @@ export class AccuDrawSetLockDistanceTool extends Tool {
|
|
|
897
927
|
return true;
|
|
898
928
|
}
|
|
899
929
|
}
|
|
900
|
-
/**
|
|
930
|
+
/**
|
|
931
|
+
* Immediate tool to toggle the locked state of the Angle text field.
|
|
932
|
+
* @beta
|
|
933
|
+
*/
|
|
901
934
|
export class AccuDrawSetLockAngleTool extends Tool {
|
|
902
935
|
static toolId = "AccuDraw.LockAngle";
|
|
903
936
|
async run() {
|
|
@@ -905,7 +938,10 @@ export class AccuDrawSetLockAngleTool extends Tool {
|
|
|
905
938
|
return true;
|
|
906
939
|
}
|
|
907
940
|
}
|
|
908
|
-
/**
|
|
941
|
+
/**
|
|
942
|
+
* Immediate tool to toggle between polar and rectangular compass modes.
|
|
943
|
+
* @beta
|
|
944
|
+
*/
|
|
909
945
|
export class AccuDrawChangeModeTool extends Tool {
|
|
910
946
|
static toolId = "AccuDraw.ChangeMode";
|
|
911
947
|
async run() {
|
|
@@ -913,7 +949,10 @@ export class AccuDrawChangeModeTool extends Tool {
|
|
|
913
949
|
return true;
|
|
914
950
|
}
|
|
915
951
|
}
|
|
916
|
-
/**
|
|
952
|
+
/**
|
|
953
|
+
* Immediate tool to cycle between XY, XZ, and YZ planes for the current AccuDraw rotation.
|
|
954
|
+
* @beta
|
|
955
|
+
*/
|
|
917
956
|
export class AccuDrawRotateCycleTool extends Tool {
|
|
918
957
|
static toolId = "AccuDraw.RotateCycle";
|
|
919
958
|
async run() {
|
|
@@ -921,7 +960,11 @@ export class AccuDrawRotateCycleTool extends Tool {
|
|
|
921
960
|
return true;
|
|
922
961
|
}
|
|
923
962
|
}
|
|
924
|
-
/**
|
|
963
|
+
/**
|
|
964
|
+
* Immediate tool to set the AccuDraw rotation to a standard Top view.
|
|
965
|
+
* @note When IModelApp.toolAdmin.acsContextLock is true, rotation is set relative to the view's ACS.
|
|
966
|
+
* @beta
|
|
967
|
+
*/
|
|
925
968
|
export class AccuDrawRotateTopTool extends Tool {
|
|
926
969
|
static toolId = "AccuDraw.RotateTop";
|
|
927
970
|
async run() {
|
|
@@ -929,7 +972,11 @@ export class AccuDrawRotateTopTool extends Tool {
|
|
|
929
972
|
return true;
|
|
930
973
|
}
|
|
931
974
|
}
|
|
932
|
-
/**
|
|
975
|
+
/**
|
|
976
|
+
* Immediate tool to set the AccuDraw rotation to a standard Front view.
|
|
977
|
+
* @note When IModelApp.toolAdmin.acsContextLock is true, rotation is set relative to the view's ACS.
|
|
978
|
+
* @beta
|
|
979
|
+
*/
|
|
933
980
|
export class AccuDrawRotateFrontTool extends Tool {
|
|
934
981
|
static toolId = "AccuDraw.RotateFront";
|
|
935
982
|
async run() {
|
|
@@ -937,7 +984,11 @@ export class AccuDrawRotateFrontTool extends Tool {
|
|
|
937
984
|
return true;
|
|
938
985
|
}
|
|
939
986
|
}
|
|
940
|
-
/**
|
|
987
|
+
/**
|
|
988
|
+
* Immediate tool to set the AccuDraw rotation to a standard Side view.
|
|
989
|
+
* @note When IModelApp.toolAdmin.acsContextLock is true, rotation is set relative to the view's ACS.
|
|
990
|
+
* @beta
|
|
991
|
+
*/
|
|
941
992
|
export class AccuDrawRotateSideTool extends Tool {
|
|
942
993
|
static toolId = "AccuDraw.RotateSide";
|
|
943
994
|
async run() {
|
|
@@ -945,7 +996,10 @@ export class AccuDrawRotateSideTool extends Tool {
|
|
|
945
996
|
return true;
|
|
946
997
|
}
|
|
947
998
|
}
|
|
948
|
-
/**
|
|
999
|
+
/**
|
|
1000
|
+
* Immediate tool to set the AccuDraw rotation to match the rotation of the current view.
|
|
1001
|
+
* @beta
|
|
1002
|
+
*/
|
|
949
1003
|
export class AccuDrawRotateViewTool extends Tool {
|
|
950
1004
|
static toolId = "AccuDraw.RotateView";
|
|
951
1005
|
async run() {
|
|
@@ -953,7 +1007,10 @@ export class AccuDrawRotateViewTool extends Tool {
|
|
|
953
1007
|
return true;
|
|
954
1008
|
}
|
|
955
1009
|
}
|
|
956
|
-
/**
|
|
1010
|
+
/**
|
|
1011
|
+
* Immediate tool to set the AccuDraw rotation to be a 90 degree rotation about the current x axis.
|
|
1012
|
+
* @beta
|
|
1013
|
+
*/
|
|
957
1014
|
export class AccuDrawRotate90AboutXTool extends Tool {
|
|
958
1015
|
static toolId = "AccuDraw.Rotate90AboutX";
|
|
959
1016
|
async run() {
|
|
@@ -961,7 +1018,10 @@ export class AccuDrawRotate90AboutXTool extends Tool {
|
|
|
961
1018
|
return true;
|
|
962
1019
|
}
|
|
963
1020
|
}
|
|
964
|
-
/**
|
|
1021
|
+
/**
|
|
1022
|
+
* Immediate tool to set the AccuDraw rotation to be a 90 degree rotation about the current y axis.
|
|
1023
|
+
* @beta
|
|
1024
|
+
*/
|
|
965
1025
|
export class AccuDrawRotate90AboutYTool extends Tool {
|
|
966
1026
|
static toolId = "AccuDraw.Rotate90AboutY";
|
|
967
1027
|
async run() {
|
|
@@ -969,7 +1029,10 @@ export class AccuDrawRotate90AboutYTool extends Tool {
|
|
|
969
1029
|
return true;
|
|
970
1030
|
}
|
|
971
1031
|
}
|
|
972
|
-
/**
|
|
1032
|
+
/**
|
|
1033
|
+
* Immediate tool to set the AccuDraw rotation to be a 90 degree rotation about the current z axis.
|
|
1034
|
+
* @beta
|
|
1035
|
+
*/
|
|
973
1036
|
export class AccuDrawRotate90AboutZTool extends Tool {
|
|
974
1037
|
static toolId = "AccuDraw.Rotate90AboutZ";
|
|
975
1038
|
async run() {
|
|
@@ -1015,7 +1078,11 @@ class RotateAxesImplementation extends AccuDrawShortcutImplementation {
|
|
|
1015
1078
|
return true;
|
|
1016
1079
|
}
|
|
1017
1080
|
}
|
|
1018
|
-
/**
|
|
1081
|
+
/**
|
|
1082
|
+
* Interactive tool to set the AccuDraw rotation by rotating about the current z axis to a point on the x axis.
|
|
1083
|
+
* @note When AccuSnap or Tentative snap is active, the snap point is immediately used to define the x axis and not further input is required.
|
|
1084
|
+
* @beta
|
|
1085
|
+
*/
|
|
1019
1086
|
export class AccuDrawRotateAxesTool extends AccuDrawShortcutTool {
|
|
1020
1087
|
aboutCurrentZ;
|
|
1021
1088
|
static toolId = "AccuDraw.RotateAxes";
|
|
@@ -1080,7 +1147,10 @@ class RotateElementImplementation extends AccuDrawShortcutImplementation {
|
|
|
1080
1147
|
return true;
|
|
1081
1148
|
}
|
|
1082
1149
|
}
|
|
1083
|
-
/**
|
|
1150
|
+
/**
|
|
1151
|
+
* Interactive tool to set the AccuDraw rotation using the snapped to geometry under the cursor.
|
|
1152
|
+
* @beta
|
|
1153
|
+
*/
|
|
1084
1154
|
export class AccuDrawRotateElementTool extends AccuDrawShortcutTool {
|
|
1085
1155
|
static toolId = "AccuDraw.RotateElement";
|
|
1086
1156
|
/** @internal */
|
|
@@ -1089,6 +1159,124 @@ export class AccuDrawRotateElementTool extends AccuDrawShortcutTool {
|
|
|
1089
1159
|
}
|
|
1090
1160
|
}
|
|
1091
1161
|
/** @internal */
|
|
1162
|
+
class RotatePointsImplementation extends AccuDrawShortcutImplementation {
|
|
1163
|
+
_points = [];
|
|
1164
|
+
_origin = IModelApp.tentativePoint.isActive ? IModelApp.tentativePoint.getPoint().clone() : undefined;
|
|
1165
|
+
_moveOrigin = !IModelApp.accuDraw.isActive || IModelApp.tentativePoint.isActive; // Preserve current origin if AccuDraw already active and not tentative snap...
|
|
1166
|
+
_lastPoint;
|
|
1167
|
+
onProvideToolAssistance() {
|
|
1168
|
+
switch (this._points.length) {
|
|
1169
|
+
case 0:
|
|
1170
|
+
CoreTools.outputPromptByKey("AccuDraw.RotatePoints.Prompts.FirstPoint");
|
|
1171
|
+
break;
|
|
1172
|
+
case 1:
|
|
1173
|
+
CoreTools.outputPromptByKey("AccuDraw.RotatePoints.Prompts.SecondPoint");
|
|
1174
|
+
break;
|
|
1175
|
+
default:
|
|
1176
|
+
CoreTools.outputPromptByKey("AccuDraw.RotatePoints.Prompts.NextPoint");
|
|
1177
|
+
break;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
onInitialize() {
|
|
1181
|
+
if (undefined === this._origin)
|
|
1182
|
+
return;
|
|
1183
|
+
this._points.push(this._origin);
|
|
1184
|
+
IModelApp.tentativePoint.clear(true); // Necessary when installed as an InputCollector...
|
|
1185
|
+
IModelApp.accuDraw.activate();
|
|
1186
|
+
IModelApp.accuDraw.setContext(AccuDrawFlags.SetOrigin | AccuDrawFlags.FixedOrigin, this._origin);
|
|
1187
|
+
IModelApp.accuDraw.refreshDecorationsAndDynamics();
|
|
1188
|
+
}
|
|
1189
|
+
onComplete() {
|
|
1190
|
+
let ignoreFlags = AccuDrawFlags.SetRMatrix | AccuDrawFlags.Disable; // If AccuDraw wasn't active when the shortcut started, let it remain active for suspended tool when shortcut completes...
|
|
1191
|
+
if (this._moveOrigin)
|
|
1192
|
+
ignoreFlags |= AccuDrawFlags.SetOrigin;
|
|
1193
|
+
return ignoreFlags;
|
|
1194
|
+
}
|
|
1195
|
+
doManipulation(ev, isMotion) {
|
|
1196
|
+
if (!ev || !ev.viewport)
|
|
1197
|
+
return false;
|
|
1198
|
+
IModelApp.viewManager.invalidateDecorationsAllViews();
|
|
1199
|
+
if (isMotion) {
|
|
1200
|
+
this._lastPoint = ev.point.clone();
|
|
1201
|
+
return false;
|
|
1202
|
+
}
|
|
1203
|
+
const accuDraw = IModelApp.accuDraw;
|
|
1204
|
+
accuDraw.activate();
|
|
1205
|
+
switch (this._points.length) {
|
|
1206
|
+
case 0: {
|
|
1207
|
+
this._points.push(ev.point.clone());
|
|
1208
|
+
accuDraw.setContext(AccuDrawFlags.SetOrigin | AccuDrawFlags.FixedOrigin, this._points[0]);
|
|
1209
|
+
break;
|
|
1210
|
+
}
|
|
1211
|
+
case 1: {
|
|
1212
|
+
const xVec = Vector3d.createNormalizedStartEnd(this._points[0], ev.point);
|
|
1213
|
+
if (undefined === xVec)
|
|
1214
|
+
return false;
|
|
1215
|
+
if (!ev.viewport.view.is3d() || !ev.viewport.view.allow3dManipulations()) {
|
|
1216
|
+
accuDraw.setContext(AccuDrawFlags.SetOrigin | AccuDrawFlags.SetXAxis, this._points[0], xVec);
|
|
1217
|
+
return true; // Complete
|
|
1218
|
+
}
|
|
1219
|
+
this._points.push(ev.point.clone());
|
|
1220
|
+
accuDraw.setContext(AccuDrawFlags.SetOrigin | AccuDrawFlags.FixedOrigin | AccuDrawFlags.SetNormal, this._points[0], xVec);
|
|
1221
|
+
break;
|
|
1222
|
+
}
|
|
1223
|
+
case 2: {
|
|
1224
|
+
const xVec = Vector3d.createNormalizedStartEnd(this._points[0], this._points[1]);
|
|
1225
|
+
if (undefined === xVec)
|
|
1226
|
+
return false;
|
|
1227
|
+
const yVec = Vector3d.createNormalizedStartEnd(this._points[0], ev.point);
|
|
1228
|
+
if (undefined === yVec)
|
|
1229
|
+
return false;
|
|
1230
|
+
const matrix = Matrix3d.createRigidFromColumns(xVec, yVec, AxisOrder.XYZ);
|
|
1231
|
+
if (undefined === matrix)
|
|
1232
|
+
return false;
|
|
1233
|
+
const invMatrix = matrix.inverse();
|
|
1234
|
+
if (undefined === invMatrix)
|
|
1235
|
+
return false;
|
|
1236
|
+
accuDraw.setContext(AccuDrawFlags.SetOrigin | AccuDrawFlags.SetRMatrix, this._points[0], invMatrix);
|
|
1237
|
+
return true; // Complete
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
this.onProvideToolAssistance();
|
|
1241
|
+
return false;
|
|
1242
|
+
}
|
|
1243
|
+
doDecorate(context) {
|
|
1244
|
+
if (0 === this._points.length)
|
|
1245
|
+
return;
|
|
1246
|
+
const currentPoint = this._lastPoint;
|
|
1247
|
+
if (undefined === currentPoint)
|
|
1248
|
+
return;
|
|
1249
|
+
if (2 === this._points.length) {
|
|
1250
|
+
const xVec = Vector3d.createNormalizedStartEnd(this._points[0], this._points[1]);
|
|
1251
|
+
if (undefined === xVec)
|
|
1252
|
+
return;
|
|
1253
|
+
const plane = Plane3dByOriginAndUnitNormal.create(this._points[0], xVec);
|
|
1254
|
+
if (undefined === plane)
|
|
1255
|
+
return;
|
|
1256
|
+
plane.projectPointToPlane(currentPoint, currentPoint);
|
|
1257
|
+
}
|
|
1258
|
+
const tmpPoints = this._points.slice(0, 1);
|
|
1259
|
+
tmpPoints.push(currentPoint);
|
|
1260
|
+
const vp = context.viewport;
|
|
1261
|
+
const color = vp.getContrastToBackgroundColor();
|
|
1262
|
+
const builder = context.createGraphicBuilder(GraphicType.WorldOverlay);
|
|
1263
|
+
builder.setSymbology(color, color, 2);
|
|
1264
|
+
builder.addLineString(tmpPoints);
|
|
1265
|
+
context.addDecorationFromBuilder(builder);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* Interactive tool to set the AccuDraw rotation by 3 points: x axis origin, x axis direction, and y axis direction.
|
|
1270
|
+
* @beta
|
|
1271
|
+
*/
|
|
1272
|
+
export class AccuDrawRotatePointsTool extends AccuDrawShortcutTool {
|
|
1273
|
+
static toolId = "AccuDraw.RotatePoints";
|
|
1274
|
+
/** @internal */
|
|
1275
|
+
createImplementation() {
|
|
1276
|
+
return new RotatePointsImplementation();
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
/** @internal */
|
|
1092
1280
|
class DefineACSByElementImplementation extends AccuDrawShortcutImplementation {
|
|
1093
1281
|
_origin = Point3d.create();
|
|
1094
1282
|
_rMatrix = Matrix3d.createIdentity();
|
|
@@ -1131,7 +1319,10 @@ class DefineACSByElementImplementation extends AccuDrawShortcutImplementation {
|
|
|
1131
1319
|
this._acs.display(context, ACSDisplayOptions.Active | ACSDisplayOptions.Dynamics);
|
|
1132
1320
|
}
|
|
1133
1321
|
}
|
|
1134
|
-
/**
|
|
1322
|
+
/**
|
|
1323
|
+
* Interactive tool to set the view's ACS rotation by 3 points: x axis origin, x axis direction, and y axis direction/
|
|
1324
|
+
* @beta
|
|
1325
|
+
*/
|
|
1135
1326
|
export class DefineACSByElementTool extends AccuDrawShortcutTool {
|
|
1136
1327
|
static toolId = "AccuDraw.DefineACSByElement";
|
|
1137
1328
|
/** @internal */
|
|
@@ -1144,6 +1335,7 @@ class DefineACSByPointsImplementation extends AccuDrawShortcutImplementation {
|
|
|
1144
1335
|
_points = [];
|
|
1145
1336
|
_acs;
|
|
1146
1337
|
_origin = IModelApp.tentativePoint.isActive ? IModelApp.tentativePoint.getPoint().clone() : undefined;
|
|
1338
|
+
_lastPoint;
|
|
1147
1339
|
onProvideToolAssistance() {
|
|
1148
1340
|
switch (this._points.length) {
|
|
1149
1341
|
case 0:
|
|
@@ -1160,16 +1352,20 @@ class DefineACSByPointsImplementation extends AccuDrawShortcutImplementation {
|
|
|
1160
1352
|
onInitialize() {
|
|
1161
1353
|
if (undefined === this._origin)
|
|
1162
1354
|
return;
|
|
1163
|
-
IModelApp.accuDraw.setContext(AccuDrawFlags.SetOrigin | AccuDrawFlags.FixedOrigin, this._origin);
|
|
1164
1355
|
this._points.push(this._origin);
|
|
1165
1356
|
IModelApp.tentativePoint.clear(true); // Necessary when installed as an InputCollector...
|
|
1357
|
+
IModelApp.accuDraw.activate();
|
|
1358
|
+
IModelApp.accuDraw.setContext(AccuDrawFlags.SetOrigin | AccuDrawFlags.FixedOrigin, this._origin);
|
|
1359
|
+
IModelApp.accuDraw.refreshDecorationsAndDynamics();
|
|
1166
1360
|
}
|
|
1167
1361
|
doManipulation(ev, isMotion) {
|
|
1168
1362
|
if (!ev || !ev.viewport)
|
|
1169
1363
|
return false;
|
|
1170
1364
|
IModelApp.viewManager.invalidateDecorationsAllViews();
|
|
1171
|
-
if (isMotion)
|
|
1365
|
+
if (isMotion) {
|
|
1366
|
+
this._lastPoint = ev.point.clone();
|
|
1172
1367
|
return false;
|
|
1368
|
+
}
|
|
1173
1369
|
IModelApp.accuDraw.activate();
|
|
1174
1370
|
this._points.push(ev.point.clone());
|
|
1175
1371
|
const vp = ev.viewport;
|
|
@@ -1184,11 +1380,11 @@ class DefineACSByPointsImplementation extends AccuDrawShortcutImplementation {
|
|
|
1184
1380
|
return false;
|
|
1185
1381
|
}
|
|
1186
1382
|
doDecorate(context) {
|
|
1383
|
+
if (undefined === this._lastPoint)
|
|
1384
|
+
return;
|
|
1187
1385
|
const tmpPoints = [];
|
|
1188
1386
|
this._points.forEach((pt) => tmpPoints.push(pt));
|
|
1189
|
-
|
|
1190
|
-
IModelApp.toolAdmin.fillEventFromCursorLocation(ev);
|
|
1191
|
-
tmpPoints.push(ev.point);
|
|
1387
|
+
tmpPoints.push(this._lastPoint);
|
|
1192
1388
|
const vp = context.viewport;
|
|
1193
1389
|
if (!this._acs)
|
|
1194
1390
|
this._acs = vp.view.auxiliaryCoordinateSystem.clone();
|
|
@@ -1196,7 +1392,10 @@ class DefineACSByPointsImplementation extends AccuDrawShortcutImplementation {
|
|
|
1196
1392
|
this._acs.display(context, ACSDisplayOptions.Active | ACSDisplayOptions.Dynamics);
|
|
1197
1393
|
}
|
|
1198
1394
|
}
|
|
1199
|
-
/**
|
|
1395
|
+
/**
|
|
1396
|
+
* Interactive tool to set the view's ACS rotation by 3 points: x axis origin, x axis direction, and y axis direction.
|
|
1397
|
+
* @beta
|
|
1398
|
+
*/
|
|
1200
1399
|
export class DefineACSByPointsTool extends AccuDrawShortcutTool {
|
|
1201
1400
|
static toolId = "AccuDraw.DefineACSByPoints";
|
|
1202
1401
|
/** @internal */
|