@maqiuyao/dxf-viewer 0.1.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 +79 -0
- package/dist/assets/vite-project.css +1 -0
- package/dist/dxf-viewer.cjs +1533 -0
- package/dist/dxf-viewer.js +33490 -0
- package/dist/src/dxfViewer/core/Configs.d.ts +250 -0
- package/dist/src/dxfViewer/core/Constants.d.ts +76 -0
- package/dist/src/dxfViewer/core/Units.d.ts +16 -0
- package/dist/src/dxfViewer/core/VersionManager.d.ts +14 -0
- package/dist/src/dxfViewer/core/camera/CameraManager.d.ts +81 -0
- package/dist/src/dxfViewer/core/camera/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/camera-controls/CameraControls.d.ts +744 -0
- package/dist/src/dxfViewer/core/camera-controls/Constants.d.ts +2 -0
- package/dist/src/dxfViewer/core/camera-controls/EventDispatcher.d.ts +42 -0
- package/dist/src/dxfViewer/core/camera-controls/index.d.ts +2 -0
- package/dist/src/dxfViewer/core/camera-controls/types.d.ts +112 -0
- package/dist/src/dxfViewer/core/camera-controls/utils/extractClientCoordFromEvent.d.ts +7 -0
- package/dist/src/dxfViewer/core/camera-controls/utils/math-utils.d.ts +14 -0
- package/dist/src/dxfViewer/core/camera-controls/utils/notSupportedInOrthographicCamera.d.ts +2 -0
- package/dist/src/dxfViewer/core/canvas/CanvasRender.d.ts +49 -0
- package/dist/src/dxfViewer/core/canvas/Constants.d.ts +28 -0
- package/dist/src/dxfViewer/core/canvas/Drawable.d.ts +87 -0
- package/dist/src/dxfViewer/core/canvas/DrawableList.d.ts +40 -0
- package/dist/src/dxfViewer/core/canvas/index.d.ts +4 -0
- package/dist/src/dxfViewer/core/compare/BaseDxfCompareHelper.d.ts +104 -0
- package/dist/src/dxfViewer/core/compare/CompareDrawable.d.ts +30 -0
- package/dist/src/dxfViewer/core/compare/DxfCompareHelper.d.ts +76 -0
- package/dist/src/dxfViewer/core/compare/DxfCompareMarkupManager.d.ts +11 -0
- package/dist/src/dxfViewer/core/compare/index.d.ts +4 -0
- package/dist/src/dxfViewer/core/components/Container.d.ts +38 -0
- package/dist/src/dxfViewer/core/components/ProgressBar.d.ts +31 -0
- package/dist/src/dxfViewer/core/components/Spinner.d.ts +13 -0
- package/dist/src/dxfViewer/core/components/index.d.ts +3 -0
- package/dist/src/dxfViewer/core/controls/CameraControlsEx.d.ts +33 -0
- package/dist/src/dxfViewer/core/controls/Control.d.ts +17 -0
- package/dist/src/dxfViewer/core/controls/OrbitControls.d.ts +13 -0
- package/dist/src/dxfViewer/core/controls/PlanControls.d.ts +13 -0
- package/dist/src/dxfViewer/core/controls/index.d.ts +3 -0
- package/dist/src/dxfViewer/core/dxf/DxfCompare.d.ts +170 -0
- package/dist/src/dxfViewer/core/dxf/DxfConstants.d.ts +24 -0
- package/dist/src/dxfViewer/core/dxf/DxfLoader.d.ts +569 -0
- package/dist/src/dxfViewer/core/dxf/DxfObject.d.ts +44 -0
- package/dist/src/dxfViewer/core/dxf/DxfUtils.d.ts +79 -0
- package/dist/src/dxfViewer/core/dxf/HatchPatternShaders.d.ts +12 -0
- package/dist/src/dxfViewer/core/dxf/LinePatternShaders.d.ts +12 -0
- package/dist/src/dxfViewer/core/dxf/bspline.d.ts +7 -0
- package/dist/src/dxfViewer/core/dxf/dxfom-mtext.d.ts +46 -0
- package/dist/src/dxfViewer/core/dxf/dxfom-text.d.ts +16 -0
- package/dist/src/dxfViewer/core/dxf/index.d.ts +10 -0
- package/dist/src/dxfViewer/core/dxf/round10.d.ts +1 -0
- package/dist/src/dxfViewer/core/dxf-parser/AutoCadColorIndex.d.ts +8 -0
- package/dist/src/dxfViewer/core/dxf-parser/DxfBaseReader.d.ts +13 -0
- package/dist/src/dxfViewer/core/dxf-parser/DxfBinaryReader.d.ts +14 -0
- package/dist/src/dxfViewer/core/dxf-parser/DxfParser.d.ts +321 -0
- package/dist/src/dxfViewer/core/dxf-parser/DxfTextReader.d.ts +30 -0
- package/dist/src/dxfViewer/core/dxf-parser/ParseHelpers.d.ts +18 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/3dface.d.ts +11 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/arc.d.ts +16 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/attdef.d.ts +31 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/attrib.d.ts +31 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/circle.d.ts +13 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/dimension.d.ts +22 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/ellipse.d.ts +15 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/geomtry.d.ts +40 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/hatch.d.ts +104 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/image.d.ts +37 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/insert.d.ts +21 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/leader.d.ts +20 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/line.d.ts +10 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/lwpolyline.d.ts +17 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/mleader.d.ts +97 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/mtext.d.ts +18 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/ole2frame.d.ts +18 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/point.d.ts +11 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/polyline.d.ts +19 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/ray.d.ts +10 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/region.d.ts +10 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/seqend.d.ts +8 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/solid.d.ts +10 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/spline.d.ts +23 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/table.d.ts +44 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/text.d.ts +18 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/vertex.d.ts +23 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/viewport.d.ts +46 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/xline.d.ts +10 -0
- package/dist/src/dxfViewer/core/dxf-parser/index.d.ts +27 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/common.d.ts +15 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/dictionary.d.ts +19 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/imagedef.d.ts +24 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/layout.d.ts +26 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/sortentstable.d.ts +12 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/spatialfilter.d.ts +22 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/xrecord.d.ts +11 -0
- package/dist/src/dxfViewer/core/effect/EffectManager.d.ts +43 -0
- package/dist/src/dxfViewer/core/effect/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/font/BaseFont.d.ts +41 -0
- package/dist/src/dxfViewer/core/font/FontManager.d.ts +52 -0
- package/dist/src/dxfViewer/core/font/MeshFont.d.ts +14 -0
- package/dist/src/dxfViewer/core/font/ShxFont.d.ts +49 -0
- package/dist/src/dxfViewer/core/font/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/font/shx/ExtraLettersTemplate.d.ts +4 -0
- package/dist/src/dxfViewer/core/font/shx/Shx.constants.d.ts +20 -0
- package/dist/src/dxfViewer/core/font/shx/ShxParser.d.ts +18 -0
- package/dist/src/dxfViewer/core/font/shx/TextShape.d.ts +24 -0
- package/dist/src/dxfViewer/core/font/shx/gbk/index.d.ts +3 -0
- package/dist/src/dxfViewer/core/font/shx/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/font/shx/util/BitConverter.d.ts +21 -0
- package/dist/src/dxfViewer/core/geometry-offset/Edge.d.ts +27 -0
- package/dist/src/dxfViewer/core/geometry-offset/Offset.d.ts +46 -0
- package/dist/src/dxfViewer/core/geometry-offset/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/helpers/BinaryReader.d.ts +23 -0
- package/dist/src/dxfViewer/core/helpers/BoxSelectHelper.d.ts +44 -0
- package/dist/src/dxfViewer/core/helpers/InstantiateHelper.d.ts +26 -0
- package/dist/src/dxfViewer/core/helpers/LoadingHelper.d.ts +59 -0
- package/dist/src/dxfViewer/core/helpers/MeshBvhHelper.d.ts +15 -0
- package/dist/src/dxfViewer/core/helpers/MobileTouchHelperDrawable.d.ts +26 -0
- package/dist/src/dxfViewer/core/helpers/OSnapHelper.d.ts +158 -0
- package/dist/src/dxfViewer/core/helpers/ObjectPixelSizeHelper.d.ts +13 -0
- package/dist/src/dxfViewer/core/helpers/PickMarkupHelper.d.ts +29 -0
- package/dist/src/dxfViewer/core/helpers/RafHelper.d.ts +18 -0
- package/dist/src/dxfViewer/core/helpers/ZoomToRectHelper.d.ts +24 -0
- package/dist/src/dxfViewer/core/helpers/index.d.ts +11 -0
- package/dist/src/dxfViewer/core/index.d.ts +19 -0
- package/dist/src/dxfViewer/core/indexeddb/BaseTable.d.ts +36 -0
- package/dist/src/dxfViewer/core/indexeddb/DxfDataTable.d.ts +22 -0
- package/dist/src/dxfViewer/core/indexeddb/FontDataTable.d.ts +32 -0
- package/dist/src/dxfViewer/core/indexeddb/IndexedDbManager.d.ts +50 -0
- package/dist/src/dxfViewer/core/indexeddb/index.d.ts +4 -0
- package/dist/src/dxfViewer/core/input-manager/InputManager.d.ts +146 -0
- package/dist/src/dxfViewer/core/input-manager/index.d.ts +2 -0
- package/dist/src/dxfViewer/core/materials/BimTilesHighlightMaterial.d.ts +21 -0
- package/dist/src/dxfViewer/core/materials/BimTilesMaterial.d.ts +32 -0
- package/dist/src/dxfViewer/core/materials/BimTilesPickMaterial.d.ts +14 -0
- package/dist/src/dxfViewer/core/materials/BimTilesTransparentMaterial.d.ts +20 -0
- package/dist/src/dxfViewer/core/materials/StandardMaterialEx.d.ts +29 -0
- package/dist/src/dxfViewer/core/materials/constants.d.ts +4 -0
- package/dist/src/dxfViewer/core/materials/index.d.ts +5 -0
- package/dist/src/dxfViewer/core/model/Constants.d.ts +58 -0
- package/dist/src/dxfViewer/core/model/Model.d.ts +18 -0
- package/dist/src/dxfViewer/core/model/Model2d.d.ts +144 -0
- package/dist/src/dxfViewer/core/model/Model3d.d.ts +111 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BatchedMeshesParser.d.ts +26 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BimTilesConfigParser.d.ts +43 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BimTilesData.d.ts +280 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BimTilesMaterialManager.d.ts +139 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BimTilesModel.d.ts +70 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BimTilesPropertyParser.d.ts +45 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BimTilesRenderer.d.ts +59 -0
- package/dist/src/dxfViewer/core/model/bimtiles/InstancedMeshesParser.d.ts +41 -0
- package/dist/src/dxfViewer/core/model/bimtiles/TileParser.d.ts +14 -0
- package/dist/src/dxfViewer/core/model/bimtiles/Utils.d.ts +29 -0
- package/dist/src/dxfViewer/core/model/index.d.ts +6 -0
- package/dist/src/dxfViewer/core/patches/Constants.d.ts +6 -0
- package/dist/src/dxfViewer/core/patches/Line.d.ts +3 -0
- package/dist/src/dxfViewer/core/patches/Mesh.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/Points.d.ts +3 -0
- package/dist/src/dxfViewer/core/patches/index.d.ts +4 -0
- package/dist/src/dxfViewer/core/patches/shaders/ShaderChunk.d.ts +143 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/common_ex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/id_pars_vertex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/id_vertex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/outine_bc_vertex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/outline_bc_fragment.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/outline_bc_pars_fragment.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/outline_bc_pars_vertex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/state_fragment.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/state_highlight_fragment.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/state_pars_fragment.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/state_transparent_fragment.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderLib/pick_ex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderLib/standard_ex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/pick/PickManager.d.ts +54 -0
- package/dist/src/dxfViewer/core/pick/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/scene/SceneManager.d.ts +43 -0
- package/dist/src/dxfViewer/core/scene/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/shp-js/BitView.d.ts +12 -0
- package/dist/src/dxfViewer/core/shp-js/SHPLoader.d.ts +12 -0
- package/dist/src/dxfViewer/core/shp-js/Shp.d.ts +10 -0
- package/dist/src/dxfViewer/core/shp-js/ShpThree.d.ts +24 -0
- package/dist/src/dxfViewer/core/shp-js/index.d.ts +4 -0
- package/dist/src/dxfViewer/core/text-texture/TextTexture.d.ts +45 -0
- package/dist/src/dxfViewer/core/undo/Command.d.ts +6 -0
- package/dist/src/dxfViewer/core/undo/UndoManager.d.ts +24 -0
- package/dist/src/dxfViewer/core/undo/index.d.ts +2 -0
- package/dist/src/dxfViewer/core/utils/CSS2DObjectUtils.d.ts +14 -0
- package/dist/src/dxfViewer/core/utils/CancelablePromise.d.ts +6 -0
- package/dist/src/dxfViewer/core/utils/ColorUtils.d.ts +21 -0
- package/dist/src/dxfViewer/core/utils/CommonUtils.d.ts +129 -0
- package/dist/src/dxfViewer/core/utils/CoordinateUtils.d.ts +81 -0
- package/dist/src/dxfViewer/core/utils/DecimalPrecisionUtils.d.ts +10 -0
- package/dist/src/dxfViewer/core/utils/DeviceUtils.d.ts +15 -0
- package/dist/src/dxfViewer/core/utils/EdgeUtils.d.ts +14 -0
- package/dist/src/dxfViewer/core/utils/Event.d.ts +34 -0
- package/dist/src/dxfViewer/core/utils/ExportUtils.d.ts +61 -0
- package/dist/src/dxfViewer/core/utils/FpsUtils.d.ts +13 -0
- package/dist/src/dxfViewer/core/utils/GeometryUtils.d.ts +78 -0
- package/dist/src/dxfViewer/core/utils/Locale.d.ts +22 -0
- package/dist/src/dxfViewer/core/utils/LogUtils.d.ts +7 -0
- package/dist/src/dxfViewer/core/utils/MaterialUtils.d.ts +40 -0
- package/dist/src/dxfViewer/core/utils/MathUtils.d.ts +41 -0
- package/dist/src/dxfViewer/core/utils/MergeUtils.d.ts +120 -0
- package/dist/src/dxfViewer/core/utils/ObjectUtils.d.ts +215 -0
- package/dist/src/dxfViewer/core/utils/PolygonUtils.d.ts +9 -0
- package/dist/src/dxfViewer/core/utils/SVGObjectUtils.d.ts +22 -0
- package/dist/src/dxfViewer/core/utils/SceneUtils.d.ts +26 -0
- package/dist/src/dxfViewer/core/utils/SectionUtils.d.ts +11 -0
- package/dist/src/dxfViewer/core/utils/SimplifyUtils.d.ts +15 -0
- package/dist/src/dxfViewer/core/utils/TextUtils.d.ts +37 -0
- package/dist/src/dxfViewer/core/utils/TextureUtils.d.ts +16 -0
- package/dist/src/dxfViewer/core/utils/UnitConversionUtils.d.ts +31 -0
- package/dist/src/dxfViewer/core/utils/Viewer3dUtils.d.ts +25 -0
- package/dist/src/dxfViewer/core/utils/index.d.ts +26 -0
- package/dist/src/dxfViewer/core/viewers/BaseViewer.d.ts +248 -0
- package/dist/src/dxfViewer/core/viewers/BimTilesViewer.d.ts +126 -0
- package/dist/src/dxfViewer/core/viewers/Constants.d.ts +9 -0
- package/dist/src/dxfViewer/core/viewers/Plugin.d.ts +29 -0
- package/dist/src/dxfViewer/core/viewers/Viewer2d.d.ts +405 -0
- package/dist/src/dxfViewer/core/viewers/Viewer3d.d.ts +130 -0
- package/dist/src/dxfViewer/core/viewers/Viewer3dLite.d.ts +143 -0
- package/dist/src/dxfViewer/core/viewers/ViewerEvent.d.ts +96 -0
- package/dist/src/dxfViewer/core/viewers/index.d.ts +8 -0
- package/dist/src/dxfViewer/core/webcam/WebCam.d.ts +27 -0
- package/dist/src/dxfViewer/core/webcam/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/workers/CreateMeshBvh.worker.d.ts +1 -0
- package/dist/src/dxfViewer/core/workers/GenerateMeshBvhWorker.d.ts +17 -0
- package/dist/src/dxfViewer/core/workers/index.d.ts +1 -0
- package/dist/src/dxfViewer/lib.d.ts +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type Listener = (event?: DispatcherEvent) => void;
|
|
2
|
+
export interface DispatcherEvent {
|
|
3
|
+
type: string;
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export declare class EventDispatcher {
|
|
7
|
+
private _listeners;
|
|
8
|
+
constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Adds the specified event listener.
|
|
11
|
+
* @param type event name
|
|
12
|
+
* @param listener handler function
|
|
13
|
+
* @category Methods
|
|
14
|
+
*/
|
|
15
|
+
addEventListener(type: string, listener: Listener): void;
|
|
16
|
+
/**
|
|
17
|
+
* Presence of the specified event listener.
|
|
18
|
+
* @param type event name
|
|
19
|
+
* @param listener handler function
|
|
20
|
+
* @category Methods
|
|
21
|
+
*/
|
|
22
|
+
hasEventListener(type: string, listener: Listener): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Removes the specified event listener
|
|
25
|
+
* @param type event name
|
|
26
|
+
* @param listener handler function
|
|
27
|
+
* @category Methods
|
|
28
|
+
*/
|
|
29
|
+
removeEventListener(type: string, listener: Listener): void;
|
|
30
|
+
/**
|
|
31
|
+
* Removes all event listeners
|
|
32
|
+
* @param type event name
|
|
33
|
+
* @category Methods
|
|
34
|
+
*/
|
|
35
|
+
removeAllEventListeners(type?: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Fire an event type.
|
|
38
|
+
* @param event DispatcherEvent
|
|
39
|
+
* @category Methods
|
|
40
|
+
*/
|
|
41
|
+
dispatchEvent(event: DispatcherEvent): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type * as _THREE from "three";
|
|
2
|
+
export interface THREESubset {
|
|
3
|
+
Vector2: typeof _THREE.Vector2;
|
|
4
|
+
Vector3: typeof _THREE.Vector3;
|
|
5
|
+
Vector4: typeof _THREE.Vector4;
|
|
6
|
+
Quaternion: typeof _THREE.Quaternion;
|
|
7
|
+
Matrix4: typeof _THREE.Matrix4;
|
|
8
|
+
Spherical: typeof _THREE.Spherical;
|
|
9
|
+
Box3: typeof _THREE.Box3;
|
|
10
|
+
Sphere: typeof _THREE.Sphere;
|
|
11
|
+
Raycaster: typeof _THREE.Raycaster;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
export type Ref = {
|
|
15
|
+
value: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const MOUSE_BUTTON: {
|
|
18
|
+
LEFT: number;
|
|
19
|
+
RIGHT: number;
|
|
20
|
+
MIDDLE: number;
|
|
21
|
+
};
|
|
22
|
+
export type MOUSE_BUTTON = typeof MOUSE_BUTTON[keyof typeof MOUSE_BUTTON];
|
|
23
|
+
export declare const ACTION: Readonly<{
|
|
24
|
+
NONE: 0;
|
|
25
|
+
ROTATE: 1;
|
|
26
|
+
TRUCK: 2;
|
|
27
|
+
OFFSET: 4;
|
|
28
|
+
DOLLY: 8;
|
|
29
|
+
ZOOM: 16;
|
|
30
|
+
TOUCH_ROTATE: 32;
|
|
31
|
+
TOUCH_TRUCK: 64;
|
|
32
|
+
TOUCH_OFFSET: 128;
|
|
33
|
+
TOUCH_DOLLY: 256;
|
|
34
|
+
TOUCH_ZOOM: 512;
|
|
35
|
+
TOUCH_DOLLY_TRUCK: 1024;
|
|
36
|
+
TOUCH_DOLLY_OFFSET: 2048;
|
|
37
|
+
TOUCH_DOLLY_ROTATE: 4096;
|
|
38
|
+
TOUCH_ZOOM_TRUCK: 8192;
|
|
39
|
+
TOUCH_ZOOM_OFFSET: 16384;
|
|
40
|
+
TOUCH_ZOOM_ROTATE: 32768;
|
|
41
|
+
}>;
|
|
42
|
+
export type ACTION = number;
|
|
43
|
+
export interface PointerInput {
|
|
44
|
+
pointerId: number;
|
|
45
|
+
clientX: number;
|
|
46
|
+
clientY: number;
|
|
47
|
+
deltaX: number;
|
|
48
|
+
deltaY: number;
|
|
49
|
+
mouseButton: MOUSE_BUTTON | null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export type mouseButtonAction = typeof ACTION.ROTATE | typeof ACTION.TRUCK | typeof ACTION.OFFSET | typeof ACTION.DOLLY | typeof ACTION.ZOOM | typeof ACTION.NONE;
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
export type mouseWheelAction = typeof ACTION.ROTATE | typeof ACTION.TRUCK | typeof ACTION.OFFSET | typeof ACTION.DOLLY | typeof ACTION.ZOOM | typeof ACTION.NONE;
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export type singleTouchAction = typeof ACTION.TOUCH_ROTATE | typeof ACTION.TOUCH_TRUCK | typeof ACTION.TOUCH_OFFSET | typeof ACTION.DOLLY | typeof ACTION.ZOOM | typeof ACTION.NONE;
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export type multiTouchAction = typeof ACTION.TOUCH_DOLLY_ROTATE | typeof ACTION.TOUCH_DOLLY_TRUCK | typeof ACTION.TOUCH_DOLLY_OFFSET | typeof ACTION.TOUCH_ZOOM_ROTATE | typeof ACTION.TOUCH_ZOOM_TRUCK | typeof ACTION.TOUCH_ZOOM_OFFSET | typeof ACTION.TOUCH_DOLLY | typeof ACTION.TOUCH_ZOOM | typeof ACTION.TOUCH_ROTATE | typeof ACTION.TOUCH_TRUCK | typeof ACTION.TOUCH_OFFSET | typeof ACTION.NONE;
|
|
67
|
+
export interface MouseButtons {
|
|
68
|
+
left: mouseButtonAction;
|
|
69
|
+
middle: mouseButtonAction;
|
|
70
|
+
right: mouseButtonAction;
|
|
71
|
+
wheel: mouseWheelAction;
|
|
72
|
+
}
|
|
73
|
+
export interface Touches {
|
|
74
|
+
one: singleTouchAction;
|
|
75
|
+
two: multiTouchAction;
|
|
76
|
+
three: multiTouchAction;
|
|
77
|
+
}
|
|
78
|
+
export interface FitToOptions {
|
|
79
|
+
cover: boolean;
|
|
80
|
+
paddingLeft: number;
|
|
81
|
+
paddingRight: number;
|
|
82
|
+
paddingBottom: number;
|
|
83
|
+
paddingTop: number;
|
|
84
|
+
}
|
|
85
|
+
export interface CameraControlsEventMap {
|
|
86
|
+
update: {
|
|
87
|
+
type: "update";
|
|
88
|
+
};
|
|
89
|
+
wake: {
|
|
90
|
+
type: "wake";
|
|
91
|
+
};
|
|
92
|
+
rest: {
|
|
93
|
+
type: "rest";
|
|
94
|
+
};
|
|
95
|
+
sleep: {
|
|
96
|
+
type: "sleep";
|
|
97
|
+
};
|
|
98
|
+
transitionstart: {
|
|
99
|
+
type: "transitionstart";
|
|
100
|
+
};
|
|
101
|
+
controlstart: {
|
|
102
|
+
type: "controlstart";
|
|
103
|
+
};
|
|
104
|
+
control: {
|
|
105
|
+
type: "control";
|
|
106
|
+
};
|
|
107
|
+
controlend: {
|
|
108
|
+
type: "controlend";
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export declare function isPerspectiveCamera(camera: _THREE.Camera): camera is _THREE.PerspectiveCamera;
|
|
112
|
+
export declare function isOrthographicCamera(camera: _THREE.Camera): camera is _THREE.OrthographicCamera;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PointerInput } from '../types';
|
|
2
|
+
import type * as _THREE from 'three';
|
|
3
|
+
/**
|
|
4
|
+
* Extract the average client coordinate from the given pointers into `out`.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function extractClientCoordFromEvent(pointers: PointerInput[], out: _THREE.Vector2): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Ref } from '../types';
|
|
2
|
+
import type * as _THREE from 'three';
|
|
3
|
+
/**
|
|
4
|
+
* Degree to radius
|
|
5
|
+
*/
|
|
6
|
+
export declare const Deg2Rad: number;
|
|
7
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
8
|
+
export declare function approxZero(number: number, error?: number): boolean;
|
|
9
|
+
export declare function approxEquals(a: number, b: number, error?: number): boolean;
|
|
10
|
+
export declare function roundToStep(value: number, step: number): number;
|
|
11
|
+
export declare function infinityToMaxNumber(value: number): number;
|
|
12
|
+
export declare function maxNumberToInfinity(value: number): number;
|
|
13
|
+
export declare function smoothDamp(current: number, target: number, currentVelocityRef: Ref, smoothTime: number, maxSpeed: number | undefined, deltaTime: number): number;
|
|
14
|
+
export declare function smoothDampVec3(current: _THREE.Vector3, target: _THREE.Vector3, currentVelocityRef: _THREE.Vector3, smoothTime: number, maxSpeed: number | undefined, deltaTime: number, out: _THREE.Vector3): _THREE.Vector3;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DrawableData } from './Constants';
|
|
2
|
+
import { Drawable } from './Drawable';
|
|
3
|
+
import { DrawableList } from './DrawableList';
|
|
4
|
+
import { Event } from '../utils';
|
|
5
|
+
import { BaseViewer } from '../viewers';
|
|
6
|
+
import * as THREE from "three";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export type constructorReturnType<T> = new (...arg: any) => T;
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare class CanvasRender extends Event {
|
|
15
|
+
private viewer;
|
|
16
|
+
private drawableLists;
|
|
17
|
+
private canvas?;
|
|
18
|
+
context?: CanvasRenderingContext2D;
|
|
19
|
+
private frustum;
|
|
20
|
+
private projScreenMatrix;
|
|
21
|
+
static _registerDrawableClass(drawable: constructorReturnType<Drawable>): void;
|
|
22
|
+
static createDrawable(data: DrawableData): Drawable<Record<string, unknown>>;
|
|
23
|
+
constructor(viewer: BaseViewer);
|
|
24
|
+
get is3d(): boolean;
|
|
25
|
+
get container(): HTMLElement;
|
|
26
|
+
get camera(): THREE.Camera;
|
|
27
|
+
get raycaster(): THREE.Raycaster;
|
|
28
|
+
private init;
|
|
29
|
+
private initCanvas;
|
|
30
|
+
private toHighDpr;
|
|
31
|
+
clearCanvas(): void;
|
|
32
|
+
addDrawableList(drawableList: DrawableList): void;
|
|
33
|
+
render(): void;
|
|
34
|
+
setSize(width: number, height: number): void;
|
|
35
|
+
getSortedDrawables(onlyVisible?: boolean): Drawable<Record<string, unknown>>[];
|
|
36
|
+
getDrawablesByDrawableListAndPosition(drawList: DrawableList, p: THREE.Vector3): Drawable<Record<string, unknown>> | undefined;
|
|
37
|
+
getDrawablesByPosition(p: THREE.Vector3): Drawable[];
|
|
38
|
+
getDrawableById(id: string): Drawable<Record<string, unknown>> | undefined;
|
|
39
|
+
measureTextLength(text: string, font: string): number;
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @param option
|
|
43
|
+
* @returns
|
|
44
|
+
* @deprecated
|
|
45
|
+
*/
|
|
46
|
+
getImage(filter: (drawable: Drawable) => boolean): Promise<HTMLImageElement>;
|
|
47
|
+
getCanvas(): HTMLCanvasElement | undefined;
|
|
48
|
+
destroy(): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drawable data, including measurement data, markup data, etc.
|
|
3
|
+
*/
|
|
4
|
+
export interface DrawableData {
|
|
5
|
+
/**
|
|
6
|
+
* id is used by business logic to manage(find, update, delete, etc.) drawables
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* Two dimension float array stores 2d or 3d points.
|
|
11
|
+
* e.g., You can use "[[1, 1], [2.5, 3]]" to represent a distance measurement result,
|
|
12
|
+
* "[1, 1]" is the first point, and "[2.5, 3]" is the second point.
|
|
13
|
+
*/
|
|
14
|
+
points: number[][];
|
|
15
|
+
lineWidth?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Line color is number array. e.g: [r, g, b, a]
|
|
18
|
+
*/
|
|
19
|
+
lineColor?: number[];
|
|
20
|
+
/**
|
|
21
|
+
* Fill color is number array. e.g: [r, g, b, a]
|
|
22
|
+
*/
|
|
23
|
+
fillColor?: number[];
|
|
24
|
+
/**
|
|
25
|
+
* Drawable dta type
|
|
26
|
+
*/
|
|
27
|
+
type: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { DrawableData } from './Constants';
|
|
2
|
+
import { Event } from '../utils';
|
|
3
|
+
import * as THREE from "three";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class Drawable<DrawableEvents extends Record<string, unknown> = Record<string, unknown>> extends Event<DrawableEvents> {
|
|
8
|
+
protected readonly DEFAULT_LINE_WIDTH = 1;
|
|
9
|
+
protected readonly DEFAULT_STROKE_STYLE: number[];
|
|
10
|
+
protected readonly DEFAULT_FILL_STYLE: number[];
|
|
11
|
+
id: string;
|
|
12
|
+
protected lineWidth: number;
|
|
13
|
+
protected lineColor: number[];
|
|
14
|
+
protected fillColor: number[];
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
protected points: THREE.Vector3[];
|
|
20
|
+
userData: Record<any, any>;
|
|
21
|
+
protected tolerance: number;
|
|
22
|
+
visible: boolean;
|
|
23
|
+
selected: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* render order, the bigger number is on the top
|
|
26
|
+
*/
|
|
27
|
+
renderOrder: number;
|
|
28
|
+
needsFrustumCulled: boolean;
|
|
29
|
+
protected editPointSize: number;
|
|
30
|
+
protected editPointFillColor: string;
|
|
31
|
+
protected editPointStrokeColor: string;
|
|
32
|
+
protected matrix: THREE.Matrix4;
|
|
33
|
+
protected ctx?: CanvasRenderingContext2D;
|
|
34
|
+
constructor(id?: string);
|
|
35
|
+
setTolerance(t: number): void;
|
|
36
|
+
render(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
37
|
+
getData(): DrawableData;
|
|
38
|
+
setData(data: DrawableData): void;
|
|
39
|
+
getVertexes(): THREE.Vector3[];
|
|
40
|
+
setLineWidth(lineWidth?: number): void;
|
|
41
|
+
setLineColor(color?: number[]): void;
|
|
42
|
+
setFillColor(color?: number[]): void;
|
|
43
|
+
isSelected(): boolean;
|
|
44
|
+
getCenter(): THREE.Vector3;
|
|
45
|
+
transToScreenCoord(vector: THREE.Vector3, camera: THREE.Camera): THREE.Vector2;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param ctx
|
|
49
|
+
* @param camera
|
|
50
|
+
* @describe just for debug bounds
|
|
51
|
+
*/
|
|
52
|
+
private drawBounds;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param ctx
|
|
56
|
+
* @param camera
|
|
57
|
+
* @describe just for debug
|
|
58
|
+
*/
|
|
59
|
+
private drawCenter;
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param p is world position
|
|
63
|
+
* @param raycaster just for 3d intersect
|
|
64
|
+
* @returns boolean
|
|
65
|
+
* @describe is point interact drawable, use to select drawable, the same as threejs object raycast
|
|
66
|
+
*/
|
|
67
|
+
abstract isPointInPath(p: THREE.Vector3, raycaster?: THREE.Raycaster): boolean;
|
|
68
|
+
getBounds(): THREE.Box3;
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @param ctx
|
|
72
|
+
* @param camera
|
|
73
|
+
* @describe abstract draw method
|
|
74
|
+
*/
|
|
75
|
+
abstract draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
76
|
+
/**
|
|
77
|
+
*
|
|
78
|
+
* @param ctx
|
|
79
|
+
* @param camera
|
|
80
|
+
* @describe abstract drawSelect method
|
|
81
|
+
*/
|
|
82
|
+
abstract drawSelect(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
83
|
+
/**
|
|
84
|
+
* @describe class type for serialize
|
|
85
|
+
*/
|
|
86
|
+
abstract getClassType(): string;
|
|
87
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DrawableData } from './Constants';
|
|
2
|
+
import { Drawable } from './Drawable';
|
|
3
|
+
import { Event } from '../utils';
|
|
4
|
+
import * as THREE from "three";
|
|
5
|
+
/**
|
|
6
|
+
* Drawable list events.
|
|
7
|
+
*/
|
|
8
|
+
type DrawableListEvents = {
|
|
9
|
+
/**
|
|
10
|
+
* Triggerd when a drawable is added.
|
|
11
|
+
*/
|
|
12
|
+
add: DrawableData;
|
|
13
|
+
/**
|
|
14
|
+
* Triggerd when a drawable is updated.
|
|
15
|
+
*/
|
|
16
|
+
update: DrawableData;
|
|
17
|
+
/**
|
|
18
|
+
* Triggerd when a drawable is removed.
|
|
19
|
+
*/
|
|
20
|
+
remove: DrawableData;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A group of Drawlables for a certain category
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare class DrawableList extends Event<DrawableListEvents> {
|
|
27
|
+
private category;
|
|
28
|
+
private drawableMap;
|
|
29
|
+
constructor(category: string);
|
|
30
|
+
addDrawable(drawable: Drawable): void;
|
|
31
|
+
updateDrawable(drawable: Drawable, newData: DrawableData): void;
|
|
32
|
+
removeDrawable(drawable: Drawable): void;
|
|
33
|
+
getDrawableById(id: string): Drawable | undefined;
|
|
34
|
+
clear(): void;
|
|
35
|
+
getDrawables(): Map<string, Drawable>;
|
|
36
|
+
getDrawableDatas(): DrawableData[];
|
|
37
|
+
setDrawableDatas(drawableDatas: DrawableData[]): void;
|
|
38
|
+
getDrawableByPosition(p: THREE.Vector3, raycaster?: THREE.Raycaster): Drawable | undefined;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ProgressBar } from '../components';
|
|
2
|
+
import { DxfCompareConfig, Model2dConfig, Viewer2dConfig } from '../Configs';
|
|
3
|
+
import { DxfChange, DxfLoader } from '../dxf';
|
|
4
|
+
import { FontManager } from '../font';
|
|
5
|
+
import { Viewer2d } from '../viewers/Viewer2d';
|
|
6
|
+
import * as THREE from "three";
|
|
7
|
+
/**
|
|
8
|
+
* Dxf compare helper with one viewport.
|
|
9
|
+
* @example
|
|
10
|
+
* ``` html
|
|
11
|
+
* <div id="app">
|
|
12
|
+
* <div id="myCanvas" style="width: 100%; height: 100%; display: inline-block;"></div>
|
|
13
|
+
* </div>
|
|
14
|
+
* ```
|
|
15
|
+
* ``` typescript
|
|
16
|
+
* const viewerCfg = { containerId: "myCanvas" };
|
|
17
|
+
* const modelCfg1 = { modelId: "id_1", src: "http://www.abc.com/sample1.dxf" };
|
|
18
|
+
* const modelCfg2 = { modelId: "id_2", src: "http://www.abc.com/sample2.dxf" };
|
|
19
|
+
* const fontFiles = ["http://www.abc.com/hztxt.shx", "http://www.abc.com/simplex.shx"];
|
|
20
|
+
*
|
|
21
|
+
* const compareHelper = new BaseDxfCompareHelper(viewerCfg);
|
|
22
|
+
* await compareHelper.setFont(fontFiles);
|
|
23
|
+
* await compareHelper.compare(modelCfg1, modelCfg2);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare class BaseDxfCompareHelper {
|
|
27
|
+
/**
|
|
28
|
+
* Viewer2d of DxfCompareHelper.
|
|
29
|
+
*/
|
|
30
|
+
viewer: Viewer2d;
|
|
31
|
+
protected fontManager?: FontManager;
|
|
32
|
+
protected loader: DxfLoader;
|
|
33
|
+
protected loadingManager?: THREE.LoadingManager;
|
|
34
|
+
protected changes?: Record<string, DxfChange>;
|
|
35
|
+
protected container: HTMLElement;
|
|
36
|
+
protected spinner?: HTMLDivElement;
|
|
37
|
+
protected jobCount: number;
|
|
38
|
+
protected loadingProgressBar?: ProgressBar;
|
|
39
|
+
constructor(viewerCfg: Viewer2dConfig);
|
|
40
|
+
protected initSpinner(): void;
|
|
41
|
+
/**
|
|
42
|
+
* @description {en} Sets font.
|
|
43
|
+
* This needs to be called before loading a dxf, it won't affect any loaded text.
|
|
44
|
+
* It accepts shx or typeface formats. For typeface, it only support passing in 1 font file in the array for now.
|
|
45
|
+
* @description {zh} 设置字体。
|
|
46
|
+
* 需要在加载dxf之前调用,不会影响已加载的文字。
|
|
47
|
+
* 支持shx或typeface格式。对于typeface,目前只支持传入1个字体文件。
|
|
48
|
+
* @param urls
|
|
49
|
+
* - {en} font file urls.
|
|
50
|
+
* - {zh} 字体文件链接。
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* compareHelper.setFont(["https://example.com/xxx.shx"]);
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
setFont(urls: string[]): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Compares two dxf files. Note that:
|
|
59
|
+
* - It only compares model spaces.
|
|
60
|
+
* - It shouldn't load anything else before and after compare.
|
|
61
|
+
* @param modelCfg1 The first dxf to be compared
|
|
62
|
+
* @param modelCfg2 The second dxf to be compared
|
|
63
|
+
* @param onProgress loading progress
|
|
64
|
+
*/
|
|
65
|
+
compare(modelCfg1: Model2dConfig, modelCfg2: Model2dConfig, compareCfg?: DxfCompareConfig, onProgress?: (event: ProgressEvent) => void): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* @description {en} Gets compare changes.
|
|
68
|
+
* @description {zh} 获取对比变动.
|
|
69
|
+
* @returns
|
|
70
|
+
* - {en} Compare changes.
|
|
71
|
+
* - {zh} 对比变动列表。
|
|
72
|
+
* @example
|
|
73
|
+
* ``` typescript
|
|
74
|
+
* const changes = compareHelper.getChanges();
|
|
75
|
+
* console.log(changes);
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
getChanges(): Record<number, DxfChange> | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* @description {en} Zooms to a compare change.
|
|
81
|
+
* @description {zh} 聚焦到图纸的一处变动。
|
|
82
|
+
* @param changeId
|
|
83
|
+
* - {en} Change id, which is an incremental integer starts from 1.
|
|
84
|
+
* - {zh} 变动id,该id是从数字1开始自增的整数。
|
|
85
|
+
* @example
|
|
86
|
+
* ``` typescript
|
|
87
|
+
* const changeId = 1;
|
|
88
|
+
* compareHelper.zoomToChange(changeId);
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
zoomToChange(changeId: number): void;
|
|
92
|
+
/**
|
|
93
|
+
* Sets spinner visibility
|
|
94
|
+
*/
|
|
95
|
+
protected setSpinnerVisibility(visible: boolean): void;
|
|
96
|
+
/**
|
|
97
|
+
* Increases job count, and show spinner accordingly
|
|
98
|
+
*/
|
|
99
|
+
protected increaseJobCount(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Decreases job count, and hide spinner accordingly
|
|
102
|
+
*/
|
|
103
|
+
protected decreaseJobCount(): void;
|
|
104
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Drawable } from '../canvas';
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare class CompareDrawable extends Drawable {
|
|
7
|
+
boxes: THREE.Box3[];
|
|
8
|
+
lineSegments: THREE.Vector3[][];
|
|
9
|
+
/**
|
|
10
|
+
* @param id
|
|
11
|
+
* @param boxes 需要绘制云线框的包围盒集合
|
|
12
|
+
* @param lineColor 边框颜色 rgba 数组(0~1),默认红色
|
|
13
|
+
* @param fillColor 区域半透明填充色 rgba 数组(0~1),默认与边框同色、低透明度
|
|
14
|
+
*/
|
|
15
|
+
constructor(id: string, boxes: THREE.Box3[], lineColor?: number[], fillColor?: number[]);
|
|
16
|
+
/**
|
|
17
|
+
* 按包围盒尺寸比例向外扩张,使云线框与变动内容之间留出间隙,避免框线压住文字/图形。
|
|
18
|
+
* 间隙取盒最长边的 12%(退化盒给最小值兜底)。
|
|
19
|
+
*/
|
|
20
|
+
private static expandBoxesWithGap;
|
|
21
|
+
private calculateCloudLineSegments;
|
|
22
|
+
draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
23
|
+
private fillRect;
|
|
24
|
+
private drawBox;
|
|
25
|
+
static getControlPointByTwoPoints(p1: THREE.Vector2, p2: THREE.Vector2): THREE.Vector2;
|
|
26
|
+
drawSelect(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
27
|
+
isPointInPath(p: THREE.Vector3): boolean;
|
|
28
|
+
getBounds(): THREE.Box3;
|
|
29
|
+
getClassType(): string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { DxfCompareConfig, Model2dConfig, Viewer2dConfig } from '../Configs';
|
|
2
|
+
import { Viewer2d } from '../viewers/Viewer2d';
|
|
3
|
+
import { BaseDxfCompareHelper } from './BaseDxfCompareHelper';
|
|
4
|
+
/**
|
|
5
|
+
* Dxf compare helper with two viewports.
|
|
6
|
+
* @example
|
|
7
|
+
* ``` html
|
|
8
|
+
* <div id="app">
|
|
9
|
+
* <div id="myCanvas1" style="width: 50%; height: 100%; display: inline-block;"></div>
|
|
10
|
+
* <div id="myCanvas2" style="width: 50%; height: 100%; display: inline-block; padding-left: 1px;"></div>
|
|
11
|
+
* </div>
|
|
12
|
+
* ```
|
|
13
|
+
* ``` typescript
|
|
14
|
+
* const viewerCfg1 = { containerId: "myCanvas1" };
|
|
15
|
+
* const viewerCfg2 = { containerId: "myCanvas2" };
|
|
16
|
+
* const modelCfg1 = { modelId: "id_1", src: "http://www.abc.com/sample1.dxf" };
|
|
17
|
+
* const modelCfg2 = { modelId: "id_2", src: "http://www.abc.com/sample2.dxf" };
|
|
18
|
+
* const fontFiles = ["http://www.abc.com/hztxt.shx", "http://www.abc.com/simplex.shx"];
|
|
19
|
+
*
|
|
20
|
+
* const compareHelper = new DxfCompareHelper(viewerCfg1, viewerCfg2);
|
|
21
|
+
* await compareHelper.setFont(fontFiles);
|
|
22
|
+
* await compareHelper.compare(modelCfg1, modelCfg2);
|
|
23
|
+
* compareHelper.enableSyncCamera(true);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare class DxfCompareHelper extends BaseDxfCompareHelper {
|
|
27
|
+
/**
|
|
28
|
+
* The second Viewer2d of DxfCompareHelper.
|
|
29
|
+
*/
|
|
30
|
+
viewer2: Viewer2d;
|
|
31
|
+
/**
|
|
32
|
+
* Enables to synchronize camera position when another camera is moved.
|
|
33
|
+
*/
|
|
34
|
+
protected syncCamera: boolean;
|
|
35
|
+
private markupManager1?;
|
|
36
|
+
private markupManager2?;
|
|
37
|
+
constructor(viewerCfg1: Viewer2dConfig, viewerCfg2: Viewer2dConfig);
|
|
38
|
+
protected initSyncCameraEvent(): void;
|
|
39
|
+
/**
|
|
40
|
+
* @description {en} Enables to synchronize camera position when another camera is moved.
|
|
41
|
+
* @description {zh} 设置开启或关闭同步相机视角。
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* compareHelper.enableSyncCamera(true);
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
enableSyncCamera(enable: boolean): void;
|
|
48
|
+
private syncCameraControls;
|
|
49
|
+
/**
|
|
50
|
+
* Compares two dxf files. Note that:
|
|
51
|
+
* - It only compares model spaces.
|
|
52
|
+
* - It shouldn't load anything else before and after compare.
|
|
53
|
+
* @param modelCfg1 The first dxf to be compared
|
|
54
|
+
* @param modelCfg2 The second dxf to be compared
|
|
55
|
+
* @param onProgress loading progress
|
|
56
|
+
*/
|
|
57
|
+
compare(modelCfg1: Model2dConfig, modelCfg2: Model2dConfig, compareCfg?: DxfCompareConfig, onProgress?: (event: ProgressEvent) => void): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* 在左右两个视口上绘制变动区域的云线框(按新增/删除/修改着色)。
|
|
60
|
+
* 延迟到下一帧执行,确保模型已加入场景、overlay 尺寸已就绪。
|
|
61
|
+
*/
|
|
62
|
+
private drawCompareBoxes;
|
|
63
|
+
/**
|
|
64
|
+
* @description {en} Zooms to a compare change.
|
|
65
|
+
* @description {zh} 聚焦到图纸的一处变动。
|
|
66
|
+
* @param changeId
|
|
67
|
+
* - {en} Change id, which is an incremental integer starts from 1.
|
|
68
|
+
* - {zh} 变动id,该id是从数字1开始自增的整数。
|
|
69
|
+
* @example
|
|
70
|
+
* ``` typescript
|
|
71
|
+
* const changeId = 1;
|
|
72
|
+
* compareHelper.zoomToChange(changeId);
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
zoomToChange(changeId: number): void;
|
|
76
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Viewer2d } from '../viewers';
|
|
2
|
+
import { DxfChange } from '../dxf';
|
|
3
|
+
import { Event } from '../utils';
|
|
4
|
+
export declare class DxfCompareMarkupManager extends Event {
|
|
5
|
+
private viewer;
|
|
6
|
+
private overlayRender?;
|
|
7
|
+
private drawableList;
|
|
8
|
+
constructor(viewer: Viewer2d);
|
|
9
|
+
drawCompareDrawable(changes: Record<string, DxfChange>): void;
|
|
10
|
+
setCompareDrawableVisible(visilbe: boolean): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare class Container {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
/**
|
|
5
|
+
* The root container which will be created to under the container user passed in,
|
|
6
|
+
* it typically contains a viewer container and a widget container.
|
|
7
|
+
*/
|
|
8
|
+
container: HTMLDivElement;
|
|
9
|
+
/**
|
|
10
|
+
* The viewer container, which contains
|
|
11
|
+
* - canvas of three.js
|
|
12
|
+
* - canvas for overlay renderer
|
|
13
|
+
* - css2d object renderer
|
|
14
|
+
*/
|
|
15
|
+
viewerContainer?: HTMLDivElement;
|
|
16
|
+
/**
|
|
17
|
+
* The vidget container, may contain:
|
|
18
|
+
* - Axis gizmo
|
|
19
|
+
* - Progress bar
|
|
20
|
+
* - Toolbar ui
|
|
21
|
+
* - Context menu
|
|
22
|
+
*/
|
|
23
|
+
widgetContainer?: HTMLDivElement;
|
|
24
|
+
constructor(containerId: string);
|
|
25
|
+
/**
|
|
26
|
+
* Creates a viewerContainer under the container that user passed in.
|
|
27
|
+
* There are some benefits to create a new one. e.g., its style won't affect
|
|
28
|
+
* the container div user passed in.
|
|
29
|
+
*/
|
|
30
|
+
private initViewerContainer;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @description Create a div for ui widget, if widget need position, just relative container, maybe remove later.
|
|
34
|
+
*/
|
|
35
|
+
private initWidgetContainer;
|
|
36
|
+
get needResize(): boolean;
|
|
37
|
+
destroy(): void;
|
|
38
|
+
}
|