@x-viewer/plugins 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/index.esm.js +264 -0
- package/dist/types/axis-gizmo/AxisGizmoPlugin.d.ts +51 -0
- package/dist/types/axis-gizmo/CoordinateAxes.d.ts +14 -0
- package/dist/types/axis-gizmo/index.d.ts +2 -0
- package/dist/types/bottom-bar/BottomBarPlugin.d.ts +42 -0
- package/dist/types/bottom-bar/index.d.ts +2 -0
- package/dist/types/context-menu/Constants.d.ts +34 -0
- package/dist/types/context-menu/ContextMenu.config.d.ts +2 -0
- package/dist/types/context-menu/ContextMenuPlugin.d.ts +36 -0
- package/dist/types/context-menu/Locale.d.ts +48 -0
- package/dist/types/context-menu/index.d.ts +4 -0
- package/dist/types/dat-gui/Viewer3dDatGui.d.ts +66 -0
- package/dist/types/dat-gui/index.d.ts +1 -0
- package/dist/types/explode/ExplodePlugin.d.ts +46 -0
- package/dist/types/explode/ObjectExploder.d.ts +48 -0
- package/dist/types/explode/index.d.ts +1 -0
- package/dist/types/export/ExportPlugin.d.ts +53 -0
- package/dist/types/export/index.d.ts +2 -0
- package/dist/types/ground-grass/GroundGrassPlugin.d.ts +45 -0
- package/dist/types/ground-grass/index.d.ts +1 -0
- package/dist/types/ground-grid/GroundGridPlugin.d.ts +46 -0
- package/dist/types/ground-grid/index.d.ts +1 -0
- package/dist/types/ground-shaow/GroundShadowPlugin.d.ts +64 -0
- package/dist/types/ground-shaow/index.d.ts +1 -0
- package/dist/types/hotpoint/HotpointPlugin.d.ts +103 -0
- package/dist/types/hotpoint/index.d.ts +1 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/layer-manager/LayerManagerPlugin.d.ts +51 -0
- package/dist/types/layer-manager/index.d.ts +2 -0
- package/dist/types/local-model-uploader/IUploader.d.ts +19 -0
- package/dist/types/local-model-uploader/LocalDxfUploader.d.ts +22 -0
- package/dist/types/local-model-uploader/LocalModelUploader.d.ts +24 -0
- package/dist/types/local-model-uploader/index.d.ts +3 -0
- package/dist/types/markups/ArrowMarkup.d.ts +12 -0
- package/dist/types/markups/BaseMarkup.d.ts +33 -0
- package/dist/types/markups/CircleMarkup.d.ts +12 -0
- package/dist/types/markups/CloudLineMarkup.d.ts +10 -0
- package/dist/types/markups/CloudRectMarkup.d.ts +11 -0
- package/dist/types/markups/CloudRectWithTextMarkup.d.ts +42 -0
- package/dist/types/markups/Constants.d.ts +17 -0
- package/dist/types/markups/DotMarkup.d.ts +9 -0
- package/dist/types/markups/EllipseMarkup.d.ts +12 -0
- package/dist/types/markups/LeaderLineMarkup.d.ts +25 -0
- package/dist/types/markups/MarkupPlugin.d.ts +91 -0
- package/dist/types/markups/PolylineMarkup.d.ts +10 -0
- package/dist/types/markups/RectMarkup.d.ts +11 -0
- package/dist/types/markups/TextMarkup.d.ts +44 -0
- package/dist/types/markups/XMarkup.d.ts +10 -0
- package/dist/types/markups/index.d.ts +14 -0
- package/dist/types/markups/undo/AddMarkupCommand.d.ts +10 -0
- package/dist/types/markups/undo/RemoveMarkupCommand.d.ts +10 -0
- package/dist/types/markups/undo/UpdateMarkupCommand.d.ts +11 -0
- package/dist/types/measurements/AngleMeasureDrawable.d.ts +12 -0
- package/dist/types/measurements/AngleMeasurement.d.ts +13 -0
- package/dist/types/measurements/AreaMeasureDrawable.d.ts +14 -0
- package/dist/types/measurements/AreaMeasurement.d.ts +28 -0
- package/dist/types/measurements/BaseMeasureDrawable.d.ts +28 -0
- package/dist/types/measurements/BaseMeasurement.d.ts +124 -0
- package/dist/types/measurements/CoordinateMeasureDrawable.d.ts +10 -0
- package/dist/types/measurements/CoordinateMeasurement.d.ts +12 -0
- package/dist/types/measurements/DistanceMeasureDrawable.d.ts +15 -0
- package/dist/types/measurements/DistanceMeasurement.d.ts +25 -0
- package/dist/types/measurements/Locale.d.ts +10 -0
- package/dist/types/measurements/MeasurementPlugin.d.ts +140 -0
- package/dist/types/measurements/index.d.ts +3 -0
- package/dist/types/measurements/undo/AddMeasurementCommand.d.ts +10 -0
- package/dist/types/measurements/undo/RemoveMeasurementCommand.d.ts +10 -0
- package/dist/types/nav-cube/Locale.d.ts +18 -0
- package/dist/types/nav-cube/NavCube.d.ts +12 -0
- package/dist/types/nav-cube/NavCubePlugin.d.ts +36 -0
- package/dist/types/nav-cube/index.d.ts +2 -0
- package/dist/types/overview-map/ImageDrawable.d.ts +28 -0
- package/dist/types/overview-map/OverviewMapPlugin.d.ts +16 -0
- package/dist/types/overview-map/OverviewMapViewer.d.ts +50 -0
- package/dist/types/overview-map/index.d.ts +1 -0
- package/dist/types/pdf/PdfLoader.d.ts +238 -0
- package/dist/types/pdf/PdfLoaderPlugin.d.ts +47 -0
- package/dist/types/pdf/index.d.ts +2 -0
- package/dist/types/property/Locale.d.ts +8 -0
- package/dist/types/property/PropertyPlugin.d.ts +76 -0
- package/dist/types/property/index.d.ts +2 -0
- package/dist/types/screenshot/ScreenshotPlugin.d.ts +153 -0
- package/dist/types/screenshot/index.d.ts +1 -0
- package/dist/types/sections/AxisPlaneSection.d.ts +63 -0
- package/dist/types/sections/AxisSectionPopPanel.d.ts +18 -0
- package/dist/types/sections/BaseSection.d.ts +61 -0
- package/dist/types/sections/Locale.d.ts +16 -0
- package/dist/types/sections/ObjectsBoxSection.d.ts +28 -0
- package/dist/types/sections/PickPlaneSection.d.ts +42 -0
- package/dist/types/sections/PickSectionPopPanel.d.ts +18 -0
- package/dist/types/sections/Section.constants.d.ts +13 -0
- package/dist/types/sections/SectionGizmo.d.ts +22 -0
- package/dist/types/sections/SectionPlaneMesh.d.ts +23 -0
- package/dist/types/sections/SectionPlugin.d.ts +87 -0
- package/dist/types/sections/index.d.ts +6 -0
- package/dist/types/settings-2d/Locale.d.ts +14 -0
- package/dist/types/settings-2d/Settings2dPlugin.d.ts +55 -0
- package/dist/types/settings-2d/index.d.ts +2 -0
- package/dist/types/settings-3d/Locale.d.ts +50 -0
- package/dist/types/settings-3d/Settings3dPlugin.d.ts +51 -0
- package/dist/types/settings-3d/index.d.ts +2 -0
- package/dist/types/skybox/GradientColorSkybox.d.ts +9 -0
- package/dist/types/skybox/SkyboxPlugin.d.ts +49 -0
- package/dist/types/skybox/index.d.ts +1 -0
- package/dist/types/stats/StatsPlugin.d.ts +19 -0
- package/dist/types/stats/index.d.ts +2 -0
- package/dist/types/toolbars/Locale.d.ts +98 -0
- package/dist/types/toolbars/MarkupToolbar.d.ts +18 -0
- package/dist/types/toolbars/Toolbar.config.d.ts +9 -0
- package/dist/types/toolbars/Toolbar.constants.d.ts +95 -0
- package/dist/types/toolbars/Toolbar.d.ts +107 -0
- package/dist/types/toolbars/Viewer2dToolbarPlugin.d.ts +37 -0
- package/dist/types/toolbars/Viewer3dToolbarPlugin.d.ts +37 -0
- package/dist/types/toolbars/index.d.ts +7 -0
- package/dist/types/tree-view/Locale.d.ts +8 -0
- package/dist/types/tree-view/TreeViewPlugin.d.ts +71 -0
- package/dist/types/tree-view/index.d.ts +2 -0
- package/dist/types/view-cube/Locale.d.ts +18 -0
- package/dist/types/view-cube/ViewCube.d.ts +79 -0
- package/dist/types/view-cube/ViewCubePlugin.d.ts +55 -0
- package/dist/types/view-cube/index.d.ts +2 -0
- package/package.json +58 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "@x-viewer/core";
|
|
2
|
+
import { MarkupData } from "../BaseMarkup";
|
|
3
|
+
import { type MarkupPlugin } from "../MarkupPlugin";
|
|
4
|
+
export declare class RemoveMarkupCommand extends Command {
|
|
5
|
+
private manager;
|
|
6
|
+
private data;
|
|
7
|
+
constructor(manager: MarkupPlugin, data: MarkupData);
|
|
8
|
+
undo(): boolean;
|
|
9
|
+
redo(): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from "@x-viewer/core";
|
|
2
|
+
import { MarkupData } from "../BaseMarkup";
|
|
3
|
+
import { type MarkupPlugin } from "../MarkupPlugin";
|
|
4
|
+
export declare class UpdateMarkupCommand extends Command {
|
|
5
|
+
private manager;
|
|
6
|
+
private oldData;
|
|
7
|
+
private newData;
|
|
8
|
+
constructor(manager: MarkupPlugin, oldData: MarkupData, newData: MarkupData);
|
|
9
|
+
undo(): boolean;
|
|
10
|
+
redo(): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { THREE } from "@x-viewer/core";
|
|
2
|
+
import { BaseMeasureDrawable } from "./BaseMeasureDrawable";
|
|
3
|
+
import { MeasurementType } from "./BaseMeasurement";
|
|
4
|
+
export declare class AngleMeasureDrawable extends BaseMeasureDrawable {
|
|
5
|
+
type: MeasurementType;
|
|
6
|
+
constructor(id: string, points: THREE.Vector3[]);
|
|
7
|
+
draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
8
|
+
drawText(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
9
|
+
getAngleBisector(startPoint: THREE.Vector3, middlePoint: THREE.Vector3, endPoint: THREE.Vector3): THREE.Vector3;
|
|
10
|
+
calculateAngle(startPoint: THREE.Vector3, middlePoint: THREE.Vector3, endPoint: THREE.Vector3): number;
|
|
11
|
+
getClassType(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseViewer, DrawableList, type OSnapHelper, EventInfo, InputManager } from "@x-viewer/core";
|
|
2
|
+
import { AngleMeasureDrawable } from "./AngleMeasureDrawable";
|
|
3
|
+
import { BaseMeasurement } from "./BaseMeasurement";
|
|
4
|
+
export declare class AngleMeasurement extends BaseMeasurement {
|
|
5
|
+
constructor(viewer: BaseViewer, input: InputManager, drawList: DrawableList, osnapHelper: OSnapHelper);
|
|
6
|
+
protected createMeasureDrawable(): AngleMeasureDrawable | undefined;
|
|
7
|
+
protected onMouseClick(e: EventInfo): void;
|
|
8
|
+
exitDrawing(): void;
|
|
9
|
+
protected complete(): void;
|
|
10
|
+
cancel(): void;
|
|
11
|
+
deactivate(): void;
|
|
12
|
+
protected setTooltipContent(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { THREE } from "@x-viewer/core";
|
|
2
|
+
import { BaseMeasureDrawable } from "./BaseMeasureDrawable";
|
|
3
|
+
import { MeasurementType } from "./BaseMeasurement";
|
|
4
|
+
export declare class AreaMeasureDrawable extends BaseMeasureDrawable {
|
|
5
|
+
type: MeasurementType;
|
|
6
|
+
scale?: number;
|
|
7
|
+
constructor(id: string, points: THREE.Vector3[], scale?: number);
|
|
8
|
+
draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
9
|
+
drawText(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
10
|
+
calculateArea(points: THREE.Vector3[]): number;
|
|
11
|
+
getBarycenter(points: THREE.Vector3[]): THREE.Vector3;
|
|
12
|
+
isPointInPath(p: THREE.Vector3, raycaster?: THREE.Raycaster): boolean;
|
|
13
|
+
getClassType(): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { THREE } from "@x-viewer/core";
|
|
2
|
+
import { type BaseViewer, EventInfo, InputManager, OSnapHelper, DrawableList } from "@x-viewer/core";
|
|
3
|
+
import { AreaMeasureDrawable } from "./AreaMeasureDrawable";
|
|
4
|
+
import { BaseMeasurement } from "./BaseMeasurement";
|
|
5
|
+
export declare class AreaMeasurement extends BaseMeasurement {
|
|
6
|
+
/**
|
|
7
|
+
* The ratio of real world value and the value in three.js(pdf, a map, etc.).
|
|
8
|
+
*/
|
|
9
|
+
private scale?;
|
|
10
|
+
constructor(viewer: BaseViewer, input: InputManager, drawList: DrawableList, osnapHelper: OSnapHelper);
|
|
11
|
+
activate(): void;
|
|
12
|
+
deactivate(): void;
|
|
13
|
+
protected createMeasureDrawable(): AreaMeasureDrawable | undefined;
|
|
14
|
+
protected onMouseMove(position: THREE.Vector3): void;
|
|
15
|
+
protected onMouseClick(e: EventInfo): void;
|
|
16
|
+
exitDrawing(): void;
|
|
17
|
+
protected complete(): void;
|
|
18
|
+
cancel(): void;
|
|
19
|
+
protected setTooltipContent(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Gets the scale value.
|
|
22
|
+
*/
|
|
23
|
+
getScale(): number | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Sets the scale value.
|
|
26
|
+
*/
|
|
27
|
+
setScale(scale: number): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { THREE, Drawable } from "@x-viewer/core";
|
|
2
|
+
import { MeasurementType } from "./BaseMeasurement";
|
|
3
|
+
import type { MeasurementData } from "./BaseMeasurement";
|
|
4
|
+
export declare abstract class BaseMeasureDrawable extends Drawable {
|
|
5
|
+
type: MeasurementType;
|
|
6
|
+
static readonly MAJOR_COLOR = "rgba(249, 157, 11, 0.9)";
|
|
7
|
+
static readonly MINOR_COLOR = "rgb(255, 255, 255)";
|
|
8
|
+
static readonly AREA_FILL_COLOR = "rgba(249, 157, 11, 0.3)";
|
|
9
|
+
static readonly LINE_WIDTH = 2;
|
|
10
|
+
static readonly POINT_RADIUS = 5;
|
|
11
|
+
static readonly LABEL_FONT_SIZE = 14;
|
|
12
|
+
label?: string;
|
|
13
|
+
labelPositon?: THREE.Vector2;
|
|
14
|
+
labelBounds: THREE.Box2;
|
|
15
|
+
drawing: boolean;
|
|
16
|
+
constructor(id: string, points: THREE.Vector3[]);
|
|
17
|
+
setDrawingState(isDrawing: boolean): void;
|
|
18
|
+
drawSelect(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
19
|
+
drawPoints(ctx: CanvasRenderingContext2D, camera: THREE.Camera, points: THREE.Vector3[]): void;
|
|
20
|
+
drawText(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
21
|
+
drawRoundRect(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number): void;
|
|
22
|
+
getVertexes(): THREE.Vector3[];
|
|
23
|
+
update(points: THREE.Vector3[]): this;
|
|
24
|
+
getData(): MeasurementData;
|
|
25
|
+
setData(data: MeasurementData): void;
|
|
26
|
+
isPointInPath(p: THREE.Vector3, raycaster?: THREE.Raycaster): boolean;
|
|
27
|
+
getUnitString(): string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { THREE, type BaseViewer, DrawableData, DrawableList, type MobileTouchHelperDrawable, type OSnapHelper, EventInfo, InputManager, Event } from "@x-viewer/core";
|
|
2
|
+
import { Tooltip } from "@x-viewer/ui";
|
|
3
|
+
import { type BaseMeasureDrawable } from "./BaseMeasureDrawable";
|
|
4
|
+
/**
|
|
5
|
+
* Measurement type. e.g. distance measurement, area measurement, etc.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum MeasurementType {
|
|
8
|
+
Distance = "Distance",
|
|
9
|
+
Area = "Area",
|
|
10
|
+
Angle = "Angle",
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
Coordinate = "Coordinate"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Serializable measurement data
|
|
18
|
+
*/
|
|
19
|
+
export type MeasurementData = DrawableData;
|
|
20
|
+
/**
|
|
21
|
+
* Measurement events.
|
|
22
|
+
*/
|
|
23
|
+
type MeasurementEvents = {
|
|
24
|
+
/**
|
|
25
|
+
* Triggered when clicked on a measurement drawable.
|
|
26
|
+
*/
|
|
27
|
+
onclick: BaseMeasureDrawable;
|
|
28
|
+
/**
|
|
29
|
+
* Triggered when a measurement is completed.
|
|
30
|
+
* At this time, user may continue to do another measurement.
|
|
31
|
+
*/
|
|
32
|
+
complete: BaseMeasureDrawable;
|
|
33
|
+
/**
|
|
34
|
+
* Triggered when measurement is deactivated.
|
|
35
|
+
*/
|
|
36
|
+
deactivate: MeasurementType;
|
|
37
|
+
/**
|
|
38
|
+
* Triggered when the first point is drawn.
|
|
39
|
+
* We need this event to unselect a selected drawable, etc.
|
|
40
|
+
*/
|
|
41
|
+
firstpointpicked: BaseMeasureDrawable;
|
|
42
|
+
/**
|
|
43
|
+
* Triggered before a drawable is added.
|
|
44
|
+
*/
|
|
45
|
+
beforeadd: BaseMeasureDrawable;
|
|
46
|
+
/**
|
|
47
|
+
* Triggered when a drawable is updated.
|
|
48
|
+
*/
|
|
49
|
+
update: BaseMeasureDrawable;
|
|
50
|
+
/**
|
|
51
|
+
* Triggered before a drawable is removed.
|
|
52
|
+
*/
|
|
53
|
+
beforeremove: BaseMeasureDrawable;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* BaseMeasurement class
|
|
57
|
+
*/
|
|
58
|
+
export declare abstract class BaseMeasurement extends Event<MeasurementEvents> {
|
|
59
|
+
protected type: MeasurementType;
|
|
60
|
+
protected viewer: BaseViewer;
|
|
61
|
+
private inputManager;
|
|
62
|
+
protected drawList: DrawableList;
|
|
63
|
+
protected osnapHelper: OSnapHelper;
|
|
64
|
+
protected actived: boolean;
|
|
65
|
+
protected mouseMoved: boolean;
|
|
66
|
+
protected mouseDowned: boolean;
|
|
67
|
+
protected touchDowned: boolean;
|
|
68
|
+
protected lastMoveEvent?: EventInfo;
|
|
69
|
+
protected lastMouseDownPosition?: THREE.Vector3;
|
|
70
|
+
protected mouseDownPositionX: number;
|
|
71
|
+
protected mouseDownPositionY: number;
|
|
72
|
+
protected currentMeasureDrawable?: BaseMeasureDrawable;
|
|
73
|
+
protected drawingPoints?: THREE.Vector3[];
|
|
74
|
+
protected lastClickTime?: number;
|
|
75
|
+
protected tooltip?: Tooltip;
|
|
76
|
+
protected snapPoint?: THREE.Vector3 | undefined;
|
|
77
|
+
protected completed?: boolean;
|
|
78
|
+
protected clickedOnMeasurementDrawable?: BaseMeasureDrawable;
|
|
79
|
+
protected mobileTouchHelper?: MobileTouchHelperDrawable;
|
|
80
|
+
protected exitButton?: HTMLButtonElement;
|
|
81
|
+
protected firstPickedListener?: () => void;
|
|
82
|
+
protected completedListener?: () => void;
|
|
83
|
+
constructor(type: MeasurementType, viewer: BaseViewer, input: InputManager, drawList: DrawableList, osnapHelper: OSnapHelper);
|
|
84
|
+
get overlayRender(): import("@x-viewer/core").CanvasRender;
|
|
85
|
+
get renderer(): THREE.WebGLRenderer;
|
|
86
|
+
/**
|
|
87
|
+
* If measurement is active.
|
|
88
|
+
* Here let's use raycaster to identify whether this measurement is active.
|
|
89
|
+
*/
|
|
90
|
+
get isActive(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* If it started to measure, but a measruement action is not completed yet.
|
|
93
|
+
*/
|
|
94
|
+
get isMeasuring(): boolean;
|
|
95
|
+
setTouchHelper(mobileTouchHelper: MobileTouchHelperDrawable): void;
|
|
96
|
+
protected createMobileExitButton(): HTMLButtonElement;
|
|
97
|
+
activate(): void;
|
|
98
|
+
deactivate(): void;
|
|
99
|
+
protected removeDrawable(drawable: BaseMeasureDrawable): void;
|
|
100
|
+
clearClickedDrawable(): void;
|
|
101
|
+
touchstart: (e: EventInfo) => void;
|
|
102
|
+
touchmove: (e: EventInfo) => void;
|
|
103
|
+
touchend: (e: EventInfo) => void;
|
|
104
|
+
mousedown: (e: EventInfo) => void;
|
|
105
|
+
mousemove: (e: EventInfo) => void;
|
|
106
|
+
mouseup: (e: EventInfo) => void;
|
|
107
|
+
dblclick: () => void;
|
|
108
|
+
protected onMouseClick(e: EventInfo): void;
|
|
109
|
+
protected selectMeasurementByEvent(e: EventInfo): void;
|
|
110
|
+
keydown: (e: EventInfo) => void;
|
|
111
|
+
abstract exitDrawing(): void;
|
|
112
|
+
abstract cancel(): void;
|
|
113
|
+
protected abstract complete(): void;
|
|
114
|
+
protected abstract setTooltipContent(): void;
|
|
115
|
+
protected abstract createMeasureDrawable(): BaseMeasureDrawable | undefined;
|
|
116
|
+
protected onMouseMove(position: THREE.Vector3): void;
|
|
117
|
+
protected createOrUpdateMeasureDrawable(position?: THREE.Vector3): void;
|
|
118
|
+
/**
|
|
119
|
+
* The closest intersection
|
|
120
|
+
* @param e
|
|
121
|
+
*/
|
|
122
|
+
getIntersections: (e: EventInfo) => THREE.Intersection[];
|
|
123
|
+
}
|
|
124
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { THREE } from "@x-viewer/core";
|
|
2
|
+
import { BaseMeasureDrawable } from "./BaseMeasureDrawable";
|
|
3
|
+
import { MeasurementType } from "./BaseMeasurement";
|
|
4
|
+
export declare class CoordinateMeasureDrawable extends BaseMeasureDrawable {
|
|
5
|
+
type: MeasurementType;
|
|
6
|
+
constructor(id: string, points: THREE.Vector3[]);
|
|
7
|
+
draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
8
|
+
drawText(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
9
|
+
getClassType(): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type BaseViewer, DrawableList, OSnapHelper, EventInfo, InputManager } from "@x-viewer/core";
|
|
2
|
+
import { BaseMeasurement } from "./BaseMeasurement";
|
|
3
|
+
import { CoordinateMeasureDrawable } from "./CoordinateMeasureDrawable";
|
|
4
|
+
export declare class CoordinateMeasurement extends BaseMeasurement {
|
|
5
|
+
constructor(viewer: BaseViewer, input: InputManager, drawList: DrawableList, osnapHelper: OSnapHelper);
|
|
6
|
+
protected createMeasureDrawable(): CoordinateMeasureDrawable | undefined;
|
|
7
|
+
protected onMouseClick(e: EventInfo): void;
|
|
8
|
+
exitDrawing(): void;
|
|
9
|
+
protected complete(): void;
|
|
10
|
+
cancel(): void;
|
|
11
|
+
protected setTooltipContent(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { THREE } from "@x-viewer/core";
|
|
2
|
+
import { BaseMeasureDrawable } from "./BaseMeasureDrawable";
|
|
3
|
+
import { MeasurementType } from "./BaseMeasurement";
|
|
4
|
+
export declare class DistanceMeasureDrawable extends BaseMeasureDrawable {
|
|
5
|
+
static readonly SHORT_LINE_LENGTH = 12;
|
|
6
|
+
scale?: number;
|
|
7
|
+
type: MeasurementType;
|
|
8
|
+
constructor(id: string, points: THREE.Vector3[], scale?: number);
|
|
9
|
+
draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
10
|
+
drawText(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
11
|
+
private drawVerticalLine;
|
|
12
|
+
private getShortLineBySegments;
|
|
13
|
+
getClassType(): string;
|
|
14
|
+
setScale(scale: number): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type BaseViewer, EventInfo, InputManager, OSnapHelper, DrawableList } from "@x-viewer/core";
|
|
2
|
+
import { BaseMeasurement } from "./BaseMeasurement";
|
|
3
|
+
import { DistanceMeasureDrawable } from "./DistanceMeasureDrawable";
|
|
4
|
+
export declare class DistanceMeasurement extends BaseMeasurement {
|
|
5
|
+
/**
|
|
6
|
+
* The ratio of real world value and the value in three.js(pdf, a map, etc.).
|
|
7
|
+
*/
|
|
8
|
+
private scale?;
|
|
9
|
+
constructor(viewer: BaseViewer, input: InputManager, drawList: DrawableList, osnapHelper: OSnapHelper);
|
|
10
|
+
protected createMeasureDrawable(): DistanceMeasureDrawable | undefined;
|
|
11
|
+
protected onMouseClick(e: EventInfo): void;
|
|
12
|
+
exitDrawing(): void;
|
|
13
|
+
protected complete(): void;
|
|
14
|
+
cancel(): void;
|
|
15
|
+
deactivate(): void;
|
|
16
|
+
protected setTooltipContent(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the scale value.
|
|
19
|
+
*/
|
|
20
|
+
getScale(): number | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Sets the scale value.
|
|
23
|
+
*/
|
|
24
|
+
setScale(scale: number): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { PluginConfig, THREE } from "@x-viewer/core";
|
|
2
|
+
import { type BaseViewer, Plugin } from "@x-viewer/core";
|
|
3
|
+
import { BaseMeasureDrawable } from "./BaseMeasureDrawable";
|
|
4
|
+
import { MeasurementData, MeasurementType } from "./BaseMeasurement";
|
|
5
|
+
/**
|
|
6
|
+
* Measurement plugin config.
|
|
7
|
+
*/
|
|
8
|
+
export interface MeasurementPluginConfig extends Partial<PluginConfig> {
|
|
9
|
+
language?: "cn" | "en";
|
|
10
|
+
}
|
|
11
|
+
export declare class MeasurementPlugin extends Plugin {
|
|
12
|
+
static readonly DEFAULT_ID = "MeasurementPlugin";
|
|
13
|
+
private cfg;
|
|
14
|
+
selectedDrawable: BaseMeasureDrawable | undefined;
|
|
15
|
+
private overlayRender?;
|
|
16
|
+
private drawableList;
|
|
17
|
+
private drawableHelperList;
|
|
18
|
+
private inputManager;
|
|
19
|
+
private osnapHelper;
|
|
20
|
+
private snapToleranceInPixel;
|
|
21
|
+
private measurements;
|
|
22
|
+
private activeMeasurementType;
|
|
23
|
+
private mobileTouchHelper?;
|
|
24
|
+
private enableSelection?;
|
|
25
|
+
constructor(viewer: BaseViewer, cfg?: MeasurementPluginConfig);
|
|
26
|
+
private initLocalization;
|
|
27
|
+
private initEvents;
|
|
28
|
+
protected get canvas(): HTMLCanvasElement;
|
|
29
|
+
protected get raycaster(): THREE.Raycaster;
|
|
30
|
+
add(drawable: BaseMeasureDrawable, needFireEvent?: boolean): void;
|
|
31
|
+
create(data: MeasurementData): BaseMeasureDrawable;
|
|
32
|
+
remove(drawable: BaseMeasureDrawable, needFireEvent?: boolean): void;
|
|
33
|
+
/**
|
|
34
|
+
* Set osnap tolerance in pixcel size. The pixcel size will be converted to a size in world coordinate and pass to OSnapHelper.
|
|
35
|
+
*/
|
|
36
|
+
setSnapTolerance(toleranceInPixel: number): void;
|
|
37
|
+
/**
|
|
38
|
+
* Updates osnap tolerance.
|
|
39
|
+
* We should call this once camera's zoom, fov or position/target changed, etc.
|
|
40
|
+
*/
|
|
41
|
+
private updateSnapTolerance;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param {MeasurementType} type
|
|
45
|
+
* @description {en} Activates one of "Distance", "Area" or "Angle" measurement
|
|
46
|
+
* @description {zh} 激活"距离", "面积" 或者 "角度"测量
|
|
47
|
+
*/
|
|
48
|
+
activate(type: MeasurementType): void;
|
|
49
|
+
/**
|
|
50
|
+
* @description {en} Deactivates measurement.
|
|
51
|
+
* @description {zh} 退出测量。
|
|
52
|
+
*/
|
|
53
|
+
deactivate(): void;
|
|
54
|
+
getActiveMeasurementType(): MeasurementType | undefined;
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @returns {boolean}
|
|
58
|
+
* @description Is measure plugin active
|
|
59
|
+
*/
|
|
60
|
+
isActive(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @returns {boolean} Is measuring now
|
|
64
|
+
*/
|
|
65
|
+
isMeasuring(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @returns {MeasurementData[]}
|
|
69
|
+
* @description {en} Gets all measurements.
|
|
70
|
+
* @description {zh} 获取所有测量数据。
|
|
71
|
+
*/
|
|
72
|
+
getData(): MeasurementData[];
|
|
73
|
+
/**
|
|
74
|
+
* @description {en} Cancels current measurement. This won't deactivate measurement, rather, you can start a new measurement.
|
|
75
|
+
* @description {zh} 取消当前的测量绘制。这并不会退出测量,用户可以开始一个新的测量。
|
|
76
|
+
*/
|
|
77
|
+
cancel(): void;
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* @param {MeasurementData[]} dataArray
|
|
81
|
+
* @description {en} Sets measurement data.
|
|
82
|
+
* @description {zh} 设置测量数据。
|
|
83
|
+
*/
|
|
84
|
+
setData(dataArray: MeasurementData[]): void;
|
|
85
|
+
/**
|
|
86
|
+
* Sets a measurement drawable's visibility by id.
|
|
87
|
+
* @param id
|
|
88
|
+
* @param visible
|
|
89
|
+
* @returns
|
|
90
|
+
* @description Sets a measurement's visibility.
|
|
91
|
+
*/
|
|
92
|
+
setVisibleById(id: string, visible: boolean): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Sets all measurement drawables' visibilities.
|
|
95
|
+
*/
|
|
96
|
+
setVisibilities(visible: boolean): void;
|
|
97
|
+
/**
|
|
98
|
+
* @description {en} Clears measurement results.
|
|
99
|
+
* @description {zh} 清除测量结果。
|
|
100
|
+
*/
|
|
101
|
+
clear(): void;
|
|
102
|
+
/**
|
|
103
|
+
* Gets a measurement drawable by id.
|
|
104
|
+
*/
|
|
105
|
+
getById(id: string): BaseMeasureDrawable;
|
|
106
|
+
removeById(id: string): void;
|
|
107
|
+
/**
|
|
108
|
+
* Selects a measurement drawable by id.
|
|
109
|
+
* @param {string} id
|
|
110
|
+
* @description Selects a measurement by id
|
|
111
|
+
*/
|
|
112
|
+
selectById(id: string): void;
|
|
113
|
+
/**
|
|
114
|
+
* Selects a measurement drawable.
|
|
115
|
+
*/
|
|
116
|
+
select(drawable: BaseMeasureDrawable): void;
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @param renderEnabled If need render measurement
|
|
120
|
+
* @description Unselects a measurement.
|
|
121
|
+
*/
|
|
122
|
+
unselect(renderEnabled?: boolean): void;
|
|
123
|
+
/**
|
|
124
|
+
* Gets the scale value.
|
|
125
|
+
* Scale is the ratio of real world value and the value in three.js(pdf, a map, etc.).
|
|
126
|
+
* e.g., Real world distance is 1000, and the value in three.js is 1, then scale is 1000.
|
|
127
|
+
* We should display 1000 rather than 1 while measuring.
|
|
128
|
+
*/
|
|
129
|
+
getScale(): number | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Sets the scale value.
|
|
132
|
+
*/
|
|
133
|
+
setScale(scale: number | undefined): void;
|
|
134
|
+
/**
|
|
135
|
+
* @description Destroy measure plugin
|
|
136
|
+
*/
|
|
137
|
+
destroy(): void;
|
|
138
|
+
private keydown;
|
|
139
|
+
private render;
|
|
140
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "@x-viewer/core";
|
|
2
|
+
import { MeasurementData } from "../BaseMeasurement";
|
|
3
|
+
import { type MeasurementPlugin } from "../MeasurementPlugin";
|
|
4
|
+
export declare class AddMeasurementCommand extends Command {
|
|
5
|
+
private manager;
|
|
6
|
+
private data;
|
|
7
|
+
constructor(manager: MeasurementPlugin, data: MeasurementData);
|
|
8
|
+
undo(): boolean;
|
|
9
|
+
redo(): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "@x-viewer/core";
|
|
2
|
+
import { MeasurementData } from "../BaseMeasurement";
|
|
3
|
+
import { type MeasurementPlugin } from "../MeasurementPlugin";
|
|
4
|
+
export declare class RemoveMeasurementCommand extends Command {
|
|
5
|
+
private manager;
|
|
6
|
+
private data;
|
|
7
|
+
constructor(manager: MeasurementPlugin, data: MeasurementData);
|
|
8
|
+
undo(): boolean;
|
|
9
|
+
redo(): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { i18next } from "@x-viewer/core";
|
|
2
|
+
export declare const en: {
|
|
3
|
+
front: string;
|
|
4
|
+
back: string;
|
|
5
|
+
top: string;
|
|
6
|
+
bottom: string;
|
|
7
|
+
left: string;
|
|
8
|
+
right: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const cn: {
|
|
11
|
+
front: string;
|
|
12
|
+
back: string;
|
|
13
|
+
top: string;
|
|
14
|
+
bottom: string;
|
|
15
|
+
left: string;
|
|
16
|
+
right: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const i18n: i18next.i18n;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { THREE } from "@x-viewer/core";
|
|
2
|
+
export interface NavCubeConfig {
|
|
3
|
+
onClick?: (direction: THREE.Vector3, rotation: THREE.Euler) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare class NavCube extends THREE.Object3D {
|
|
6
|
+
NAVCUBE_SIZE: number;
|
|
7
|
+
private clickHandler;
|
|
8
|
+
constructor(cfg?: NavCubeConfig);
|
|
9
|
+
private createPlane;
|
|
10
|
+
private createEdge;
|
|
11
|
+
private createCorner;
|
|
12
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type BaseViewer, Plugin, PluginConfig, THREE, THREEAddons } from "@x-viewer/core";
|
|
2
|
+
import { NavCube } from "./NavCube";
|
|
3
|
+
/**
|
|
4
|
+
* ViewCube plugin config.
|
|
5
|
+
*/
|
|
6
|
+
export interface NavCubePluginConfig extends Partial<PluginConfig> {
|
|
7
|
+
containerId: string;
|
|
8
|
+
language?: "cn" | "en";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* This renderer monitors the host renderer's camera, and keeps a NavCube
|
|
12
|
+
* the same direction as host renderer's
|
|
13
|
+
*/
|
|
14
|
+
export declare class NavCubePlugin extends Plugin {
|
|
15
|
+
static readonly DEFAULT_ID = "NavCubePlugin";
|
|
16
|
+
protected cfg: NavCubePluginConfig;
|
|
17
|
+
protected renderer?: THREEAddons.CSS3DRenderer;
|
|
18
|
+
protected navCube?: NavCube;
|
|
19
|
+
protected camera?: THREE.OrthographicCamera;
|
|
20
|
+
protected scene?: THREE.Scene;
|
|
21
|
+
constructor(viewer: BaseViewer, cfg?: NavCubePluginConfig);
|
|
22
|
+
protected init(): void;
|
|
23
|
+
private initLocalization;
|
|
24
|
+
protected initRenderer(): void;
|
|
25
|
+
protected initScene(): void;
|
|
26
|
+
protected render(): void;
|
|
27
|
+
protected animate(): void;
|
|
28
|
+
protected update(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Update navCube according to camera direction.
|
|
31
|
+
* Camera's direction is the only input factor for this class. It always look at the origin.
|
|
32
|
+
* @param direction
|
|
33
|
+
*/
|
|
34
|
+
protected updateCameraDirection(direction: THREE.Vector3, up: THREE.Vector3): void;
|
|
35
|
+
destroy(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Drawable, THREE } from "@x-viewer/core";
|
|
2
|
+
export interface ImageConfig {
|
|
3
|
+
image: HTMLImageElement;
|
|
4
|
+
hoverImage: HTMLImageElement;
|
|
5
|
+
offset: THREE.Vector2;
|
|
6
|
+
rotationPoint: THREE.Vector2;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class ImageDrawable extends Drawable {
|
|
11
|
+
imageConfig: ImageConfig;
|
|
12
|
+
isHover: boolean;
|
|
13
|
+
rotation: number;
|
|
14
|
+
position: THREE.Vector3;
|
|
15
|
+
protected x: number;
|
|
16
|
+
protected y: number;
|
|
17
|
+
protected width: number;
|
|
18
|
+
protected height: number;
|
|
19
|
+
constructor(id: string, imageConfig: ImageConfig);
|
|
20
|
+
draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
21
|
+
drawSelect(ctx: CanvasRenderingContext2D): void;
|
|
22
|
+
drawImage(ctx: CanvasRenderingContext2D, camera: THREE.Camera, imageConfig: ImageConfig): void;
|
|
23
|
+
setRotation(rotation: number): void;
|
|
24
|
+
setPosition(position: THREE.Vector3): void;
|
|
25
|
+
isPointInPath(p: THREE.Vector3, raycaster: THREE.Raycaster): boolean;
|
|
26
|
+
getVertexes(): THREE.Vector3[];
|
|
27
|
+
getClassType(): string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { THREE, ViewerEvent, Plugin, PluginConfig, BaseViewer } from "@x-viewer/core";
|
|
2
|
+
import { OverviewMapViewer } from "./OverviewMapViewer";
|
|
3
|
+
export interface OverviewMapPluginConfig extends Partial<PluginConfig> {
|
|
4
|
+
containerId: string;
|
|
5
|
+
image: string;
|
|
6
|
+
min: THREE.Vector3;
|
|
7
|
+
max: THREE.Vector3;
|
|
8
|
+
}
|
|
9
|
+
export declare class OverviewMapPlugin extends Plugin<Record<ViewerEvent, any>> {
|
|
10
|
+
static readonly DEFAULT_ID = "OverviewMapPlugin";
|
|
11
|
+
private cfg;
|
|
12
|
+
mapViewer: OverviewMapViewer;
|
|
13
|
+
constructor(viewer: BaseViewer, cfg: OverviewMapPluginConfig);
|
|
14
|
+
get inputManager(): import("@x-viewer/core").InputManager;
|
|
15
|
+
private initEvents;
|
|
16
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { BaseViewer, BaseViewerConfig, Drawable, EventInfo, Model, ModelConfig, THREE, ViewerEvent } from "@x-viewer/core";
|
|
2
|
+
import { ImageDrawable } from "./ImageDrawable";
|
|
3
|
+
interface OverviewMapModelConfig extends ModelConfig {
|
|
4
|
+
min: THREE.Vector3;
|
|
5
|
+
max: THREE.Vector3;
|
|
6
|
+
}
|
|
7
|
+
export declare enum OverviewMapPluginEvent {
|
|
8
|
+
RotateCamera = "rotatecamera",
|
|
9
|
+
TranslateCamera = "translatecamera"
|
|
10
|
+
}
|
|
11
|
+
export declare class OverviewModel extends Model {
|
|
12
|
+
modelId: string;
|
|
13
|
+
modelObject: THREE.Object3D;
|
|
14
|
+
bbox: THREE.Box3;
|
|
15
|
+
constructor(modelId: string, object: THREE.Object3D, bbox: THREE.Box3);
|
|
16
|
+
getModelObject(): THREE.Object3D<THREE.Object3DEventMap>;
|
|
17
|
+
getBBox(): THREE.Box3;
|
|
18
|
+
}
|
|
19
|
+
export declare class OverviewMapViewer extends BaseViewer<Record<OverviewMapPluginEvent | ViewerEvent, any>> {
|
|
20
|
+
selectedObject?: THREE.Object3D | Drawable;
|
|
21
|
+
private drawableList;
|
|
22
|
+
cameraDrawable?: ImageDrawable;
|
|
23
|
+
cameraDirectonDrawable?: ImageDrawable;
|
|
24
|
+
groundPlane?: THREE.Mesh;
|
|
25
|
+
constructor(viewerCfg: BaseViewerConfig);
|
|
26
|
+
createCameraDrawable(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Gets if selection is enabled.
|
|
29
|
+
*/
|
|
30
|
+
get enableSelection(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Sets if selection is enabled.
|
|
33
|
+
*/
|
|
34
|
+
set enableSelection(enable: boolean);
|
|
35
|
+
private setupDefaultEvents;
|
|
36
|
+
protected handleRotateCamera(current: THREE.Vector2, mouseStart: THREE.Vector2): void;
|
|
37
|
+
protected handleTranslateCamera(e: EventInfo): void;
|
|
38
|
+
loadModel(modelCfg: OverviewMapModelConfig, onProgress?: ((event: ProgressEvent<EventTarget>) => void) | undefined): Promise<void>;
|
|
39
|
+
asyncMainCameraToDrawable(eye: THREE.Vector3, look: THREE.Vector3): void;
|
|
40
|
+
getImageBySrc(src: string): Promise<HTMLImageElement>;
|
|
41
|
+
pickPosition(e: EventInfo): THREE.Vector3 | undefined;
|
|
42
|
+
is3d(): boolean;
|
|
43
|
+
setObjectHighlight(object: THREE.Object3D): void;
|
|
44
|
+
clearHighlight(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Updates raycaster threshold to a proper value, so user can easily pick points and lines
|
|
47
|
+
*/
|
|
48
|
+
private updateRaycasterThreshold;
|
|
49
|
+
}
|
|
50
|
+
export {};
|