dxfview 0.0.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/README.md +1 -0
- package/dist/dxfview.esm.min.js +7 -0
- package/dist/types/components/dxf-layout-bar/DxfLayoutBar.d.ts +26 -0
- package/dist/types/components/dxf-layout-bar/index.d.ts +1 -0
- package/dist/types/components/pop-panel/PopPanel.d.ts +14 -0
- package/dist/types/components/pop-panel/index.d.ts +1 -0
- package/dist/types/components/progress-bar/ProgressBar.d.ts +34 -0
- package/dist/types/components/progress-bar/index.d.ts +1 -0
- package/dist/types/components/settings/ProjectSettingsDef.d.ts +44 -0
- package/dist/types/components/settings/index.d.ts +1 -0
- package/dist/types/components/tool-tip/Tooltip.d.ts +20 -0
- package/dist/types/components/tool-tip/index.d.ts +1 -0
- package/dist/types/core/Configs.d.ts +238 -0
- package/dist/types/core/Constants.d.ts +164 -0
- package/dist/types/core/Units.d.ts +16 -0
- package/dist/types/core/VersionManager.d.ts +3 -0
- package/dist/types/core/camera-controls/CameraControls.d.ts +773 -0
- package/dist/types/core/camera-controls/Constants.d.ts +2 -0
- package/dist/types/core/camera-controls/EventDispatcher.d.ts +41 -0
- package/dist/types/core/camera-controls/index.d.ts +2 -0
- package/dist/types/core/camera-controls/types.d.ts +112 -0
- package/dist/types/core/camera-controls/utils/extractClientCoordFromEvent.d.ts +3 -0
- package/dist/types/core/camera-controls/utils/math-utils.d.ts +11 -0
- package/dist/types/core/camera-controls/utils/notSupportedInOrthographicCamera.d.ts +2 -0
- package/dist/types/core/canvas/CanvasRender.d.ts +52 -0
- package/dist/types/core/canvas/Constants.d.ts +28 -0
- package/dist/types/core/canvas/Drawable.d.ts +87 -0
- package/dist/types/core/canvas/DrawableList.d.ts +29 -0
- package/dist/types/core/canvas/index.d.ts +4 -0
- package/dist/types/core/compare/BaseDxfCompareHelper.d.ts +104 -0
- package/dist/types/core/compare/CompareDrawable.d.ts +17 -0
- package/dist/types/core/compare/DxfCompareHelper.d.ts +69 -0
- package/dist/types/core/compare/DxfCompareMarkupManager.d.ts +11 -0
- package/dist/types/core/compare/index.d.ts +4 -0
- package/dist/types/core/controls/CameraControlsEx.d.ts +34 -0
- package/dist/types/core/controls/index.d.ts +1 -0
- package/dist/types/core/dxf/DxfCompare.d.ts +151 -0
- package/dist/types/core/dxf/DxfConstants.d.ts +15 -0
- package/dist/types/core/dxf/DxfLoader.d.ts +526 -0
- package/dist/types/core/dxf/DxfObject.d.ts +32 -0
- package/dist/types/core/dxf/DxfUtils.d.ts +79 -0
- package/dist/types/core/dxf/HatchPatternShaders.d.ts +12 -0
- package/dist/types/core/dxf/LinePatternShaders.d.ts +12 -0
- package/dist/types/core/dxf/bspline.d.ts +8 -0
- package/dist/types/core/dxf/dxfom-mtext.d.ts +46 -0
- package/dist/types/core/dxf/dxfom-text.d.ts +16 -0
- package/dist/types/core/dxf/index.d.ts +10 -0
- package/dist/types/core/dxf/round10.d.ts +2 -0
- package/dist/types/core/dxf-parser/AutoCadColorIndex.d.ts +8 -0
- package/dist/types/core/dxf-parser/DxfBaseReader.d.ts +12 -0
- package/dist/types/core/dxf-parser/DxfBinaryReader.d.ts +14 -0
- package/dist/types/core/dxf-parser/DxfParser.d.ts +327 -0
- package/dist/types/core/dxf-parser/DxfTextReader.d.ts +31 -0
- package/dist/types/core/dxf-parser/ParseHelpers.d.ts +36 -0
- package/dist/types/core/dxf-parser/entities/3dface.d.ts +11 -0
- package/dist/types/core/dxf-parser/entities/arc.d.ts +16 -0
- package/dist/types/core/dxf-parser/entities/attdef.d.ts +31 -0
- package/dist/types/core/dxf-parser/entities/attrib.d.ts +31 -0
- package/dist/types/core/dxf-parser/entities/circle.d.ts +13 -0
- package/dist/types/core/dxf-parser/entities/dimension.d.ts +22 -0
- package/dist/types/core/dxf-parser/entities/ellipse.d.ts +15 -0
- package/dist/types/core/dxf-parser/entities/geomtry.d.ts +40 -0
- package/dist/types/core/dxf-parser/entities/hatch.d.ts +108 -0
- package/dist/types/core/dxf-parser/entities/image.d.ts +37 -0
- package/dist/types/core/dxf-parser/entities/insert.d.ts +20 -0
- package/dist/types/core/dxf-parser/entities/leader.d.ts +23 -0
- package/dist/types/core/dxf-parser/entities/line.d.ts +10 -0
- package/dist/types/core/dxf-parser/entities/lwpolyline.d.ts +21 -0
- package/dist/types/core/dxf-parser/entities/mleader.d.ts +101 -0
- package/dist/types/core/dxf-parser/entities/mtext.d.ts +18 -0
- package/dist/types/core/dxf-parser/entities/ole2frame.d.ts +20 -0
- package/dist/types/core/dxf-parser/entities/point.d.ts +11 -0
- package/dist/types/core/dxf-parser/entities/polyline.d.ts +20 -0
- package/dist/types/core/dxf-parser/entities/ray.d.ts +10 -0
- package/dist/types/core/dxf-parser/entities/region.d.ts +10 -0
- package/dist/types/core/dxf-parser/entities/seqend.d.ts +8 -0
- package/dist/types/core/dxf-parser/entities/solid.d.ts +10 -0
- package/dist/types/core/dxf-parser/entities/spline.d.ts +23 -0
- package/dist/types/core/dxf-parser/entities/table.d.ts +42 -0
- package/dist/types/core/dxf-parser/entities/text.d.ts +18 -0
- package/dist/types/core/dxf-parser/entities/vertex.d.ts +20 -0
- package/dist/types/core/dxf-parser/entities/viewport.d.ts +46 -0
- package/dist/types/core/dxf-parser/entities/xline.d.ts +10 -0
- package/dist/types/core/dxf-parser/index.d.ts +27 -0
- package/dist/types/core/dxf-parser/objects/common.d.ts +15 -0
- package/dist/types/core/dxf-parser/objects/dictionary.d.ts +19 -0
- package/dist/types/core/dxf-parser/objects/imagedef.d.ts +24 -0
- package/dist/types/core/dxf-parser/objects/layout.d.ts +29 -0
- package/dist/types/core/dxf-parser/objects/sortentstable.d.ts +12 -0
- package/dist/types/core/dxf-parser/objects/spatialfilter.d.ts +22 -0
- package/dist/types/core/dxf-parser/objects/xrecord.d.ts +11 -0
- package/dist/types/core/font/BaseFont.d.ts +88 -0
- package/dist/types/core/font/FontManager.d.ts +107 -0
- package/dist/types/core/font/MeshFont.d.ts +44 -0
- package/dist/types/core/font/ShxFont.d.ts +108 -0
- package/dist/types/core/font/index.d.ts +1 -0
- package/dist/types/core/font/shx/ExtraLettersTemplate.d.ts +1 -0
- package/dist/types/core/font/shx/Shx.constants.d.ts +11 -0
- package/dist/types/core/font/shx/ShxParser.d.ts +18 -0
- package/dist/types/core/font/shx/TextShape.d.ts +24 -0
- package/dist/types/core/font/shx/gbk/index.d.ts +4 -0
- package/dist/types/core/font/shx/index.d.ts +1 -0
- package/dist/types/core/font/shx/util/BitConverter.d.ts +18 -0
- package/dist/types/core/geometry-offset/Edge.d.ts +27 -0
- package/dist/types/core/geometry-offset/Offset.d.ts +46 -0
- package/dist/types/core/geometry-offset/index.d.ts +1 -0
- package/dist/types/core/helpers/BinaryReader.d.ts +24 -0
- package/dist/types/core/helpers/BoxSelectHelper.d.ts +44 -0
- package/dist/types/core/helpers/LoadingHelper.d.ts +46 -0
- package/dist/types/core/helpers/MobileTouchHelperDrawable.d.ts +26 -0
- package/dist/types/core/helpers/OSnapHelper.d.ts +167 -0
- package/dist/types/core/helpers/ObjectPixelSizeHelper.d.ts +13 -0
- package/dist/types/core/helpers/PickMarkupHelper.d.ts +29 -0
- package/dist/types/core/helpers/RafHelper.d.ts +18 -0
- package/dist/types/core/helpers/ZoomToRectHelper.d.ts +17 -0
- package/dist/types/core/helpers/index.d.ts +9 -0
- package/dist/types/core/index.d.ts +18 -0
- package/dist/types/core/indexeddb/AnnotationTable.d.ts +14 -0
- package/dist/types/core/indexeddb/BaseTable.d.ts +36 -0
- package/dist/types/core/indexeddb/DxfDataTable.d.ts +22 -0
- package/dist/types/core/indexeddb/FontDataTable.d.ts +32 -0
- package/dist/types/core/indexeddb/IndexedDbManager.d.ts +29 -0
- package/dist/types/core/indexeddb/ViewpointTable.d.ts +14 -0
- package/dist/types/core/indexeddb/index.d.ts +6 -0
- package/dist/types/core/input/InputManager.d.ts +161 -0
- package/dist/types/core/input/index.d.ts +1 -0
- package/dist/types/core/license/AutoConfig.d.ts +17 -0
- package/dist/types/core/license/LicenseManager.d.ts +107 -0
- package/dist/types/core/license/PublicKey.d.ts +1 -0
- package/dist/types/core/license/index.d.ts +1 -0
- package/dist/types/core/markup/ArrowMarkup.d.ts +14 -0
- package/dist/types/core/markup/BaseMarkup.d.ts +28 -0
- package/dist/types/core/markup/CircleMarkup.d.ts +12 -0
- package/dist/types/core/markup/CloudLineMarkup.d.ts +10 -0
- package/dist/types/core/markup/CloudRectMarkup.d.ts +11 -0
- package/dist/types/core/markup/CloudRectWithTextMarkup.d.ts +43 -0
- package/dist/types/core/markup/Constants.d.ts +17 -0
- package/dist/types/core/markup/DotMarkup.d.ts +9 -0
- package/dist/types/core/markup/EllipseMarkup.d.ts +12 -0
- package/dist/types/core/markup/LeaderLineMarkup.d.ts +25 -0
- package/dist/types/core/markup/MarkupManager.d.ts +91 -0
- package/dist/types/core/markup/PolylineMarkup.d.ts +11 -0
- package/dist/types/core/markup/RectMarkup.d.ts +10 -0
- package/dist/types/core/markup/TextMarkup.d.ts +40 -0
- package/dist/types/core/markup/XMarkup.d.ts +10 -0
- package/dist/types/core/markup/index.d.ts +13 -0
- package/dist/types/core/model/Constants.d.ts +51 -0
- package/dist/types/core/model/Model.d.ts +18 -0
- package/dist/types/core/model/Model2d.d.ts +115 -0
- package/dist/types/core/model/index.d.ts +3 -0
- package/dist/types/core/patches/Constants.d.ts +4 -0
- package/dist/types/core/patches/Line.d.ts +2 -0
- package/dist/types/core/patches/Mesh.d.ts +2 -0
- package/dist/types/core/patches/Points.d.ts +2 -0
- package/dist/types/core/patches/index.d.ts +4 -0
- package/dist/types/core/undo-redo/AddAnnotationCommand.d.ts +11 -0
- package/dist/types/core/undo-redo/AddMarkupCommand.d.ts +10 -0
- package/dist/types/core/undo-redo/AddMeasurementCommand.d.ts +9 -0
- package/dist/types/core/undo-redo/Command.d.ts +6 -0
- package/dist/types/core/undo-redo/RemoveAnnotationCommand.d.ts +11 -0
- package/dist/types/core/undo-redo/RemoveMarkupCommand.d.ts +10 -0
- package/dist/types/core/undo-redo/RemoveMeasurementCommand.d.ts +9 -0
- package/dist/types/core/undo-redo/UndoRedoManager.d.ts +21 -0
- package/dist/types/core/undo-redo/UpdateMarkupCommand.d.ts +11 -0
- package/dist/types/core/undo-redo/index.d.ts +9 -0
- package/dist/types/core/utils/CSS2DObjectUtils.d.ts +14 -0
- package/dist/types/core/utils/ColorUtils.d.ts +21 -0
- package/dist/types/core/utils/CommonUtils.d.ts +125 -0
- package/dist/types/core/utils/CoordinateUtils.d.ts +81 -0
- package/dist/types/core/utils/DecimalPrecisionUtils.d.ts +4 -0
- package/dist/types/core/utils/DeviceUtils.d.ts +15 -0
- package/dist/types/core/utils/EdgeUtils.d.ts +14 -0
- package/dist/types/core/utils/Event.d.ts +33 -0
- package/dist/types/core/utils/FpsUtils.d.ts +13 -0
- package/dist/types/core/utils/GeometryUtils.d.ts +111 -0
- package/dist/types/core/utils/Locale.d.ts +190 -0
- package/dist/types/core/utils/LogUtils.d.ts +7 -0
- package/dist/types/core/utils/MaterialUtils.d.ts +40 -0
- package/dist/types/core/utils/MathUtils.d.ts +59 -0
- package/dist/types/core/utils/MergeUtils.d.ts +638 -0
- package/dist/types/core/utils/ObjectUtils.d.ts +87 -0
- package/dist/types/core/utils/PolygonUtils.d.ts +8 -0
- package/dist/types/core/utils/SVGObjectUtils.d.ts +16 -0
- package/dist/types/core/utils/SceneUtils.d.ts +26 -0
- package/dist/types/core/utils/SectionUtils.d.ts +11 -0
- package/dist/types/core/utils/UnitConversionUtils.d.ts +31 -0
- package/dist/types/core/utils/index.d.ts +21 -0
- package/dist/types/core/viewers/BaseViewer.d.ts +265 -0
- package/dist/types/core/viewers/DxfViewer.d.ts +1372 -0
- package/dist/types/core/viewers/Plugin.d.ts +29 -0
- package/dist/types/core/viewers/ViewerEvent.d.ts +178 -0
- package/dist/types/core/viewers/index.d.ts +4 -0
- package/dist/types/export.doc.d.ts +10 -0
- package/dist/types/fetch-polyfill.d.ts +2 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/plugins/annotation/AnnotationPlugin.d.ts +139 -0
- package/dist/types/plugins/annotation/AutoDrawAnnotation.d.ts +63 -0
- package/dist/types/plugins/annotation/BaseAnnotation.d.ts +113 -0
- package/dist/types/plugins/annotation/BaseAnnotationDrawable.d.ts +139 -0
- package/dist/types/plugins/annotation/CopyAnnotation.d.ts +36 -0
- package/dist/types/plugins/annotation/CopyDrawable.d.ts +26 -0
- package/dist/types/plugins/annotation/FreeDrawAnnotation.d.ts +59 -0
- package/dist/types/plugins/annotation/RectAnnotation.d.ts +53 -0
- package/dist/types/plugins/annotation/RectDrawable.d.ts +42 -0
- package/dist/types/plugins/annotation/ShapeFinder.d.ts +51 -0
- package/dist/types/plugins/annotation/freeDrawDrawable.d.ts +21 -0
- package/dist/types/plugins/annotation/index.d.ts +8 -0
- package/dist/types/plugins/annotation/type.d.ts +182 -0
- package/dist/types/plugins/axis-gizmo/AxisGizmoPlugin.d.ts +49 -0
- package/dist/types/plugins/axis-gizmo/CoordinateAxes.d.ts +12 -0
- package/dist/types/plugins/axis-gizmo/index.d.ts +1 -0
- package/dist/types/plugins/bottom-bar/BottomBarPlugin.d.ts +44 -0
- package/dist/types/plugins/bottom-bar/index.d.ts +1 -0
- package/dist/types/plugins/divide/CoverLayerManager.d.ts +44 -0
- package/dist/types/plugins/divide/DivGeometryUtils.d.ts +66 -0
- package/dist/types/plugins/divide/DividePlugin.d.ts +181 -0
- package/dist/types/plugins/divide/FrameAnnotation.d.ts +142 -0
- package/dist/types/plugins/divide/FrameDrawable.d.ts +75 -0
- package/dist/types/plugins/divide/index.d.ts +6 -0
- package/dist/types/plugins/divide/types.d.ts +38 -0
- package/dist/types/plugins/hotpoint/HotpointPlugin.d.ts +93 -0
- package/dist/types/plugins/hotpoint/index.d.ts +1 -0
- package/dist/types/plugins/index.d.ts +12 -0
- package/dist/types/plugins/layer-manager/LayerManagerPlugin.d.ts +59 -0
- package/dist/types/plugins/layer-manager/index.d.ts +1 -0
- package/dist/types/plugins/local-model-uploader/IUploader.d.ts +10 -0
- package/dist/types/plugins/local-model-uploader/LocalDxfUploader.d.ts +19 -0
- package/dist/types/plugins/local-model-uploader/index.d.ts +1 -0
- package/dist/types/plugins/measure/AngleMeasureDrawable.d.ts +12 -0
- package/dist/types/plugins/measure/AngleMeasurement.d.ts +16 -0
- package/dist/types/plugins/measure/AreaMeasureDrawable.d.ts +14 -0
- package/dist/types/plugins/measure/AreaMeasurement.d.ts +31 -0
- package/dist/types/plugins/measure/BaseMeasureDrawable.d.ts +35 -0
- package/dist/types/plugins/measure/BaseMeasurement.d.ts +127 -0
- package/dist/types/plugins/measure/CoordinateMeasureDrawable.d.ts +10 -0
- package/dist/types/plugins/measure/CoordinateMeasurement.d.ts +15 -0
- package/dist/types/plugins/measure/DistanceMeasureDrawable.d.ts +15 -0
- package/dist/types/plugins/measure/DistanceMeasurement.d.ts +28 -0
- package/dist/types/plugins/measure/MeasurementPlugin.d.ts +131 -0
- package/dist/types/plugins/measure/index.d.ts +3 -0
- package/dist/types/plugins/overview-map/ImageDrawable.d.ts +41 -0
- package/dist/types/plugins/overview-map/LineDrawable.d.ts +20 -0
- package/dist/types/plugins/overview-map/OverviewMapDrawable.d.ts +24 -0
- package/dist/types/plugins/overview-map/OverviewMapPlugin.d.ts +156 -0
- package/dist/types/plugins/overview-map/TextDrawable.d.ts +50 -0
- package/dist/types/plugins/overview-map/index.d.ts +5 -0
- package/dist/types/plugins/screenshot/ScreenshotPlugin.d.ts +88 -0
- package/dist/types/plugins/screenshot/index.d.ts +1 -0
- package/dist/types/plugins/stats/StatsPlugin.d.ts +20 -0
- package/dist/types/plugins/stats/index.d.ts +1 -0
- package/dist/types/plugins/toolbars/DxfViewerToolbarPlugin.d.ts +67 -0
- package/dist/types/plugins/toolbars/MarkupToolbar.d.ts +33 -0
- package/dist/types/plugins/toolbars/Toolbar.config.d.ts +5 -0
- package/dist/types/plugins/toolbars/Toolbar.constants.d.ts +96 -0
- package/dist/types/plugins/toolbars/Toolbar.d.ts +102 -0
- package/dist/types/plugins/toolbars/index.d.ts +5 -0
- package/dist/types/version.d.ts +2 -0
- package/package.json +90 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { ImageDrawable } from "./ImageDrawable";
|
|
3
|
+
import { OverviewMapDrawable } from "./OverviewMapDrawable";
|
|
4
|
+
import { Mat4, Vector2, Vector3 } from "../../core/Constants";
|
|
5
|
+
import type { Drawable } from "../../core/canvas/Drawable";
|
|
6
|
+
import { Plugin, PluginConfig } from "../../core/viewers/Plugin";
|
|
7
|
+
import { ViewerEvent } from "../../core/viewers/ViewerEvent";
|
|
8
|
+
export interface OverviewMapPluginConfig extends Partial<PluginConfig> {
|
|
9
|
+
containerId?: string;
|
|
10
|
+
context?: WebGLRenderingContext | WebGL2RenderingContext;
|
|
11
|
+
transformMatrix?: Mat4;
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
lockCameraInViewCenter?: boolean;
|
|
14
|
+
radius?: number;
|
|
15
|
+
minZoomFactor?: number;
|
|
16
|
+
maxZoomFactor?: number;
|
|
17
|
+
size?: {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface UpdateOverviewMapConfig {
|
|
23
|
+
image: string;
|
|
24
|
+
min: Vector3;
|
|
25
|
+
max: Vector3;
|
|
26
|
+
}
|
|
27
|
+
export declare enum OverviewMapPluginEvent {
|
|
28
|
+
ZoomChanged = "ZoomChanged",
|
|
29
|
+
SyncCamera = "SyncCamera",
|
|
30
|
+
CameraChanged = "CameraChanged"
|
|
31
|
+
}
|
|
32
|
+
export declare class OverviewMapPlugin extends Plugin<Record<OverviewMapPluginEvent | ViewerEvent, any>> {
|
|
33
|
+
static DEFAULT_ID: string;
|
|
34
|
+
private cfg;
|
|
35
|
+
private viewerContainer?;
|
|
36
|
+
private readonly CAMERA_Z_POSITION;
|
|
37
|
+
private width;
|
|
38
|
+
private height;
|
|
39
|
+
private frustumSize;
|
|
40
|
+
private renderEnabled;
|
|
41
|
+
private drawableList;
|
|
42
|
+
private clock;
|
|
43
|
+
private requestAnimationFrameHandle?;
|
|
44
|
+
private camera?;
|
|
45
|
+
private scene?;
|
|
46
|
+
private renderer?;
|
|
47
|
+
private overlayRender?;
|
|
48
|
+
private raf?;
|
|
49
|
+
private timeoutSymbol?;
|
|
50
|
+
private raycaster?;
|
|
51
|
+
private inputManager?;
|
|
52
|
+
private controls?;
|
|
53
|
+
private groundPlane?;
|
|
54
|
+
private transformMatrix;
|
|
55
|
+
private minZoomFactor;
|
|
56
|
+
private maxZoomFactor;
|
|
57
|
+
private radius?;
|
|
58
|
+
private size?;
|
|
59
|
+
private initialZoom?;
|
|
60
|
+
private cameraZoom?;
|
|
61
|
+
private imgBBox?;
|
|
62
|
+
private translateStart;
|
|
63
|
+
private rotateStart;
|
|
64
|
+
private markerRotateState;
|
|
65
|
+
private markerTranslateState;
|
|
66
|
+
private isMarkerRotating;
|
|
67
|
+
private isMarkerTranslating;
|
|
68
|
+
private isUpdateWhenPawnMove;
|
|
69
|
+
private timeout?;
|
|
70
|
+
private animationId?;
|
|
71
|
+
private animationParam?;
|
|
72
|
+
private boundaries?;
|
|
73
|
+
private allMarkersBBox;
|
|
74
|
+
tolerance: number;
|
|
75
|
+
enabled: boolean;
|
|
76
|
+
lockCameraInViewCenter: boolean;
|
|
77
|
+
enableLookToAllMarkers: boolean;
|
|
78
|
+
constructor(viewer: any, cfg?: OverviewMapPluginConfig);
|
|
79
|
+
get cameraDrawable(): ImageDrawable;
|
|
80
|
+
get cameraDirDrawable(): ImageDrawable;
|
|
81
|
+
get overviewMapDrawable(): OverviewMapDrawable;
|
|
82
|
+
private init;
|
|
83
|
+
private initDom;
|
|
84
|
+
private initInputManager;
|
|
85
|
+
private initScene;
|
|
86
|
+
private initCamera;
|
|
87
|
+
private initRenderer;
|
|
88
|
+
private initControls;
|
|
89
|
+
private onControlsChange;
|
|
90
|
+
private onControlsUpdate;
|
|
91
|
+
private initEvents;
|
|
92
|
+
/******* Overview map events ********/
|
|
93
|
+
private getDrawableByEvent;
|
|
94
|
+
private onCameraHover;
|
|
95
|
+
private handlePointerDown;
|
|
96
|
+
private onCameraMove;
|
|
97
|
+
private handlePointerUp;
|
|
98
|
+
private handlePointerLeave;
|
|
99
|
+
private handlePointerEnter;
|
|
100
|
+
private handleDblClick;
|
|
101
|
+
private handlePointerMove;
|
|
102
|
+
private syncCamera;
|
|
103
|
+
/*****************************************************/
|
|
104
|
+
/******* According radius to calculate zoom ********/
|
|
105
|
+
private updateZoomFromRadius;
|
|
106
|
+
private getContainerRadius;
|
|
107
|
+
private screenDistance2WorldDistance;
|
|
108
|
+
/*****************************************************/
|
|
109
|
+
/******* create ground plane for pick ********/
|
|
110
|
+
protected initGroundPlane(bbox: THREE.Box3): void;
|
|
111
|
+
/*****************************************************/
|
|
112
|
+
private initMaxAndMinZoom;
|
|
113
|
+
/************** create overviewMap ****************/
|
|
114
|
+
getImageElementFromUrl(url: string): Promise<HTMLImageElement>;
|
|
115
|
+
updateOverviewMap(cfg: UpdateOverviewMapConfig): Promise<void>;
|
|
116
|
+
private createCameraMarkers;
|
|
117
|
+
initCameraMarkers(position: Vector3, direction: Vector3): Promise<void>;
|
|
118
|
+
/*****************************************************/
|
|
119
|
+
/************** Upate overview map camera ****************/
|
|
120
|
+
private updateOverviewMapCameraAnimation;
|
|
121
|
+
updateOverviewMapCamera(position: Vector3, direction: Vector3): void;
|
|
122
|
+
/*****************************************************/
|
|
123
|
+
private zoomToBBox;
|
|
124
|
+
private enableRender;
|
|
125
|
+
addMarker(marker: Drawable): void;
|
|
126
|
+
getMarker(id: string): Drawable | undefined;
|
|
127
|
+
removeMarker(marker: Drawable): void;
|
|
128
|
+
dollyIn(zoomDelta?: number): void;
|
|
129
|
+
dollyOut(zoomDelta?: number): void;
|
|
130
|
+
goToHomeView(): void;
|
|
131
|
+
setRadius(radius: number): void;
|
|
132
|
+
registerBoundaries(boundries: {
|
|
133
|
+
id: string;
|
|
134
|
+
name: string;
|
|
135
|
+
points: Vector2[];
|
|
136
|
+
}[]): void;
|
|
137
|
+
isPointInBoundary: (position: Vector2) => undefined;
|
|
138
|
+
screenShot(): Promise<string | undefined>;
|
|
139
|
+
/**
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
142
|
+
getViewConfig(): OverviewMapPluginConfig;
|
|
143
|
+
is3d(): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Gets how long a pixel represents in world coordinate.
|
|
146
|
+
* This works fine for OrthographicCamera.
|
|
147
|
+
* As for PerspectiveCamera, a pixel represents different size for different position,
|
|
148
|
+
* depends on how far the camera is and its fov, etc. We'll simply take the camera target as the position to calculate.
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
151
|
+
getPixelSizeInWorldCoord(): number;
|
|
152
|
+
private lookToAllMarkers;
|
|
153
|
+
private resize;
|
|
154
|
+
private animate;
|
|
155
|
+
destroy(): void;
|
|
156
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { Vector3, Vector2 } from "../../core/Constants";
|
|
3
|
+
import { Drawable } from "../../core/canvas/Drawable";
|
|
4
|
+
export interface TextStyle {
|
|
5
|
+
fontSize?: number;
|
|
6
|
+
fontWeight?: string;
|
|
7
|
+
fontFamily?: string;
|
|
8
|
+
fontColor?: string;
|
|
9
|
+
outlineColor?: string;
|
|
10
|
+
outlineWidth?: number;
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
borderRadius?: number;
|
|
13
|
+
borderWidth?: number;
|
|
14
|
+
borderColor?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface TextDrawableConfig {
|
|
17
|
+
text: string;
|
|
18
|
+
position: Vector3;
|
|
19
|
+
radius?: number;
|
|
20
|
+
displayRadius?: number;
|
|
21
|
+
offset?: Vector2;
|
|
22
|
+
textStyle?: TextStyle;
|
|
23
|
+
size?: {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
};
|
|
27
|
+
renderOrder?: number;
|
|
28
|
+
}
|
|
29
|
+
export declare class TextDrawable extends Drawable {
|
|
30
|
+
renderOrder: number;
|
|
31
|
+
text: string;
|
|
32
|
+
position: Vector3;
|
|
33
|
+
offset: Vector2;
|
|
34
|
+
size: {
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
};
|
|
38
|
+
textStyle: TextStyle;
|
|
39
|
+
displayRadius: number;
|
|
40
|
+
radius?: number;
|
|
41
|
+
needsFrustumCulled: boolean;
|
|
42
|
+
constructor(id: string, cfg: TextDrawableConfig);
|
|
43
|
+
private getFont;
|
|
44
|
+
drawRoundRect(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, cameraPosition: THREE.Vector2, bClippable: boolean): void;
|
|
45
|
+
draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
46
|
+
drawSelect(): void;
|
|
47
|
+
getClassType(): string;
|
|
48
|
+
isPointInPath(): boolean;
|
|
49
|
+
getBBox(): THREE.Box3;
|
|
50
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { BaseViewer, BoxSelectHelper, PickMarkupHelper, Plugin, PluginConfig, ScreenshotMode, ScreenshotResult } from "../../core";
|
|
3
|
+
/**
|
|
4
|
+
* Screenshot plugin config.
|
|
5
|
+
*/
|
|
6
|
+
export interface ScreenshotPluginConfig extends Partial<PluginConfig> {
|
|
7
|
+
/**
|
|
8
|
+
* Image type.
|
|
9
|
+
*/
|
|
10
|
+
type?: "image/png" | "image/jpg";
|
|
11
|
+
/**
|
|
12
|
+
* Image quality.
|
|
13
|
+
*/
|
|
14
|
+
quality?: 0.8;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Screenshot plugin
|
|
18
|
+
*/
|
|
19
|
+
export declare class ScreenshotPlugin extends Plugin {
|
|
20
|
+
static DEFAULT_ID: string;
|
|
21
|
+
protected cfg: ScreenshotPluginConfig;
|
|
22
|
+
protected boxSelectHelper?: BoxSelectHelper;
|
|
23
|
+
protected pickMarkupHelper?: PickMarkupHelper;
|
|
24
|
+
constructor(viewer: BaseViewer, cfg?: ScreenshotPluginConfig);
|
|
25
|
+
/**
|
|
26
|
+
* @description {en} Gets screenshot of current canvas. Returns an image in format of base64 string.
|
|
27
|
+
* @description {zh} 获取画布的截屏。该方法返回一个 base64 类型的字符串。
|
|
28
|
+
* @example
|
|
29
|
+
* ``` typescript
|
|
30
|
+
* const plugin = new ScreenshotPlugin(viewer);
|
|
31
|
+
* const base64Image = plugin.getScreenshot();
|
|
32
|
+
* console.log(base64Image);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
getScreenshot(): string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Gets screenshot by bbox under screen cooridinate.
|
|
38
|
+
*/
|
|
39
|
+
getScreenshotByScreenBBox(bbox: THREE.Box2): Promise<string | undefined>;
|
|
40
|
+
/**
|
|
41
|
+
* Gets screenshot by bbox under world coordinate.
|
|
42
|
+
* It needs to convert world to screen coordinate, in order to get the
|
|
43
|
+
* screenshot range. Assume it maps to bboxA under screen coordinate,
|
|
44
|
+
* and current view boundary is bboxB (e.g., 0,0 - 1024,768).
|
|
45
|
+
* Since, a given world coordinate may not be in current view boundary.
|
|
46
|
+
* The finally screenshot is the overlap of bboxA and bboxB. When
|
|
47
|
+
* - bboxA includes bboxB, it get screenshot for bboxB
|
|
48
|
+
* - bboxB includes bboxA, it get screenshot for bboxA
|
|
49
|
+
* - bboxA overlaps with bboxB, it get screenshot for the overlapped area
|
|
50
|
+
* - bboxA doesn't overlap with bboxB, it get nothing
|
|
51
|
+
*
|
|
52
|
+
* A best practice to use this API is to use orthographic camera, under top view,
|
|
53
|
+
* and pass in viewer's bbox.
|
|
54
|
+
*/
|
|
55
|
+
getScreenshotByWorldBBox(bbox: THREE.Box3): Promise<string | undefined>;
|
|
56
|
+
/**
|
|
57
|
+
* @description {en} Gets screenshot of a rectangular area, or by box selecting an area. Returns an image in format of base64 string.
|
|
58
|
+
* @description {zh} 获取矩形区域或者框选区域的截图。返回base64格式的图片。
|
|
59
|
+
* @param mode
|
|
60
|
+
* - {en} screenshot mode("Default", "BoxSelection" and "PickMarkup").
|
|
61
|
+
* - {zh} 截图模式("全屏", "框选" 和 "选中批注")。
|
|
62
|
+
* @example
|
|
63
|
+
* ``` typescript
|
|
64
|
+
* // {en} Click on markup to take screenshot.
|
|
65
|
+
* // {zh} 点击批注截屏。
|
|
66
|
+
* const mode = ScreenshotMode.PickMarkup;
|
|
67
|
+
* viewer.getScreenshot(mode).then(data => console.log(data));
|
|
68
|
+
* // {en} Take screenshot by box selecting an area.
|
|
69
|
+
* // {zh} 根据用户的框选截屏。
|
|
70
|
+
* const mode = ScreenshotMode.BoxSelection;
|
|
71
|
+
* viewer.getScreenshot(mode).then(data => console.log(data));
|
|
72
|
+
* // {en} Take screenshot of the whole view.
|
|
73
|
+
* // {zh} 全屏截屏。
|
|
74
|
+
* const mode = ScreenshotMode.Default;
|
|
75
|
+
* const plugin = new ScreenshotPlugin(viewer);
|
|
76
|
+
* plugin.getScreenshotAsync(mode).then(data => console.log(data));
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
getScreenshotAsync(mode?: ScreenshotMode): Promise<undefined | ScreenshotResult>;
|
|
80
|
+
/**
|
|
81
|
+
* If ScreenshotPlugin is active.
|
|
82
|
+
*/
|
|
83
|
+
isActive(): (() => boolean) | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Cancel current operation if any.
|
|
86
|
+
*/
|
|
87
|
+
cancel(): void;
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ScreenshotPlugin";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="stats.js" />
|
|
2
|
+
import Stats from "three/examples/jsm/libs/stats.module.js";
|
|
3
|
+
import { BaseViewer, Plugin } from "../../core";
|
|
4
|
+
/**
|
|
5
|
+
* Stats plugin is a debug tool for developers to observe the performance of a page.
|
|
6
|
+
*/
|
|
7
|
+
export declare class StatsPlugin extends Plugin {
|
|
8
|
+
protected stats?: Stats;
|
|
9
|
+
constructor(viewer: BaseViewer);
|
|
10
|
+
private init;
|
|
11
|
+
/**
|
|
12
|
+
* Shows the stats panel, which indicates current FPS, MS, MB, etc.
|
|
13
|
+
*/
|
|
14
|
+
show(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Shows the stats panel, which indicates current FPS, MS, MB, etc.
|
|
17
|
+
*/
|
|
18
|
+
hide(): void;
|
|
19
|
+
destroy(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StatsPlugin";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Toolbar } from "./Toolbar";
|
|
2
|
+
import { ToolbarConfig, ToolbarMenuId } from "./Toolbar.constants";
|
|
3
|
+
import { Plugin, type BaseViewer, PluginConfig } from "../../core/viewers";
|
|
4
|
+
/**
|
|
5
|
+
* DxfViewer 工具栏插件配置接口
|
|
6
|
+
*/
|
|
7
|
+
export interface DxfViewerToolbarPluginConfig extends Partial<PluginConfig> {
|
|
8
|
+
/** 主工具栏菜单配置 */
|
|
9
|
+
menuConfig: ToolbarConfig;
|
|
10
|
+
/** 主工具栏分组配置,定义菜单项的分组排列 */
|
|
11
|
+
groupConfig?: ToolbarMenuId[][] | string[][];
|
|
12
|
+
/** 标注工具栏菜单配置 */
|
|
13
|
+
markupMenuCfg?: ToolbarConfig;
|
|
14
|
+
/** 标注工具栏分组配置 */
|
|
15
|
+
markupGroupCfg?: ToolbarMenuId[][] | string[][];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* DxfViewer 工具栏插件
|
|
19
|
+
* 负责管理主工具栏和标注工具栏的显示、隐藏和切换
|
|
20
|
+
*/
|
|
21
|
+
export declare class DxfViewerToolbarPlugin extends Plugin {
|
|
22
|
+
/** 插件默认 ID */
|
|
23
|
+
static DEFAULT_ID: string;
|
|
24
|
+
/** 插件配置 */
|
|
25
|
+
protected cfg: DxfViewerToolbarPluginConfig;
|
|
26
|
+
/** 主工具栏实例 */
|
|
27
|
+
protected toolbar: Toolbar;
|
|
28
|
+
/** 标注工具栏实例,按需创建 */
|
|
29
|
+
protected markupToolbar?: Toolbar;
|
|
30
|
+
/**
|
|
31
|
+
* 构造函数
|
|
32
|
+
* @param viewer 查看器实例
|
|
33
|
+
* @param cfg 插件配置
|
|
34
|
+
*/
|
|
35
|
+
constructor(viewer: BaseViewer, cfg?: DxfViewerToolbarPluginConfig);
|
|
36
|
+
/**
|
|
37
|
+
* 获取主工具栏实例
|
|
38
|
+
* @returns 主工具栏实例
|
|
39
|
+
*/
|
|
40
|
+
getToolbar(): Toolbar;
|
|
41
|
+
/**
|
|
42
|
+
* 获取标注工具栏实例
|
|
43
|
+
* @returns 标注工具栏实例,可能为 undefined
|
|
44
|
+
*/
|
|
45
|
+
getMarkupToolbar(): Toolbar | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* 设置菜单项的激活状态
|
|
48
|
+
* @param menuId 菜单项 ID
|
|
49
|
+
* @param active 是否激活
|
|
50
|
+
*/
|
|
51
|
+
setActive(menuId: string, active: boolean): void;
|
|
52
|
+
/**
|
|
53
|
+
* 标注激活事件处理函数
|
|
54
|
+
* 当用户激活标注功能时,隐藏主工具栏并显示标注工具栏
|
|
55
|
+
*/
|
|
56
|
+
protected onMarkupActivated: () => void;
|
|
57
|
+
/**
|
|
58
|
+
* 标注取消激活事件处理函数
|
|
59
|
+
* 当用户退出标注功能时,隐藏标注工具栏并显示主工具栏
|
|
60
|
+
*/
|
|
61
|
+
protected onMarkupDeactivated: () => void;
|
|
62
|
+
/**
|
|
63
|
+
* 销毁插件
|
|
64
|
+
* 清理资源,移除事件监听器,销毁工具栏实例
|
|
65
|
+
*/
|
|
66
|
+
destroy(): void;
|
|
67
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Toolbar } from "./Toolbar";
|
|
2
|
+
import { ToolbarConfig, ToolbarMenuId } from "./Toolbar.constants";
|
|
3
|
+
import { type BaseViewer } from "../../core/viewers";
|
|
4
|
+
/**
|
|
5
|
+
* 默认标注工具栏配置
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_MARKUP_TOOLBAR_CONFIG: ToolbarConfig;
|
|
9
|
+
/**
|
|
10
|
+
* 标注工具栏分组配置
|
|
11
|
+
* 定义了标注工具栏中菜单项的分组和排列顺序
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const MARKUP_GROUP_CONFIG: ToolbarMenuId[][];
|
|
15
|
+
/**
|
|
16
|
+
* 标注工具栏类
|
|
17
|
+
* 继承自基础工具栏类,专门用于标注功能
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare class MarkupToolbar extends Toolbar {
|
|
21
|
+
/**
|
|
22
|
+
* 构造函数
|
|
23
|
+
* @param viewer 查看器实例
|
|
24
|
+
* @param menuCfg 菜单配置对象
|
|
25
|
+
* @param groupCfg 分组配置数组,默认为空数组
|
|
26
|
+
*/
|
|
27
|
+
constructor(viewer: BaseViewer, menuCfg: ToolbarConfig, groupCfg?: ToolbarMenuId[][] | string[][]);
|
|
28
|
+
/**
|
|
29
|
+
* 键盘按下事件处理函数
|
|
30
|
+
* 目前为空实现,可在未来添加键盘快捷键功能
|
|
31
|
+
*/
|
|
32
|
+
keydown: () => void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { Toolbar } from "./Toolbar";
|
|
2
|
+
import { IconClass } from "../../core";
|
|
3
|
+
import type { BaseViewer } from "../../core/viewers";
|
|
4
|
+
/**
|
|
5
|
+
* @type 菜单类型枚举说明
|
|
6
|
+
* 1: click event 点击事件
|
|
7
|
+
* 2:show popup 显示弹出窗口
|
|
8
|
+
* 3:show submenu 显示子菜单
|
|
9
|
+
* 4:turn on/off 开关切换
|
|
10
|
+
*/
|
|
11
|
+
export declare enum MenuTypeEnums {
|
|
12
|
+
ClickEvent = 1,
|
|
13
|
+
Popup = 2,
|
|
14
|
+
SubMenu = 3,
|
|
15
|
+
Switch = 4
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Buildin toolbar ids 内置工具栏ID
|
|
19
|
+
*/
|
|
20
|
+
export declare enum ToolbarMenuId {
|
|
21
|
+
HomeView = "HomeView",
|
|
22
|
+
OrthoMode = "OrthoMode",
|
|
23
|
+
Measure = "Measure",
|
|
24
|
+
MeasureDistance = "MeasureDistance",
|
|
25
|
+
MeasureArea = "MeasureArea",
|
|
26
|
+
MeasureAngle = "MeasureAngle",
|
|
27
|
+
MeasureCoordinate = "MeasureCoordinate",
|
|
28
|
+
MeasureClear = "MeasureClear",
|
|
29
|
+
MarkupVisibility = "MarkupVisibility",
|
|
30
|
+
Markup = "Markup",
|
|
31
|
+
MarkupArrow = "Arrow",
|
|
32
|
+
MarkupRect = "Rect",
|
|
33
|
+
MarkupCloudRect = "CloudRect",
|
|
34
|
+
MarkupPolyLine = "PolyLine",
|
|
35
|
+
MarkupCloudLine = "CloudLine",
|
|
36
|
+
MarkupEllipse = "Ellipse",
|
|
37
|
+
MarkupCircle = "Circle",
|
|
38
|
+
MarkupDot = "Dot",
|
|
39
|
+
MarkupText = "Text",
|
|
40
|
+
MarkupX = "X",
|
|
41
|
+
MarkupStrokeStyle = "StrokeStyle",
|
|
42
|
+
MarkupLineWidth = "LineWidth",
|
|
43
|
+
MarkupLineWidth2 = "LineWidth2",
|
|
44
|
+
MarkupLineWidth5 = "LineWidth5",
|
|
45
|
+
MarkupLineWidth10 = "LineWidth10",
|
|
46
|
+
MarkupFontSize = "FontSize",
|
|
47
|
+
MarkupFontSize14 = "FontSize14",
|
|
48
|
+
MarkupFontSize18 = "FontSize18",
|
|
49
|
+
MarkupFontSize24 = "FontSize24",
|
|
50
|
+
MarkupClear = "MarkupClear",
|
|
51
|
+
MarkupQuit = "MarkupQuit",
|
|
52
|
+
Section = "Section",
|
|
53
|
+
SectionBox = "SectionBox",
|
|
54
|
+
SectionPlane = "SectionPlane",
|
|
55
|
+
SectionAxis = "SectionAxis",
|
|
56
|
+
BimTree = "BimTree",
|
|
57
|
+
Viewpoint = "Viewpoint",
|
|
58
|
+
Annotation = "Annotation",
|
|
59
|
+
Property = "Property",
|
|
60
|
+
Settings = "Settings",
|
|
61
|
+
Compared = "Compared",
|
|
62
|
+
QuitCompare = "QuitCompare",
|
|
63
|
+
Fullscreen = "FullScreen",
|
|
64
|
+
SceneClear = "SceneClear",
|
|
65
|
+
Layers = "Layers",
|
|
66
|
+
ZoomToRectangle = "ZoomToRectangle",
|
|
67
|
+
Screenshot = "GetScreenshot"
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Toolbar menu config. 工具栏菜单配置
|
|
71
|
+
* Used to define menu item name, icon, child items, etc. 用于定义菜单项名称、图标、子项等
|
|
72
|
+
*/
|
|
73
|
+
export interface ToolbarMenuConfig {
|
|
74
|
+
menuName?: string;
|
|
75
|
+
icon?: IconClass;
|
|
76
|
+
children?: ToolbarConfig;
|
|
77
|
+
visible?: boolean;
|
|
78
|
+
mutexIds?: ToolbarMenuId[];
|
|
79
|
+
defaultActive?: boolean;
|
|
80
|
+
type?: MenuTypeEnums;
|
|
81
|
+
customElement?: (viewer: BaseViewer, menuId: string, cfg: ToolbarMenuConfig) => HTMLDivElement;
|
|
82
|
+
onActive?: (viewer: BaseViewer) => void;
|
|
83
|
+
onDeactive?: (viewer: BaseViewer) => void;
|
|
84
|
+
onClick?: (viewer: BaseViewer, toolbar: Toolbar, event: MouseEvent | TouchEvent) => void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Toolbar config. 工具栏配置类型
|
|
88
|
+
* The key is ToolbarMenuId, and the value is a ToolbarMenuConfig. 键是工具栏菜单ID,值是工具栏菜单配置
|
|
89
|
+
*/
|
|
90
|
+
export declare type ToolbarConfig = {
|
|
91
|
+
[key in ToolbarMenuId]?: ToolbarMenuConfig;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* @internal 内部使用标记
|
|
95
|
+
*/
|
|
96
|
+
export declare const GROUP_CONFIG: ToolbarMenuId[][];
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ToolbarConfig, ToolbarMenuConfig, ToolbarMenuId } from "./Toolbar.constants";
|
|
2
|
+
import { type BaseViewer } from "../../core/viewers";
|
|
3
|
+
/**
|
|
4
|
+
* @class Toolbar 工具栏类
|
|
5
|
+
* @description A customized toolbar. 自定义工具栏
|
|
6
|
+
*
|
|
7
|
+
* For example: 使用示例:
|
|
8
|
+
* #### Example 1: 示例1:
|
|
9
|
+
* Using {@link updateMenu} to modify the toolbar configuration 使用updateMenu方法修改工具栏配置
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const toolbar = this.viewer.toolbar;
|
|
12
|
+
* toolbar.updateMenu(ToolbarMenuId.Viewpoint, { onActive: this.handleActive });
|
|
13
|
+
* toolbar.updateMenu(ToolbarMenuId.Annotation, { visible: false });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* #### Example 2: 示例2:
|
|
17
|
+
* Using {@link addMenu} to add a new menu to the toolbar with specific position. 使用addMenu方法在指定位置添加新菜单
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const toolbar = this.viewer.toolbar;
|
|
20
|
+
* toolbar.addMenu(
|
|
21
|
+
* "newMenu",
|
|
22
|
+
* { icon: { default: "icon-new" }, menuName: "New menu item", controller: BimTreeController },
|
|
23
|
+
* [2, 5]
|
|
24
|
+
* );
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* #### Example 3: 示例3:
|
|
28
|
+
* Modify the configuration in to custmize the toolbar directly, and then {@link refresh} the whole toolbar. 直接修改配置来自定义工具栏,然后刷新整个工具栏
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const toolbar = this.viewer.toolbar;
|
|
31
|
+
* const toolbarGroupConfig = [
|
|
32
|
+
* [ToolbarMenuId.OrthoMode, ToolbarMenuId.FullScreen],
|
|
33
|
+
* [ToolbarMenuId.Measure, ToolbarMenuId.Section],
|
|
34
|
+
* [ToolbarMenuId.BimTree, ToolbarMenuId.Viewpoint, ToolbarMenuId.Annotation, ToolbarMenuId.Property],
|
|
35
|
+
* [ToolbarMenuId.Setting, "newMenu"],
|
|
36
|
+
* ];
|
|
37
|
+
* toolbar.toolbarGroupConfig = toolbarGroupConfig;
|
|
38
|
+
* toolbar.refresh();
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare class Toolbar {
|
|
42
|
+
protected viewer: BaseViewer;
|
|
43
|
+
protected element: HTMLDivElement | undefined;
|
|
44
|
+
protected visible: boolean;
|
|
45
|
+
activateMenuId?: string;
|
|
46
|
+
menuList: Map<string, ToolbarMenu>;
|
|
47
|
+
protected menuCfg: ToolbarConfig;
|
|
48
|
+
protected groupCfg: ToolbarMenuId[][] | string[][];
|
|
49
|
+
constructor(viewer: BaseViewer, menuCfg: ToolbarConfig, groupCfg?: ToolbarMenuId[][] | string[][]);
|
|
50
|
+
private init;
|
|
51
|
+
keydown: (e: KeyboardEvent) => void;
|
|
52
|
+
clearActive(): void;
|
|
53
|
+
setActive(menuId: string, active: boolean): void;
|
|
54
|
+
private createToolbarMenu;
|
|
55
|
+
/**
|
|
56
|
+
* @description Modify the menu configuration and update the toolbar. 修改菜单配置并更新工具栏
|
|
57
|
+
* @param {ToolbarMenuId} menuId 菜单ID
|
|
58
|
+
* @param {Partial<ToolbarMenuConfig>} config 菜单配置的部分更新
|
|
59
|
+
* @memberof Toolbar 工具栏类的成员方法
|
|
60
|
+
*/
|
|
61
|
+
updateMenu(menuId: ToolbarMenuId, config: Partial<ToolbarMenuConfig>): void;
|
|
62
|
+
/**
|
|
63
|
+
* @description Modify the menu configuration and update the toolbar. 批量修改菜单配置并更新工具栏
|
|
64
|
+
* @param {{ menuId: ToolbarMenuId; config: Partial<ToolbarMenuConfig> }[]} configs 菜单配置数组,每个元素包含菜单ID和配置
|
|
65
|
+
* @memberof Toolbar 工具栏类的成员方法
|
|
66
|
+
*/
|
|
67
|
+
updateMenus(configs: {
|
|
68
|
+
menuId: ToolbarMenuId;
|
|
69
|
+
config: Partial<ToolbarMenuConfig>;
|
|
70
|
+
}[]): void;
|
|
71
|
+
/**
|
|
72
|
+
* @description Add a custmized menu to toolbar. 向工具栏添加自定义菜单
|
|
73
|
+
* @param {string} menuId 菜单ID
|
|
74
|
+
* @param {ToolbarMenuConfig} config 菜单配置
|
|
75
|
+
* @param {[number, number]} [insertPosition] 可选的插入位置,[分组索引, 项目索引]
|
|
76
|
+
* @return {*} 无返回值
|
|
77
|
+
* @memberof Toolbar 工具栏类的成员方法
|
|
78
|
+
*/
|
|
79
|
+
addMenu(menuId: string, config: ToolbarMenuConfig, insertPosition?: [number, number]): void;
|
|
80
|
+
/**
|
|
81
|
+
* @description Update the whole toolbar element with the current configuration. 使用当前配置更新整个工具栏元素
|
|
82
|
+
* @memberof Toolbar 工具栏类的成员方法
|
|
83
|
+
*/
|
|
84
|
+
refresh(): void;
|
|
85
|
+
show(): void;
|
|
86
|
+
hide(): void;
|
|
87
|
+
destroy(): void;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @internal 内部使用标记
|
|
91
|
+
*/
|
|
92
|
+
export declare class ToolbarMenu {
|
|
93
|
+
private eventBus;
|
|
94
|
+
active: boolean;
|
|
95
|
+
element: HTMLDivElement;
|
|
96
|
+
toolbar: Toolbar;
|
|
97
|
+
markupToolbar?: Toolbar;
|
|
98
|
+
menuId: string;
|
|
99
|
+
constructor(viewer: BaseViewer, toolbar: Toolbar, menuId: string, cfg: ToolbarMenuConfig, parent?: ToolbarMenu);
|
|
100
|
+
private createButton;
|
|
101
|
+
setActive(active: boolean): void;
|
|
102
|
+
}
|