@inweb/client 25.2.2
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/LICENSE +20 -0
- package/README.md +70 -0
- package/dist/client.js +21126 -0
- package/dist/client.js.map +1 -0
- package/dist/client.min.js +1 -0
- package/dist/client.module.js +7151 -0
- package/dist/client.module.js.map +1 -0
- package/lib/Api/Assembly.d.ts +339 -0
- package/lib/Api/ClashTest.d.ts +176 -0
- package/lib/Api/Client.d.ts +452 -0
- package/lib/Api/ClientEvents.d.ts +29 -0
- package/lib/Api/File.d.ts +568 -0
- package/lib/Api/HttpClient.d.ts +13 -0
- package/lib/Api/IAssembly.d.ts +14 -0
- package/lib/Api/IFile.d.ts +46 -0
- package/lib/Api/IHttpClient.d.ts +11 -0
- package/lib/Api/IUser.d.ts +11 -0
- package/lib/Api/Job.d.ts +142 -0
- package/lib/Api/Member.d.ts +85 -0
- package/lib/Api/Model.d.ts +147 -0
- package/lib/Api/Permission.d.ts +93 -0
- package/lib/Api/Project.d.ts +247 -0
- package/lib/Api/Role.d.ts +82 -0
- package/lib/Api/User.d.ts +197 -0
- package/lib/Api/impl/FetchError.d.ts +18 -0
- package/lib/Api/impl/Utils.d.ts +33 -0
- package/lib/Api/impl/http.d.ts +67 -0
- package/lib/ConvetMath.d.ts +29 -0
- package/lib/Viewer/CanvasEvents.d.ts +2 -0
- package/lib/Viewer/Commands/ApplyModelTransform.d.ts +2 -0
- package/lib/Viewer/Commands/ClearMarkup.d.ts +2 -0
- package/lib/Viewer/Commands/ClearSlices.d.ts +2 -0
- package/lib/Viewer/Commands/CreatePreview.d.ts +2 -0
- package/lib/Viewer/Commands/Explode.d.ts +2 -0
- package/lib/Viewer/Commands/GetDefaultViewPositions.d.ts +2 -0
- package/lib/Viewer/Commands/GetModels.d.ts +2 -0
- package/lib/Viewer/Commands/GetSelected.d.ts +2 -0
- package/lib/Viewer/Commands/HideSelected.d.ts +2 -0
- package/lib/Viewer/Commands/IsolateSelected.d.ts +2 -0
- package/lib/Viewer/Commands/RegenerateAll.d.ts +2 -0
- package/lib/Viewer/Commands/ResetView.d.ts +2 -0
- package/lib/Viewer/Commands/SelectModel.d.ts +2 -0
- package/lib/Viewer/Commands/SetActiveDragger.d.ts +2 -0
- package/lib/Viewer/Commands/SetDefaultViewPosition.d.ts +2 -0
- package/lib/Viewer/Commands/SetMarkupColor.d.ts +2 -0
- package/lib/Viewer/Commands/SetSelected.d.ts +2 -0
- package/lib/Viewer/Commands/ShowAll.d.ts +2 -0
- package/lib/Viewer/Commands/Unselect.d.ts +2 -0
- package/lib/Viewer/Commands/ZoomToExtents.d.ts +2 -0
- package/lib/Viewer/Commands/ZoomToObjects.d.ts +2 -0
- package/lib/Viewer/Commands/ZoomToSelected.d.ts +2 -0
- package/lib/Viewer/Commands.d.ts +3 -0
- package/lib/Viewer/Draggers/Actions/OrbitAction.d.ts +22 -0
- package/lib/Viewer/Draggers/Actions/PanAction.d.ts +18 -0
- package/lib/Viewer/Draggers/Actions/ZoomAction.d.ts +8 -0
- package/lib/Viewer/Draggers/Common/Geometry.d.ts +115 -0
- package/lib/Viewer/Draggers/Common/GestureManager.d.ts +41 -0
- package/lib/Viewer/Draggers/Common/OdBaseDragger.d.ts +54 -0
- package/lib/Viewer/Draggers/Common/OdaGeAction.d.ts +30 -0
- package/lib/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.d.ts +31 -0
- package/lib/Viewer/Draggers/MeasureLineDragger/MeasureUtils.d.ts +20 -0
- package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +24 -0
- package/lib/Viewer/Draggers/OdBaseCuttingPlaneDragger.d.ts +27 -0
- package/lib/Viewer/Draggers/OdCuttingPlaneXAxisDragger.d.ts +8 -0
- package/lib/Viewer/Draggers/OdCuttingPlaneYAxisDragger.d.ts +8 -0
- package/lib/Viewer/Draggers/OdCuttingPlaneZAxisDragger.d.ts +8 -0
- package/lib/Viewer/Draggers/OdOrbitDragger.d.ts +15 -0
- package/lib/Viewer/Draggers/OdPanDragger.d.ts +12 -0
- package/lib/Viewer/Draggers/OdZoomDragger.d.ts +12 -0
- package/lib/Viewer/Draggers/OdZoomWheelDragger.d.ts +11 -0
- package/lib/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.d.ts +19 -0
- package/lib/Viewer/Draggers/OdZoomWindowDragger/index.d.ts +14 -0
- package/lib/Viewer/Draggers/OdaLineDragger.d.ts +15 -0
- package/lib/Viewer/Draggers/OdaTextDragger.d.ts +16 -0
- package/lib/Viewer/Draggers/OdaWalkDragger.d.ts +30 -0
- package/lib/Viewer/Draggers/OrbitAroundBuildingDragger.d.ts +19 -0
- package/lib/Viewer/EventEmitter2.d.ts +54 -0
- package/lib/Viewer/ICommands.d.ts +25 -0
- package/lib/Viewer/IEventEmitter2.d.ts +13 -0
- package/lib/Viewer/IViewer.d.ts +27 -0
- package/lib/Viewer/Loaders/BaseLoader.d.ts +11 -0
- package/lib/Viewer/Loaders/LoaderFactory.d.ts +10 -0
- package/lib/Viewer/Loaders/TCSLoader.d.ts +5 -0
- package/lib/Viewer/Loaders/UpdaterController.d.ts +15 -0
- package/lib/Viewer/Loaders/VsfXLoader.d.ts +5 -0
- package/lib/Viewer/Loaders/VsfXPartialLoader.d.ts +5 -0
- package/lib/Viewer/Markup/Api/IMarkupArrow.d.ts +12 -0
- package/lib/Viewer/Markup/Api/IMarkupColorable.d.ts +5 -0
- package/lib/Viewer/Markup/Api/IMarkupEllipse.d.ts +15 -0
- package/lib/Viewer/Markup/Api/IMarkupImage.d.ts +15 -0
- package/lib/Viewer/Markup/Api/IMarkupLine.d.ts +11 -0
- package/lib/Viewer/Markup/Api/IMarkupObject.d.ts +12 -0
- package/lib/Viewer/Markup/Api/IMarkupRectangle.d.ts +15 -0
- package/lib/Viewer/Markup/Api/IMarkupText.d.ts +13 -0
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaArrow.d.ts +32 -0
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.d.ts +40 -0
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaImage.d.ts +36 -0
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaLine.d.ts +32 -0
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.d.ts +38 -0
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaText.d.ts +37 -0
- package/lib/Viewer/Markup/IMarkup.d.ts +38 -0
- package/lib/Viewer/Markup/Impl/Konva/KonvaMarkup.d.ts +63 -0
- package/lib/Viewer/Markup/Impl/Konva/MarkupColor.d.ts +19 -0
- package/lib/Viewer/Markup/Impl/Visualize/VisualizeMarkup.d.ts +33 -0
- package/lib/Viewer/Markup/MarkupFactory.d.ts +7 -0
- package/lib/Viewer/Options.d.ts +228 -0
- package/lib/Viewer/OptionsEvents.d.ts +26 -0
- package/lib/Viewer/Viewer.d.ts +353 -0
- package/lib/Viewer/ViewerCommands.d.ts +23 -0
- package/lib/Viewer/ViewerEvents.d.ts +601 -0
- package/lib/Viewer/utils.d.ts +4 -0
- package/lib/index.d.ts +24 -0
- package/package.json +32 -0
- package/src/Api/Assembly.ts +678 -0
- package/src/Api/ClashTest.ts +290 -0
- package/src/Api/Client.ts +816 -0
- package/src/Api/ClientEvents.ts +31 -0
- package/src/Api/File.ts +962 -0
- package/src/Api/HttpClient.ts +73 -0
- package/src/Api/IAssembly.ts +37 -0
- package/src/Api/IFile.ts +74 -0
- package/src/Api/IHttpClient.ts +50 -0
- package/src/Api/IUser.ts +33 -0
- package/src/Api/Job.ts +253 -0
- package/src/Api/Member.ts +161 -0
- package/src/Api/Model.ts +259 -0
- package/src/Api/Permission.ts +173 -0
- package/src/Api/Project.ts +479 -0
- package/src/Api/Role.ts +158 -0
- package/src/Api/User.ts +357 -0
- package/src/Api/impl/FetchError.ts +48 -0
- package/src/Api/impl/Utils.ts +367 -0
- package/src/Api/impl/http.ts +92 -0
- package/src/ConvetMath.ts +372 -0
- package/src/Viewer/CanvasEvents.ts +41 -0
- package/src/Viewer/Commands/ApplyModelTransform.ts +70 -0
- package/src/Viewer/Commands/ClearMarkup.ts +28 -0
- package/src/Viewer/Commands/ClearSlices.ts +27 -0
- package/src/Viewer/Commands/CreatePreview.ts +33 -0
- package/src/Viewer/Commands/Explode.ts +38 -0
- package/src/Viewer/Commands/GetDefaultViewPositions.ts +36 -0
- package/src/Viewer/Commands/GetModels.ts +43 -0
- package/src/Viewer/Commands/GetSelected.ts +58 -0
- package/src/Viewer/Commands/HideSelected.ts +37 -0
- package/src/Viewer/Commands/IsolateSelected.ts +37 -0
- package/src/Viewer/Commands/RegenerateAll.ts +37 -0
- package/src/Viewer/Commands/ResetView.ts +43 -0
- package/src/Viewer/Commands/SelectModel.ts +52 -0
- package/src/Viewer/Commands/SetActiveDragger.ts +29 -0
- package/src/Viewer/Commands/SetDefaultViewPosition.ts +50 -0
- package/src/Viewer/Commands/SetMarkupColor.ts +29 -0
- package/src/Viewer/Commands/SetSelected.ts +47 -0
- package/src/Viewer/Commands/ShowAll.ts +37 -0
- package/src/Viewer/Commands/Unselect.ts +37 -0
- package/src/Viewer/Commands/ZoomToExtents.ts +43 -0
- package/src/Viewer/Commands/ZoomToObjects.ts +47 -0
- package/src/Viewer/Commands/ZoomToSelected.ts +39 -0
- package/src/Viewer/Commands.ts +81 -0
- package/src/Viewer/Draggers/Actions/OrbitAction.ts +250 -0
- package/src/Viewer/Draggers/Actions/PanAction.ts +102 -0
- package/src/Viewer/Draggers/Actions/ZoomAction.ts +45 -0
- package/src/Viewer/Draggers/Common/Geometry.ts +152 -0
- package/src/Viewer/Draggers/Common/GestureManager.ts +263 -0
- package/src/Viewer/Draggers/Common/OdBaseDragger.ts +270 -0
- package/src/Viewer/Draggers/Common/OdaGeAction.ts +146 -0
- package/src/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.ts +248 -0
- package/src/Viewer/Draggers/MeasureLineDragger/MeasureUtils.ts +182 -0
- package/src/Viewer/Draggers/MeasureLineDragger/index.ts +166 -0
- package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +182 -0
- package/src/Viewer/Draggers/OdCuttingPlaneXAxisDragger.ts +53 -0
- package/src/Viewer/Draggers/OdCuttingPlaneYAxisDragger.ts +53 -0
- package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +53 -0
- package/src/Viewer/Draggers/OdOrbitDragger.ts +70 -0
- package/src/Viewer/Draggers/OdPanDragger.ts +62 -0
- package/src/Viewer/Draggers/OdZoomDragger.ts +59 -0
- package/src/Viewer/Draggers/OdZoomWheelDragger.ts +103 -0
- package/src/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.ts +123 -0
- package/src/Viewer/Draggers/OdZoomWindowDragger/index.ts +75 -0
- package/src/Viewer/Draggers/OdaLineDragger.ts +80 -0
- package/src/Viewer/Draggers/OdaTextDragger.ts +118 -0
- package/src/Viewer/Draggers/OdaWalkDragger.ts +278 -0
- package/src/Viewer/Draggers/OrbitAroundBuildingDragger.ts +184 -0
- package/src/Viewer/EventEmitter2.ts +116 -0
- package/src/Viewer/ICommands.ts +53 -0
- package/src/Viewer/IEventEmitter2.ts +36 -0
- package/src/Viewer/IViewer.ts +55 -0
- package/src/Viewer/Loaders/BaseLoader.ts +40 -0
- package/src/Viewer/Loaders/LoaderFactory.ts +44 -0
- package/src/Viewer/Loaders/TCSLoader.ts +82 -0
- package/src/Viewer/Loaders/UpdaterController.ts +36 -0
- package/src/Viewer/Loaders/VsfXLoader.ts +87 -0
- package/src/Viewer/Loaders/VsfXPartialLoader.ts +208 -0
- package/src/Viewer/Markup/Api/IMarkupArrow.ts +15 -0
- package/src/Viewer/Markup/Api/IMarkupColorable.ts +4 -0
- package/src/Viewer/Markup/Api/IMarkupEllipse.ts +15 -0
- package/src/Viewer/Markup/Api/IMarkupImage.ts +15 -0
- package/src/Viewer/Markup/Api/IMarkupLine.ts +10 -0
- package/src/Viewer/Markup/Api/IMarkupObject.ts +15 -0
- package/src/Viewer/Markup/Api/IMarkupRectangle.ts +15 -0
- package/src/Viewer/Markup/Api/IMarkupText.ts +12 -0
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaArrow.ts +119 -0
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.ts +113 -0
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaImage.ts +121 -0
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaLine.ts +99 -0
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.ts +113 -0
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaText.ts +104 -0
- package/src/Viewer/Markup/IMarkup.ts +39 -0
- package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +872 -0
- package/src/Viewer/Markup/Impl/Konva/MarkupColor.ts +39 -0
- package/src/Viewer/Markup/Impl/Visualize/VisualizeMarkup.ts +273 -0
- package/src/Viewer/Markup/MarkupFactory.ts +32 -0
- package/src/Viewer/Options.ts +502 -0
- package/src/Viewer/OptionsEvents.ts +28 -0
- package/src/Viewer/Viewer.ts +1109 -0
- package/src/Viewer/ViewerCommands.ts +45 -0
- package/src/Viewer/ViewerEvents.ts +700 -0
- package/src/Viewer/utils.ts +74 -0
- package/src/index.ts +48 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
import { Viewer } from "../../Viewer";
|
|
24
|
+
import { OdBaseDragger } from "../Common/OdBaseDragger";
|
|
25
|
+
import { MeasureLineItem } from "./MeasureLineItem";
|
|
26
|
+
|
|
27
|
+
function renameUnit(table, unit) {
|
|
28
|
+
return table[unit] || unit;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class MeasureLineDragger extends OdBaseDragger {
|
|
32
|
+
protected lineThickness: number;
|
|
33
|
+
protected gripingRadius: number;
|
|
34
|
+
protected firstPoint: number[];
|
|
35
|
+
protected secondPoint: number[];
|
|
36
|
+
protected renameUnitTable: any;
|
|
37
|
+
protected items: MeasureLineItem[];
|
|
38
|
+
protected m_overlayElement: HTMLElement;
|
|
39
|
+
protected previewMeasureLine: MeasureLineItem;
|
|
40
|
+
|
|
41
|
+
constructor(subject: Viewer) {
|
|
42
|
+
super(subject);
|
|
43
|
+
this.lineThickness = 2;
|
|
44
|
+
this.press = false;
|
|
45
|
+
this.gripingRadius = 5.0;
|
|
46
|
+
this.firstPoint = null;
|
|
47
|
+
this.secondPoint = null;
|
|
48
|
+
|
|
49
|
+
this.renameUnitTable = {
|
|
50
|
+
Millimeters: "mm",
|
|
51
|
+
Centimeters: "cm",
|
|
52
|
+
Meters: "m",
|
|
53
|
+
Feet: "ft",
|
|
54
|
+
Inches: "in",
|
|
55
|
+
Yards: "yd",
|
|
56
|
+
Kilometers: "km",
|
|
57
|
+
Miles: "mi",
|
|
58
|
+
Micrometers: "µm",
|
|
59
|
+
MicroInches: "µin",
|
|
60
|
+
Undefined: " ",
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
this.items = [];
|
|
64
|
+
|
|
65
|
+
this.canvasEvents.push("resize");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
override initialize(): void {
|
|
69
|
+
super.initialize();
|
|
70
|
+
|
|
71
|
+
this.m_overlayElement = document.createElement("div");
|
|
72
|
+
this.m_overlayElement.style.background = "rgba(0,0,0,0)";
|
|
73
|
+
this.m_overlayElement.style.position = "fixed";
|
|
74
|
+
this.m_overlayElement.style.zIndex = "1";
|
|
75
|
+
this.m_overlayElement.style.pointerEvents = "none";
|
|
76
|
+
document.body.appendChild(this.m_overlayElement);
|
|
77
|
+
|
|
78
|
+
this.resize();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
override dispose(): void {
|
|
82
|
+
super.dispose();
|
|
83
|
+
this.m_overlayElement.remove();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
override updatePreview(): void {
|
|
87
|
+
this.items.forEach((item) => item.update());
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
resize(): void {
|
|
91
|
+
const rect = this.m_module.canvas.getBoundingClientRect();
|
|
92
|
+
|
|
93
|
+
this.m_overlayElement.style.top = `${rect.top}px`;
|
|
94
|
+
this.m_overlayElement.style.left = `${rect.left}px`;
|
|
95
|
+
this.m_overlayElement.style.width = `${rect.width}px`;
|
|
96
|
+
this.m_overlayElement.style.height = `${rect.height}px`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
getSnapPointRadius(): number {
|
|
100
|
+
const view = this.getViewer().activeView;
|
|
101
|
+
const corners = view.viewDcCorners();
|
|
102
|
+
|
|
103
|
+
const pt1 = corners.lowerLeft;
|
|
104
|
+
const pt2 = corners.upperRight;
|
|
105
|
+
|
|
106
|
+
pt2[0] -= pt1[0];
|
|
107
|
+
pt2[1] -= pt1[1];
|
|
108
|
+
|
|
109
|
+
return Math.min(pt2[0], pt2[1]) / 120;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
override drag(x: number, y: number): void {
|
|
113
|
+
this.createNewMeasureIfNeed();
|
|
114
|
+
const point = this.getViewer().getSnapPoint(x, y, this.gripingRadius);
|
|
115
|
+
|
|
116
|
+
if (this.isDragging) {
|
|
117
|
+
if (point) {
|
|
118
|
+
if (this.firstPoint) {
|
|
119
|
+
this.secondPoint = point;
|
|
120
|
+
this.previewMeasureLine.setStartPoint(this.firstPoint);
|
|
121
|
+
this.previewMeasureLine.setEndPoint(this.secondPoint, true);
|
|
122
|
+
} else {
|
|
123
|
+
this.firstPoint = point;
|
|
124
|
+
this.previewMeasureLine.setStartPoint(this.firstPoint);
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
this.secondPoint = null;
|
|
128
|
+
this.previewMeasureLine.clear();
|
|
129
|
+
this.previewMeasureLine.setStartPoint(this.firstPoint);
|
|
130
|
+
this.previewMeasureLine.setEndPoint(this.getViewer().screenToWorld(x, y), false);
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
if (point) {
|
|
134
|
+
this.previewMeasureLine.setStartPoint(point);
|
|
135
|
+
} else {
|
|
136
|
+
this.previewMeasureLine.clear();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
override end(): void {
|
|
142
|
+
if (this.firstPoint && this.secondPoint) {
|
|
143
|
+
const newLineMeasure = this.createMeasureLine();
|
|
144
|
+
newLineMeasure.setStartPoint(this.firstPoint);
|
|
145
|
+
newLineMeasure.setEndPoint(this.secondPoint, true);
|
|
146
|
+
}
|
|
147
|
+
this.firstPoint = null;
|
|
148
|
+
this.secondPoint = null;
|
|
149
|
+
this.previewMeasureLine.clear();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
createNewMeasureIfNeed(): void {
|
|
153
|
+
if (!this.previewMeasureLine) {
|
|
154
|
+
this.previewMeasureLine = this.createMeasureLine();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
createMeasureLine(): MeasureLineItem {
|
|
159
|
+
const viewer = this.m_module.getViewer();
|
|
160
|
+
const item = new MeasureLineItem(this.m_overlayElement, viewer, this.m_module);
|
|
161
|
+
item.lineThickness = this.lineThickness || item.lineThickness;
|
|
162
|
+
item.setUnit(renameUnit(this.renameUnitTable, viewer.getUnit()));
|
|
163
|
+
this.items.push(item);
|
|
164
|
+
return item;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
import { Viewer } from "../Viewer";
|
|
24
|
+
import { Point2d, Point3d } from "./Common/Geometry";
|
|
25
|
+
import { OdBaseDragger } from "./Common/OdBaseDragger";
|
|
26
|
+
|
|
27
|
+
export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
28
|
+
protected m_size_x: number;
|
|
29
|
+
protected m_size_y: number;
|
|
30
|
+
protected m_size_z: number;
|
|
31
|
+
protected m_center: Point3d;
|
|
32
|
+
protected m_normal: number[];
|
|
33
|
+
protected index: number;
|
|
34
|
+
protected m_model: any;
|
|
35
|
+
protected m_entity: any;
|
|
36
|
+
protected planePreview: any;
|
|
37
|
+
protected m_last: Point3d;
|
|
38
|
+
protected m_click: Point2d;
|
|
39
|
+
|
|
40
|
+
constructor(subject: Viewer) {
|
|
41
|
+
super(subject);
|
|
42
|
+
this.press = false;
|
|
43
|
+
|
|
44
|
+
//this.getViewer().getMarkupController().clear();
|
|
45
|
+
|
|
46
|
+
const ext = this.getViewer().getActiveExtents();
|
|
47
|
+
const min = ext.min();
|
|
48
|
+
const max = ext.max();
|
|
49
|
+
|
|
50
|
+
this.m_size_x = Math.abs(max[0] - min[0]) / 2;
|
|
51
|
+
this.m_size_y = Math.abs(max[1] - min[1]) / 2;
|
|
52
|
+
this.m_size_z = Math.abs(max[2] - min[2]) / 2;
|
|
53
|
+
|
|
54
|
+
this.m_center = this.toPoint(ext.center());
|
|
55
|
+
this.m_normal = this.createNormal();
|
|
56
|
+
|
|
57
|
+
const avp = this.getViewer().activeView;
|
|
58
|
+
const plane = this.createPlane();
|
|
59
|
+
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
60
|
+
|
|
61
|
+
avp.addCuttingPlane(plane);
|
|
62
|
+
this.index = avp.numCuttingPlanes() - 1;
|
|
63
|
+
|
|
64
|
+
const { red, green, blue } = this.subject.options.cuttingPlaneFillColor;
|
|
65
|
+
avp.setEnableCuttingPlaneFill(true, red, green, blue);
|
|
66
|
+
avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kHorizontalBars, 0x0, 0x0, 0x0);
|
|
67
|
+
|
|
68
|
+
this.m_model = this.getModel();
|
|
69
|
+
this.createPreview();
|
|
70
|
+
|
|
71
|
+
this.deleteAll([ext, avp, plane]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
override dispose(): void {
|
|
75
|
+
super.dispose();
|
|
76
|
+
|
|
77
|
+
if (this.m_entity) {
|
|
78
|
+
this.m_model.removeEntity(this.m_entity);
|
|
79
|
+
this.deleteAll([this.m_model, this.m_entity, this.planePreview, this.m_center]);
|
|
80
|
+
this.m_entity = null;
|
|
81
|
+
this.planePreview = null;
|
|
82
|
+
this.subject.update();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
createNormal(): number[] {
|
|
87
|
+
return [0, 0, 0];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
handleDelta(delta: Point3d): Point3d {
|
|
91
|
+
return delta;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
getPlanePreviewCoordinate(): any[] {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
override start(x: number, y: number): void {
|
|
99
|
+
this.press = true;
|
|
100
|
+
this.m_last = this.screenToWorld(x, y);
|
|
101
|
+
this.m_click = { x, y };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
override drag(x: number, y: number): void {
|
|
105
|
+
if (this.press) {
|
|
106
|
+
const point = this.screenToWorld(x, y);
|
|
107
|
+
const delta = this.handleDelta(point.sub(this.m_last));
|
|
108
|
+
|
|
109
|
+
const oldCenter = this.m_center;
|
|
110
|
+
this.m_center = oldCenter.add(delta);
|
|
111
|
+
|
|
112
|
+
const oldLast = this.m_last;
|
|
113
|
+
this.m_last = point;
|
|
114
|
+
|
|
115
|
+
const avp = this.getViewer().activeView;
|
|
116
|
+
const plane = this.createPlane();
|
|
117
|
+
const newPlane = plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
118
|
+
const newCutting = avp.updateCuttingPlane(this.index, plane);
|
|
119
|
+
|
|
120
|
+
this.drawPreview();
|
|
121
|
+
|
|
122
|
+
this.deleteAll([avp, plane, oldCenter, delta, oldLast, newPlane, newCutting]);
|
|
123
|
+
|
|
124
|
+
const device = this.getViewer().getActiveDevice();
|
|
125
|
+
device.invalidate(device.getSize());
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
override end(x: number, y: number): void {
|
|
130
|
+
this.press = false;
|
|
131
|
+
if (x === this.m_click.x && y === this.m_click.y) {
|
|
132
|
+
this.m_normal = [this.m_normal[0] * -1, this.m_normal[1] * -1, this.m_normal[2] * -1];
|
|
133
|
+
|
|
134
|
+
const avp = this.getViewer().activeView;
|
|
135
|
+
const plane = this.createPlane();
|
|
136
|
+
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
137
|
+
avp.updateCuttingPlane(this.index, plane);
|
|
138
|
+
|
|
139
|
+
this.deleteAll([avp, plane, this.m_last]);
|
|
140
|
+
|
|
141
|
+
const device = this.getViewer().getActiveDevice();
|
|
142
|
+
device.invalidate(device.getSize());
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
createPreview(): void {
|
|
147
|
+
this.m_entity = this.m_model.appendEntity("&CuttingPlanePreview");
|
|
148
|
+
|
|
149
|
+
const GeometryTypes = this.m_module.GeometryTypes;
|
|
150
|
+
|
|
151
|
+
const transparencyDef = new this.m_module.OdTvTransparencyDef();
|
|
152
|
+
const colorDef = new this.m_module.OdTvColorDef(112, 112, 112); //0x53, 0x72, 0xAE
|
|
153
|
+
|
|
154
|
+
transparencyDef.setValue(0.9);
|
|
155
|
+
|
|
156
|
+
const entityPtr = this.m_entity.openObject();
|
|
157
|
+
entityPtr.setColor(colorDef, GeometryTypes.kFaces.value);
|
|
158
|
+
|
|
159
|
+
colorDef.setColor(112, 112, 112); //0xcd, 0xe2, 0xff
|
|
160
|
+
entityPtr.setColor(colorDef, GeometryTypes.kEdges.value);
|
|
161
|
+
|
|
162
|
+
entityPtr.setLineWeight(5);
|
|
163
|
+
|
|
164
|
+
entityPtr.setTransparency(transparencyDef, GeometryTypes.kFaces);
|
|
165
|
+
transparencyDef.setValue(1.0);
|
|
166
|
+
entityPtr.setTransparency(transparencyDef, GeometryTypes.kEdges);
|
|
167
|
+
|
|
168
|
+
this.planePreview = entityPtr.appendPolygon(this.getPlanePreviewCoordinate());
|
|
169
|
+
const polygonPtr = this.planePreview.openAsPolygon();
|
|
170
|
+
polygonPtr.setFilled(true);
|
|
171
|
+
|
|
172
|
+
this.deleteAll([transparencyDef, colorDef, entityPtr, polygonPtr, GeometryTypes]);
|
|
173
|
+
this.subject.syncOverlay();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
drawPreview(): void {
|
|
177
|
+
const polygonPtr = this.planePreview.openAsPolygon();
|
|
178
|
+
polygonPtr.setPoints(this.getPlanePreviewCoordinate());
|
|
179
|
+
this.deleteAll([polygonPtr]);
|
|
180
|
+
this.subject.syncOverlay();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
import { Point3d } from "./Common/Geometry";
|
|
24
|
+
import { OdBaseCuttingPlaneDragger } from "./OdBaseCuttingPlaneDragger";
|
|
25
|
+
|
|
26
|
+
export class OdCuttingPlaneXAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
27
|
+
override createNormal(): number[] {
|
|
28
|
+
return [1, 0, 0];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override handleDelta(delta: Point3d): Point3d {
|
|
32
|
+
delta.y = 0.0;
|
|
33
|
+
delta.z = 0.0;
|
|
34
|
+
return delta;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override getPlanePreviewCoordinate(): number[] {
|
|
38
|
+
return [
|
|
39
|
+
this.m_center.x,
|
|
40
|
+
this.m_center.y - this.m_size_y,
|
|
41
|
+
this.m_center.z - this.m_size_z,
|
|
42
|
+
this.m_center.x,
|
|
43
|
+
this.m_center.y + this.m_size_y,
|
|
44
|
+
this.m_center.z - this.m_size_z,
|
|
45
|
+
this.m_center.x,
|
|
46
|
+
this.m_center.y + this.m_size_y,
|
|
47
|
+
this.m_center.z + this.m_size_z,
|
|
48
|
+
this.m_center.x,
|
|
49
|
+
this.m_center.y - this.m_size_y,
|
|
50
|
+
this.m_center.z + this.m_size_z,
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
import { Point3d } from "./Common/Geometry";
|
|
24
|
+
import { OdBaseCuttingPlaneDragger } from "./OdBaseCuttingPlaneDragger";
|
|
25
|
+
|
|
26
|
+
export class OdCuttingPlaneYAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
27
|
+
override createNormal(): number[] {
|
|
28
|
+
return [0, 1, 0];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override handleDelta(delta: Point3d): Point3d {
|
|
32
|
+
delta.x = 0.0;
|
|
33
|
+
delta.z = 0.0;
|
|
34
|
+
return delta;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override getPlanePreviewCoordinate(): number[] {
|
|
38
|
+
return [
|
|
39
|
+
this.m_center.x - this.m_size_x,
|
|
40
|
+
this.m_center.y,
|
|
41
|
+
this.m_center.z - this.m_size_z,
|
|
42
|
+
this.m_center.x + this.m_size_x,
|
|
43
|
+
this.m_center.y,
|
|
44
|
+
this.m_center.z - this.m_size_z,
|
|
45
|
+
this.m_center.x + this.m_size_x,
|
|
46
|
+
this.m_center.y,
|
|
47
|
+
this.m_center.z + this.m_size_z,
|
|
48
|
+
this.m_center.x - this.m_size_x,
|
|
49
|
+
this.m_center.y,
|
|
50
|
+
this.m_center.z + this.m_size_z,
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
import { Point3d } from "./Common/Geometry";
|
|
24
|
+
import { OdBaseCuttingPlaneDragger } from "./OdBaseCuttingPlaneDragger";
|
|
25
|
+
|
|
26
|
+
export class OdCuttingPlaneZAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
27
|
+
override createNormal(): number[] {
|
|
28
|
+
return [0, 0, 1];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override handleDelta(delta: Point3d): Point3d {
|
|
32
|
+
delta.x = 0.0;
|
|
33
|
+
delta.y = 0.0;
|
|
34
|
+
return delta;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override getPlanePreviewCoordinate(): number[] {
|
|
38
|
+
return [
|
|
39
|
+
this.m_center.x - this.m_size_x,
|
|
40
|
+
this.m_center.y - this.m_size_y,
|
|
41
|
+
this.m_center.z,
|
|
42
|
+
this.m_center.x + this.m_size_x,
|
|
43
|
+
this.m_center.y - this.m_size_y,
|
|
44
|
+
this.m_center.z,
|
|
45
|
+
this.m_center.x + this.m_size_x,
|
|
46
|
+
this.m_center.y + this.m_size_y,
|
|
47
|
+
this.m_center.z,
|
|
48
|
+
this.m_center.x - this.m_size_x,
|
|
49
|
+
this.m_center.y + this.m_size_y,
|
|
50
|
+
this.m_center.z,
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
/* eslint-disable no-unused-vars */
|
|
24
|
+
import { Viewer } from "../Viewer";
|
|
25
|
+
import { OrbitAction } from "./Actions/OrbitAction";
|
|
26
|
+
import { Point2d } from "./Common/Geometry";
|
|
27
|
+
import { OdBaseDragger } from "./Common/OdBaseDragger";
|
|
28
|
+
|
|
29
|
+
export class OdOrbitDragger extends OdBaseDragger {
|
|
30
|
+
private _orbitAction: OrbitAction;
|
|
31
|
+
protected m_viewCenter: any;
|
|
32
|
+
protected m_startPoint: Point2d;
|
|
33
|
+
protected startCameraParams: any;
|
|
34
|
+
|
|
35
|
+
constructor(subject: Viewer) {
|
|
36
|
+
super(subject);
|
|
37
|
+
this.autoSelect = true;
|
|
38
|
+
this.press = false;
|
|
39
|
+
this._orbitAction = new OrbitAction(this.m_module, this.subject, this.beginInteractivity, this.endInteractivity);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
override start(x: number, y: number): void {
|
|
43
|
+
this.press = true;
|
|
44
|
+
this._orbitAction.beginAction(x, y);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
setDefaultViewParams(): void {
|
|
48
|
+
const extView = this.getViewer().getActiveTvExtendedView();
|
|
49
|
+
extView.setView(
|
|
50
|
+
this.startCameraParams.position,
|
|
51
|
+
this.startCameraParams.target,
|
|
52
|
+
this.startCameraParams.upVector,
|
|
53
|
+
this.startCameraParams.viewFieldWidth,
|
|
54
|
+
this.startCameraParams.viewFieldHeight,
|
|
55
|
+
this.startCameraParams.perspective
|
|
56
|
+
);
|
|
57
|
+
extView.delete();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
override drag(x: number, y: number, dltX: number, dltY: number): void {
|
|
61
|
+
if (this.press) {
|
|
62
|
+
this._orbitAction.action(x, y);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
override end(): void {
|
|
67
|
+
this.press = false;
|
|
68
|
+
this._orbitAction.endAction();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
/* eslint-disable no-unused-vars */
|
|
24
|
+
import { Viewer } from "../Viewer";
|
|
25
|
+
import { PanAction } from "./Actions/PanAction";
|
|
26
|
+
import { Point3d } from "./Common/Geometry";
|
|
27
|
+
import { OdBaseDragger } from "./Common/OdBaseDragger";
|
|
28
|
+
|
|
29
|
+
export class OdPanDragger extends OdBaseDragger {
|
|
30
|
+
private _panAction: PanAction;
|
|
31
|
+
protected m_start: Point3d;
|
|
32
|
+
|
|
33
|
+
constructor(subject: Viewer) {
|
|
34
|
+
super(subject);
|
|
35
|
+
this.autoSelect = true;
|
|
36
|
+
this.press = false;
|
|
37
|
+
this._panAction = new PanAction(
|
|
38
|
+
this.m_module,
|
|
39
|
+
this.subject,
|
|
40
|
+
this.beginInteractivity,
|
|
41
|
+
this.endInteractivity,
|
|
42
|
+
this.getViewParams,
|
|
43
|
+
this.setViewParams
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override start(x: number, y: number): void {
|
|
48
|
+
this.press = true;
|
|
49
|
+
this._panAction.beginAction(x, y);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
override drag(x: number, y: number, dltX: number, dltY: number): void {
|
|
53
|
+
if (this.press) {
|
|
54
|
+
this._panAction.action(x, y);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
override end(x: number, y: number): void {
|
|
59
|
+
this.press = false;
|
|
60
|
+
this._panAction.endAction();
|
|
61
|
+
}
|
|
62
|
+
}
|