@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 @@
|
|
|
1
|
+
export * from "./OverviewMapPlugin";
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { THREE, PdfLayer, ModelData2d, Model2dConfig, FontManager } from "@x-viewer/core";
|
|
2
|
+
import type { PDFDocumentProxy, PDFOperatorList, PDFPageProxy } from "pdfjs-dist/types/src/display/api";
|
|
3
|
+
import { PageViewport } from "pdfjs-dist/types/web/interfaces";
|
|
4
|
+
import type { PdfLoaderPluginConfig } from "./PdfLoaderPlugin";
|
|
5
|
+
/**
|
|
6
|
+
* PdfLoader
|
|
7
|
+
* @description The pdf coordinate origin is in the lower left corner.
|
|
8
|
+
* @link https://zxyle.github.io/PDF-Explained/
|
|
9
|
+
* @link https://github.com/mozilla/pdf.js/
|
|
10
|
+
*/
|
|
11
|
+
export declare class PdfLoader extends THREE.Loader<unknown, Model2dConfig> {
|
|
12
|
+
static readonly MODEL_LAYOUT_NAME = "Model";
|
|
13
|
+
pdf?: PDFDocumentProxy;
|
|
14
|
+
pdfPage?: PDFPageProxy;
|
|
15
|
+
commonObjs?: any;
|
|
16
|
+
objs?: any;
|
|
17
|
+
operatorList?: PDFOperatorList;
|
|
18
|
+
contentVisible: boolean;
|
|
19
|
+
optionalContentConfig?: any;
|
|
20
|
+
markedContentStack: any[];
|
|
21
|
+
stateStack: CanvasExtraState[];
|
|
22
|
+
current: CanvasExtraState;
|
|
23
|
+
tempSMask: null;
|
|
24
|
+
pendingTextPaths?: any[];
|
|
25
|
+
pendingClip?: any;
|
|
26
|
+
pendingEOFill: boolean;
|
|
27
|
+
activeLayoutName: string;
|
|
28
|
+
defaultLayerId: string;
|
|
29
|
+
currentLayerId: string;
|
|
30
|
+
layers: Record<string, PdfLayer>;
|
|
31
|
+
loadedEntityCount: number;
|
|
32
|
+
layersAndThreejsObjects?: Record<string, THREE.Object3D[]>;
|
|
33
|
+
viewportScale: number;
|
|
34
|
+
baseTransform: THREE.Matrix4;
|
|
35
|
+
pdfDocumentGroup?: THREE.Group;
|
|
36
|
+
viewportMesh?: THREE.Mesh;
|
|
37
|
+
pdfPageGroup?: THREE.Group;
|
|
38
|
+
currentTransform: THREE.Matrix4;
|
|
39
|
+
transformStack: THREE.Matrix4[];
|
|
40
|
+
currentPath?: THREE.Shape;
|
|
41
|
+
clipPaths?: THREE.Shape[];
|
|
42
|
+
clipType: any;
|
|
43
|
+
paths: THREE.Shape[];
|
|
44
|
+
private pointsMaterials;
|
|
45
|
+
private lineBasicMaterials;
|
|
46
|
+
private meshBasicMaterials;
|
|
47
|
+
fontManager?: FontManager;
|
|
48
|
+
modelCfg?: Model2dConfig;
|
|
49
|
+
private lineWithWidthCount;
|
|
50
|
+
/**
|
|
51
|
+
* Uses progressive load if this is defined.
|
|
52
|
+
* @param done Indicates if progressive load is done.
|
|
53
|
+
*/
|
|
54
|
+
progressiveLoadCallback?: (zOrder: number, done: boolean) => void;
|
|
55
|
+
constructor(cfg: PdfLoaderPluginConfig);
|
|
56
|
+
load(modelCfg: Model2dConfig, onLoad: (data: ModelData2d) => void, onProgress: (event: ProgressEvent) => void, onError: (error: any) => void): void;
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @param modelCfg
|
|
60
|
+
* @param onProgress
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
loadAsync(modelCfg: Model2dConfig, onProgress: (event: ProgressEvent) => void): Promise<ModelData2d>;
|
|
64
|
+
loadPage(page: number, onProgress?: (event: ProgressEvent) => void): Promise<undefined>;
|
|
65
|
+
getPageCount(): number | undefined;
|
|
66
|
+
private getOperatorList;
|
|
67
|
+
private _pumpOperatorList;
|
|
68
|
+
private tryCleanup;
|
|
69
|
+
private mergePdfObjects;
|
|
70
|
+
private getPointsMaterial;
|
|
71
|
+
private getLineBasicMaterial;
|
|
72
|
+
private getMeshBasicMaterial;
|
|
73
|
+
getTransformByMatrix4(matrix: THREE.Matrix4): number[];
|
|
74
|
+
getObject(data: any, fallback?: null): any;
|
|
75
|
+
beginDrawing(viewport: PageViewport): void;
|
|
76
|
+
endDrawing(): void;
|
|
77
|
+
private releaseData;
|
|
78
|
+
buildLayers(page: PDFPageProxy): Promise<{
|
|
79
|
+
layerCount: number;
|
|
80
|
+
layersMap: Record<string, PdfLayer>;
|
|
81
|
+
layers: any;
|
|
82
|
+
} | undefined>;
|
|
83
|
+
private addObjectToModel;
|
|
84
|
+
executeOperatorList(operatorList: any, onProgress?: (event: ProgressEvent) => void): Promise<void>;
|
|
85
|
+
setLineWidth(width: number): void;
|
|
86
|
+
setLineCap(style: number): void;
|
|
87
|
+
setLineJoin(style: number): void;
|
|
88
|
+
setMiterLimit(limit: number): void;
|
|
89
|
+
setDash(dashArray: number[], dashPhase: number): void;
|
|
90
|
+
setRenderingIntent(intent: any): void;
|
|
91
|
+
setFlatness(flatness: any): void;
|
|
92
|
+
setGState(states: any): void;
|
|
93
|
+
save(): void;
|
|
94
|
+
restore(): void;
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* a c e
|
|
98
|
+
* b d f
|
|
99
|
+
* 0 0 1
|
|
100
|
+
*/
|
|
101
|
+
/**
|
|
102
|
+
*
|
|
103
|
+
* @param a is scale x.
|
|
104
|
+
* @param b is skew y.
|
|
105
|
+
* @param c is skew x.
|
|
106
|
+
* @param d is scale y
|
|
107
|
+
* @param e is translate x.
|
|
108
|
+
* @param f is translate y.
|
|
109
|
+
* @example
|
|
110
|
+
* a c e
|
|
111
|
+
* b d f
|
|
112
|
+
* 0 0 1
|
|
113
|
+
*/
|
|
114
|
+
transform(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
115
|
+
moveTo(): void;
|
|
116
|
+
lineTo(): void;
|
|
117
|
+
curveTo(): void;
|
|
118
|
+
curveTo2(): void;
|
|
119
|
+
curveTo3(): void;
|
|
120
|
+
closePath(): void;
|
|
121
|
+
rectangle(): void;
|
|
122
|
+
stroke(consumePath?: boolean): void;
|
|
123
|
+
closeStroke(): void;
|
|
124
|
+
fill(consumePath?: boolean): void;
|
|
125
|
+
eoFill(): void;
|
|
126
|
+
fillStroke(): void;
|
|
127
|
+
eoFillStroke(): void;
|
|
128
|
+
closeFillStroke(): void;
|
|
129
|
+
closeEOFillStroke(): void;
|
|
130
|
+
endPath(): void;
|
|
131
|
+
clip(): void;
|
|
132
|
+
eoClip(): void;
|
|
133
|
+
beginText(): void;
|
|
134
|
+
endText(): void;
|
|
135
|
+
setCharSpacing(spacing: number): void;
|
|
136
|
+
setWordSpacing(spacing: number): void;
|
|
137
|
+
setHScale(scale: number): void;
|
|
138
|
+
setLeading(leading: number): void;
|
|
139
|
+
setFont(fontRefName: string, size: number): void;
|
|
140
|
+
setTextRenderingMode(mode: number): void;
|
|
141
|
+
setTextRise(rise: number): void;
|
|
142
|
+
moveText(x: number, y: number): void;
|
|
143
|
+
setLeadingMoveText(): void;
|
|
144
|
+
setTextMatrix(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
145
|
+
nextLine(): void;
|
|
146
|
+
paintChar(character: string, x: number, y: number): THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap> | undefined;
|
|
147
|
+
showText(glyphs: any[]): void;
|
|
148
|
+
showType3Text(glyphs: any): void;
|
|
149
|
+
setCharWidth(xWidth: any, yWidth: any): void;
|
|
150
|
+
setCharWidthAndBounds(xWidth: number, yWidth: number, llx: number, lly: number, urx: number, ury: number): void;
|
|
151
|
+
setStrokeColor(): void;
|
|
152
|
+
setStrokeColorN(): void;
|
|
153
|
+
setFillColorN(): void;
|
|
154
|
+
setStrokeRGBColor(r: number, g: number, b: number): void;
|
|
155
|
+
setFillRGBColor(r: number, g: number, b: number): void;
|
|
156
|
+
shadingFill(): void;
|
|
157
|
+
beginInlineImage(): void;
|
|
158
|
+
beginImageData(): void;
|
|
159
|
+
markPoint(tag: any): void;
|
|
160
|
+
markPointProps(tag: any, properties: any): void;
|
|
161
|
+
beginMarkedContent(tag: any): void;
|
|
162
|
+
beginMarkedContentProps(tag: any, properties: any): void;
|
|
163
|
+
endMarkedContent(): void;
|
|
164
|
+
beginCompat(): void;
|
|
165
|
+
endCompat(): void;
|
|
166
|
+
consumePath(clipBox?: number[]): void;
|
|
167
|
+
paintFormXObjectBegin(matrix: any, bbox: any): void;
|
|
168
|
+
paintFormXObjectEnd(): void;
|
|
169
|
+
beginGroup(): void;
|
|
170
|
+
endGroup(): void;
|
|
171
|
+
beginAnnotation(): void;
|
|
172
|
+
endAnnotation(): void;
|
|
173
|
+
paintImageMaskXObject(): void;
|
|
174
|
+
paintImageMaskXObjectGroup(): void;
|
|
175
|
+
paintImageXObject(objId: any): void;
|
|
176
|
+
paintInlineImageXObject(imgData: any): void;
|
|
177
|
+
paintInlineImageXObjectGroup(): void;
|
|
178
|
+
paintImageXObjectRepeat(): void;
|
|
179
|
+
paintImageMaskXObjectRepeat(): void;
|
|
180
|
+
paintSolidColorImageMask(): void;
|
|
181
|
+
_scaleImage(img: any, inverseTransform: THREE.Matrix4): {
|
|
182
|
+
paintWidth: any;
|
|
183
|
+
paintHeight: any;
|
|
184
|
+
};
|
|
185
|
+
constructPath(ops: number[], args: number[], minMax: any): void;
|
|
186
|
+
isContentVisible(): boolean;
|
|
187
|
+
}
|
|
188
|
+
declare class CanvasExtraState {
|
|
189
|
+
alphaIsShape: boolean;
|
|
190
|
+
fontSize: number;
|
|
191
|
+
fontSizeScale: number;
|
|
192
|
+
browserFontSize: number;
|
|
193
|
+
textMatrix: number[];
|
|
194
|
+
textMatrixScale: number;
|
|
195
|
+
fontMatrix: number[];
|
|
196
|
+
leading: number;
|
|
197
|
+
x: number;
|
|
198
|
+
y: number;
|
|
199
|
+
lineX: number;
|
|
200
|
+
lineY: number;
|
|
201
|
+
charSpacing: number;
|
|
202
|
+
wordSpacing: number;
|
|
203
|
+
textHScale: number;
|
|
204
|
+
textRenderingMode: number;
|
|
205
|
+
textRise: number;
|
|
206
|
+
fillColor: number;
|
|
207
|
+
strokeColor: number;
|
|
208
|
+
patternFill: boolean;
|
|
209
|
+
fillAlpha: number;
|
|
210
|
+
strokeAlpha: number;
|
|
211
|
+
lineWidth: number;
|
|
212
|
+
activeSMask: null;
|
|
213
|
+
transferMaps: string;
|
|
214
|
+
ctxMatrix: THREE.Matrix3;
|
|
215
|
+
fontDirection?: number;
|
|
216
|
+
font?: any;
|
|
217
|
+
clipBox: number[];
|
|
218
|
+
minX: number;
|
|
219
|
+
maxX: number;
|
|
220
|
+
minY: number;
|
|
221
|
+
maxY: number;
|
|
222
|
+
lineCap: number;
|
|
223
|
+
lineJoin: number;
|
|
224
|
+
miterLimit: number;
|
|
225
|
+
constructor(width: number, height: number);
|
|
226
|
+
clone(): any;
|
|
227
|
+
setCurrentPoint(x: number, y: number): void;
|
|
228
|
+
startNewPathAndClipBox(box: number[]): void;
|
|
229
|
+
updatePathMinMax(transform: number[], x: number, y: number): void;
|
|
230
|
+
getPathBoundingBox(pathType?: string, transform?: null): number[];
|
|
231
|
+
updateRectMinMax(transform: number[], rect: any): void;
|
|
232
|
+
updateScalingPathMinMax(transform: number[], minMax: number[]): void;
|
|
233
|
+
updateCurvePathMinMax(transform: number[], x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, minMax: number[]): void;
|
|
234
|
+
updateClipFromPath(): void;
|
|
235
|
+
isEmptyClip(): boolean;
|
|
236
|
+
getClippedPathBoundingBox(pathType?: string, transform?: null): number[];
|
|
237
|
+
}
|
|
238
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { THREE, BaseViewer, Model2dConfig, FontManager, Plugin, PluginConfig, Model2d } from "@x-viewer/core";
|
|
2
|
+
import { PdfLoader } from "./PdfLoader";
|
|
3
|
+
/**
|
|
4
|
+
* Pdf loader plugin config.
|
|
5
|
+
*/
|
|
6
|
+
export interface PdfLoaderPluginConfig extends Partial<PluginConfig> {
|
|
7
|
+
font?: FontManager;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to use progressive load or not.
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
enableProgressiveLoad?: boolean;
|
|
13
|
+
pdfWorker: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Pdf loader plugin.
|
|
17
|
+
*/
|
|
18
|
+
export declare class PdfLoaderPlugin extends Plugin {
|
|
19
|
+
static readonly DEFAULT_ID = "PdfLoaderPlugin";
|
|
20
|
+
protected cfg: PdfLoaderPluginConfig;
|
|
21
|
+
loader?: PdfLoader;
|
|
22
|
+
constructor(viewer: BaseViewer, cfg: PdfLoaderPluginConfig);
|
|
23
|
+
/**
|
|
24
|
+
* Loads a pdf.
|
|
25
|
+
* @param modelCfg
|
|
26
|
+
* @param onProgress
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
loadAsync(modelCfg: Model2dConfig, onProgress: (event: ProgressEvent) => void): Promise<Model2d>;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param page
|
|
33
|
+
* @param onProgress
|
|
34
|
+
* @returns
|
|
35
|
+
* @description load specified pdf page
|
|
36
|
+
*/
|
|
37
|
+
loadPage(page: number, onProgress?: (event: ProgressEvent) => void): Promise<undefined>;
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @returns {Number}
|
|
41
|
+
* @description Get pdf pages number.
|
|
42
|
+
*/
|
|
43
|
+
getPageCount(): number;
|
|
44
|
+
private getPdfViewport;
|
|
45
|
+
worldPosition2PdfPoint(position: THREE.Vector2): THREE.Vector2;
|
|
46
|
+
pdfPoint2WorldPosition(point: THREE.Vector2): THREE.Vector2;
|
|
47
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Viewer3d, Plugin, PluginConfig, THREE } from "@x-viewer/core";
|
|
2
|
+
import { BasePanel } from "@x-viewer/ui";
|
|
3
|
+
/**
|
|
4
|
+
* Tree view plugin config.
|
|
5
|
+
*/
|
|
6
|
+
export interface PropertyPluginConfig extends Partial<PluginConfig> {
|
|
7
|
+
/**
|
|
8
|
+
* Container div id.
|
|
9
|
+
*/
|
|
10
|
+
containerId?: string;
|
|
11
|
+
/**
|
|
12
|
+
* If panel is visible. It is visible by default.
|
|
13
|
+
*/
|
|
14
|
+
visible?: boolean;
|
|
15
|
+
language?: "cn" | "en";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Tree view plugin events.
|
|
19
|
+
*/
|
|
20
|
+
type PropertyPluginEvents = {
|
|
21
|
+
/**
|
|
22
|
+
* Panel visibility change event.
|
|
23
|
+
*/
|
|
24
|
+
visibilitychange: boolean;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Tree view plugin.
|
|
28
|
+
*/
|
|
29
|
+
export declare class PropertyPlugin extends Plugin<PropertyPluginEvents> {
|
|
30
|
+
static readonly DEFAULT_ID = "PropertyPlugin";
|
|
31
|
+
protected cfg: PropertyPluginConfig;
|
|
32
|
+
protected basePanel?: BasePanel;
|
|
33
|
+
protected container?: HTMLDivElement;
|
|
34
|
+
protected content?: HTMLDivElement;
|
|
35
|
+
protected details?: HTMLDivElement;
|
|
36
|
+
protected selectedObject: THREE.Object3D | undefined;
|
|
37
|
+
protected lastActiveTabIdx: number;
|
|
38
|
+
protected nodePanel?: HTMLDivElement;
|
|
39
|
+
protected nodeModeButtons?: {
|
|
40
|
+
local: HTMLButtonElement;
|
|
41
|
+
global: HTMLButtonElement;
|
|
42
|
+
};
|
|
43
|
+
protected nodeInputs?: {
|
|
44
|
+
translation: HTMLInputElement[];
|
|
45
|
+
rotation: HTMLInputElement[];
|
|
46
|
+
scale: HTMLInputElement[];
|
|
47
|
+
};
|
|
48
|
+
protected geometrySection?: HTMLDivElement;
|
|
49
|
+
protected boundingBoxSection?: HTMLDivElement;
|
|
50
|
+
constructor(viewer: Viewer3d, cfg?: PropertyPluginConfig);
|
|
51
|
+
protected updateContent(): void;
|
|
52
|
+
private initLocalization;
|
|
53
|
+
setVisible(visible: boolean): void;
|
|
54
|
+
isVisible(): boolean;
|
|
55
|
+
protected onObjectSelected: () => void;
|
|
56
|
+
protected onObjectDeselected: () => void;
|
|
57
|
+
private onClose;
|
|
58
|
+
destroy(): void;
|
|
59
|
+
protected addContent(): void;
|
|
60
|
+
private isMaterialTabEnabled;
|
|
61
|
+
private isNodeTabEnabled;
|
|
62
|
+
private isPropertyTabEnabled;
|
|
63
|
+
renderTab(idx: number): void;
|
|
64
|
+
private clearDetails;
|
|
65
|
+
private renderMaterial;
|
|
66
|
+
private renderNode;
|
|
67
|
+
protected updateNodeInputs(target: THREE.Object3D): void;
|
|
68
|
+
protected applyNodeInputs(target: THREE.Object3D): void;
|
|
69
|
+
private updateGeometryInfo;
|
|
70
|
+
private updateBoundingBoxInfo;
|
|
71
|
+
private getVertexCount;
|
|
72
|
+
private getTriangleCount;
|
|
73
|
+
private getGlobalSize;
|
|
74
|
+
private renderProperty;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { THREE } from "@x-viewer/core";
|
|
2
|
+
import { type BaseViewer, BoxSelectHelper, PickMarkupHelper, Plugin, PluginConfig } from "@x-viewer/core";
|
|
3
|
+
/**
|
|
4
|
+
* Screenshot mode.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ScreenshotMode {
|
|
7
|
+
/**
|
|
8
|
+
* Take screenshot of the whole canvas.
|
|
9
|
+
*/
|
|
10
|
+
Default = "Default",
|
|
11
|
+
/**
|
|
12
|
+
* Take screenshot by box selecting an area.
|
|
13
|
+
*/
|
|
14
|
+
BoxSelection = "BoxSelection",
|
|
15
|
+
/**
|
|
16
|
+
* Take screenshot by picking a markup.
|
|
17
|
+
*/
|
|
18
|
+
PickMarkup = "PickMarkup"
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Screenshot plugin config.
|
|
22
|
+
*/
|
|
23
|
+
export interface ScreenshotPluginConfig extends Partial<PluginConfig> {
|
|
24
|
+
/**
|
|
25
|
+
* Image type.
|
|
26
|
+
*/
|
|
27
|
+
type?: "image/png" | "image/jpg";
|
|
28
|
+
/**
|
|
29
|
+
* Image quality.
|
|
30
|
+
*/
|
|
31
|
+
quality?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Sets background transparent, this must be used for "image/png" format.
|
|
34
|
+
* @default false
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
setBackgroundTransparent?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Screenshot result, which contains a result image and,
|
|
41
|
+
* for Viewer2d, it also contains the view extent when the screenshot is taken,
|
|
42
|
+
* for Viewer3d, it contains the camera's position and target.
|
|
43
|
+
*/
|
|
44
|
+
export interface ScreenshotResult {
|
|
45
|
+
/**
|
|
46
|
+
* The view extent when the screenshot is taken.
|
|
47
|
+
* Note that, it is not the image's extent.
|
|
48
|
+
* And, this is for Viewer2d only.
|
|
49
|
+
*/
|
|
50
|
+
viewExtent?: THREE.Box2;
|
|
51
|
+
/**
|
|
52
|
+
* Used for Viewer3d
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* Used for Viewer3d
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* Image type, which is "image/png" by default
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
imageType: string;
|
|
64
|
+
/**
|
|
65
|
+
* The image, in base 64 format.
|
|
66
|
+
*/
|
|
67
|
+
base64Image: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Screenshot plugin
|
|
71
|
+
*/
|
|
72
|
+
export declare class ScreenshotPlugin extends Plugin {
|
|
73
|
+
static readonly DEFAULT_ID = "ScreenshotPlugin";
|
|
74
|
+
protected cfg: ScreenshotPluginConfig;
|
|
75
|
+
protected boxSelectHelper?: BoxSelectHelper;
|
|
76
|
+
protected pickMarkupHelper?: PickMarkupHelper;
|
|
77
|
+
protected originalBackground: THREE.Color | undefined;
|
|
78
|
+
protected originalClearAlpha: number;
|
|
79
|
+
constructor(viewer: BaseViewer, cfg?: ScreenshotPluginConfig);
|
|
80
|
+
/**
|
|
81
|
+
* @description {en} Gets screenshot of current canvas. Returns an image in format of base64 string.
|
|
82
|
+
* @description {zh} 获取画布的截屏。该方法返回一个 base64 类型的字符串。
|
|
83
|
+
* @example
|
|
84
|
+
* ``` typescript
|
|
85
|
+
* const plugin = new ScreenshotPlugin(viewer);
|
|
86
|
+
* const base64Image = plugin.getScreenshot();
|
|
87
|
+
* console.log(base64Image);
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
getScreenshot(): string | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Gets screenshot by bbox under screen cooridinate.
|
|
93
|
+
*/
|
|
94
|
+
getScreenshotByScreenBBox(bbox: THREE.Box2): Promise<string | undefined>;
|
|
95
|
+
/**
|
|
96
|
+
* Gets screenshot by bbox under world coordinate.
|
|
97
|
+
* It needs to convert world to screen coordinate, in order to get the
|
|
98
|
+
* screenshot range. Assume it maps to bboxA under screen coordinate,
|
|
99
|
+
* and current view boundary is bboxB (e.g., 0,0 - 1024,768).
|
|
100
|
+
* Since, a given world coordinate may not be in current view boundary.
|
|
101
|
+
* The finally screenshot is the overlap of bboxA and bboxB. When
|
|
102
|
+
* - bboxA includes bboxB, it get screenshot for bboxB
|
|
103
|
+
* - bboxB includes bboxA, it get screenshot for bboxA
|
|
104
|
+
* - bboxA overlaps with bboxB, it get screenshot for the overlapped area
|
|
105
|
+
* - bboxA doesn't overlap with bboxB, it get nothing
|
|
106
|
+
*
|
|
107
|
+
* A best practice to use this API is to use orthographic camera, under top view,
|
|
108
|
+
* and pass in viewer's bbox.
|
|
109
|
+
*/
|
|
110
|
+
getScreenshotByWorldBBox(bbox: THREE.Box3): Promise<string | undefined>;
|
|
111
|
+
/**
|
|
112
|
+
* @description {en} Gets screenshot of a rectangular area, or by box selecting an area. Returns an image in format of base64 string.
|
|
113
|
+
* @description {zh} 获取矩形区域或者框选区域的截图。返回base64格式的图片。
|
|
114
|
+
* @param mode
|
|
115
|
+
* - {en} screenshot mode("Default", "BoxSelection" and "PickMarkup").
|
|
116
|
+
* - {zh} 截图模式("全屏", "框选" 和 "选中批注")。
|
|
117
|
+
* @example
|
|
118
|
+
* ``` typescript
|
|
119
|
+
* // {en} Click on markup to take screenshot.
|
|
120
|
+
* // {zh} 点击批注截屏。
|
|
121
|
+
* const mode = ScreenshotMode.PickMarkup;
|
|
122
|
+
* viewer.getScreenshot(mode).then(data => console.log(data));
|
|
123
|
+
* // {en} Take screenshot by box selecting an area.
|
|
124
|
+
* // {zh} 根据用户的框选截屏。
|
|
125
|
+
* const mode = ScreenshotMode.BoxSelection;
|
|
126
|
+
* viewer.getScreenshot(mode).then(data => console.log(data));
|
|
127
|
+
* // {en} Take screenshot of the whole view.
|
|
128
|
+
* // {zh} 全屏截屏。
|
|
129
|
+
* const mode = ScreenshotMode.Default;
|
|
130
|
+
* const plugin = new ScreenshotPlugin(viewer);
|
|
131
|
+
* plugin.getScreenshotAsync(mode).then(data => console.log(data));
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
getScreenshotAsync(mode?: ScreenshotMode): Promise<undefined | ScreenshotResult>;
|
|
135
|
+
/**
|
|
136
|
+
* If ScreenshotPlugin is active.
|
|
137
|
+
*/
|
|
138
|
+
isActive(): (() => boolean) | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Cancel current operation if any.
|
|
141
|
+
*/
|
|
142
|
+
cancel(): void;
|
|
143
|
+
/**
|
|
144
|
+
* Sets scene background transparent.
|
|
145
|
+
* This is useful when taking screenshop of png format.
|
|
146
|
+
* In some cases, user don't want the background with a fixed background color.
|
|
147
|
+
*/
|
|
148
|
+
private setBackgroundTransparent;
|
|
149
|
+
/**
|
|
150
|
+
* Recovers to original background settings.
|
|
151
|
+
*/
|
|
152
|
+
private recoverBackgroundTransparency;
|
|
153
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ScreenshotPlugin";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { THREE } from "@x-viewer/core";
|
|
2
|
+
import { EventInfo, InputManager, type BaseViewer } from "@x-viewer/core";
|
|
3
|
+
import { BaseSection } from "./BaseSection";
|
|
4
|
+
import { SectionGizmo } from "../sections/SectionGizmo";
|
|
5
|
+
import { SectionPlaneMesh } from "../sections/SectionPlaneMesh";
|
|
6
|
+
export declare enum AxisType {
|
|
7
|
+
X = "X",
|
|
8
|
+
Y = "Y",
|
|
9
|
+
Z = "Z"
|
|
10
|
+
}
|
|
11
|
+
export declare class AxisPlaneSection extends BaseSection {
|
|
12
|
+
protected activeAxis: AxisType;
|
|
13
|
+
protected gizmo?: SectionGizmo;
|
|
14
|
+
protected planeMesh?: SectionPlaneMesh;
|
|
15
|
+
protected capsWireframe?: SectionPlaneMesh;
|
|
16
|
+
protected clipPlane?: THREE.Plane;
|
|
17
|
+
protected selectedObject?: SectionPlaneMesh | THREE.Mesh | THREE.Object3D;
|
|
18
|
+
protected axisInfoMap: {
|
|
19
|
+
[key in AxisType]: {
|
|
20
|
+
normal: THREE.Vector3;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
protected center: THREE.Vector3;
|
|
24
|
+
protected clipPlaneConstant?: number;
|
|
25
|
+
constructor(viewer: BaseViewer, input: InputManager);
|
|
26
|
+
/**
|
|
27
|
+
* Activates plane section.
|
|
28
|
+
* @param type Specifies the axis for sectioning. The default value is "X" axis.
|
|
29
|
+
* @param clipPlaneConstant It decides where the clip plane is. By default, the clip plane passes through
|
|
30
|
+
* the center of world bounding box. Caller can specify a different position.
|
|
31
|
+
* E.g., when type is "X" and clipPlaneConstant is 10, it means the clip plane passes through (10, 0, 0).
|
|
32
|
+
*/
|
|
33
|
+
activate(type?: AxisType, clipPlaneConstant?: number): void;
|
|
34
|
+
deactivate(keepSectionState?: boolean): void;
|
|
35
|
+
reset(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Sets a AxisType for plane section.
|
|
38
|
+
* @param type Specifies the axis for sectioning.
|
|
39
|
+
* @param clipPlaneConstant It decides where the clip plane is. By default, the clip plane passes through
|
|
40
|
+
* the center of world bounding box. Caller can specify a different position.
|
|
41
|
+
* E.g., when type is "X" and clipPlaneConstant is 10, it means the clip plane passes through (10, 0, 0).
|
|
42
|
+
*/
|
|
43
|
+
setActiveAxis(type: AxisType, clipPlaneConstant?: number): void;
|
|
44
|
+
/**
|
|
45
|
+
* Sets gizmo and section plane mesh visibility.
|
|
46
|
+
*/
|
|
47
|
+
setSectionPlaneVisible(visible: boolean): void;
|
|
48
|
+
protected initOrUpdateClipPlanes(): void;
|
|
49
|
+
protected initOrUpdateSectionPlaneMeshes(): void;
|
|
50
|
+
private createCapsWireframe;
|
|
51
|
+
protected initOrUpdateGizmo(): void;
|
|
52
|
+
mousedown: (e: EventInfo) => void;
|
|
53
|
+
protected mousemove: (e: EventInfo) => void;
|
|
54
|
+
onDragStart(e: EventInfo): void;
|
|
55
|
+
onDragMove(e: EventInfo): void;
|
|
56
|
+
onDragEnd(e: EventInfo): void;
|
|
57
|
+
getIntersectObjects(): THREE.Object3D[];
|
|
58
|
+
activateSelectedObject(active: boolean): void;
|
|
59
|
+
/**
|
|
60
|
+
* Adjusts a position by activeAxis and clipPlaneConstant.
|
|
61
|
+
*/
|
|
62
|
+
private adjustPositionByClipPlaneConstant;
|
|
63
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type BaseViewer } from "@x-viewer/core";
|
|
2
|
+
import { PopPanel } from "@x-viewer/ui";
|
|
3
|
+
import { AxisPlaneSection } from "./AxisPlaneSection";
|
|
4
|
+
export declare class AxisSectionPopPanel extends PopPanel {
|
|
5
|
+
protected axis: string;
|
|
6
|
+
protected activeItem?: string;
|
|
7
|
+
protected groupSelectNode?: HTMLElement;
|
|
8
|
+
protected activeSelectNode?: HTMLElement;
|
|
9
|
+
protected isVisible: boolean;
|
|
10
|
+
protected section: AxisPlaneSection;
|
|
11
|
+
constructor(viewer: BaseViewer);
|
|
12
|
+
keydown: (e: KeyboardEvent) => void;
|
|
13
|
+
destroy(): void;
|
|
14
|
+
createGroupSelectLayout(): void;
|
|
15
|
+
addGroupSelectItems(): void;
|
|
16
|
+
createActiveSelectLayout(): void;
|
|
17
|
+
addActiveItems(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { THREE } from "@x-viewer/core";
|
|
2
|
+
import { EventInfo, InputManager, type BaseViewer } from "@x-viewer/core";
|
|
3
|
+
/**
|
|
4
|
+
* Abstract base class for AxisPlaneSection, ObjectsBoxSection, etc.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class BaseSection {
|
|
7
|
+
protected viewer: BaseViewer;
|
|
8
|
+
protected inputManager: InputManager;
|
|
9
|
+
protected scene: THREE.Scene;
|
|
10
|
+
protected renderer: THREE.WebGLRenderer;
|
|
11
|
+
protected raycaster: THREE.Raycaster;
|
|
12
|
+
protected sectionBox: THREE.Box3;
|
|
13
|
+
protected lastWorldPos: THREE.Vector3;
|
|
14
|
+
protected mouseMoved: boolean;
|
|
15
|
+
protected dragStarted: boolean;
|
|
16
|
+
protected clipPlanes?: THREE.Plane[];
|
|
17
|
+
protected vertices?: THREE.Vector3[];
|
|
18
|
+
protected selectedObject?: THREE.Object3D;
|
|
19
|
+
protected refrencePlane: THREE.Plane;
|
|
20
|
+
protected active: boolean;
|
|
21
|
+
protected capsVisibility: boolean;
|
|
22
|
+
protected capsWireframeMaterial: THREE.MeshBasicMaterial;
|
|
23
|
+
/**
|
|
24
|
+
* If to show section plane and gizmo or not.
|
|
25
|
+
*/
|
|
26
|
+
showSectionPlane: boolean;
|
|
27
|
+
capsScene: THREE.Scene;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
clippingObjetIds?: number[];
|
|
32
|
+
constructor(viewer: BaseViewer, input: InputManager);
|
|
33
|
+
protected get canvas(): HTMLCanvasElement;
|
|
34
|
+
get isActive(): boolean;
|
|
35
|
+
protected get camera(): THREE.Camera;
|
|
36
|
+
private setGlobalClippingEnabled;
|
|
37
|
+
private setObjectClippingEnabled;
|
|
38
|
+
clearClippingObjectIds(): void;
|
|
39
|
+
setClippingEnabled(enable: boolean): void;
|
|
40
|
+
activate(): void;
|
|
41
|
+
deactivate(keepSectionState?: boolean): void;
|
|
42
|
+
setCapsVisible(visible: boolean): void;
|
|
43
|
+
getCapsVisible(): boolean;
|
|
44
|
+
protected setControlsEnabled(enable: boolean): void;
|
|
45
|
+
protected mousedown: (e: EventInfo) => void;
|
|
46
|
+
protected mousemove: (e: EventInfo) => void;
|
|
47
|
+
protected mouseup: (e: EventInfo) => void;
|
|
48
|
+
protected keydown: (e: EventInfo) => void;
|
|
49
|
+
protected getIntersection(e: EventInfo): THREE.Intersection | undefined;
|
|
50
|
+
protected updateRaycasterByMouse(e: EventInfo): void;
|
|
51
|
+
destroy(): void;
|
|
52
|
+
protected abstract onDragStart(e: EventInfo): void;
|
|
53
|
+
protected abstract onDragMove(e: EventInfo): void;
|
|
54
|
+
protected abstract onDragEnd(e: EventInfo): void;
|
|
55
|
+
protected abstract getIntersectObjects(): THREE.Object3D[];
|
|
56
|
+
protected abstract activateSelectedObject(active: boolean): void;
|
|
57
|
+
protected abstract initOrUpdateSectionPlaneMeshes(): void;
|
|
58
|
+
protected abstract initOrUpdateClipPlanes(): void;
|
|
59
|
+
abstract reset(): void;
|
|
60
|
+
abstract setSectionPlaneVisible(visible: boolean): void;
|
|
61
|
+
}
|