bimatter-viewer-react 0.3.0 → 0.4.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 +127 -0
- package/lib/Loaders/BmtConverter.d.ts +95 -0
- package/lib/Loaders/BmtLoader.d.ts +2 -0
- package/lib/Loaders/IFCLoader/IFCLoader.d.ts +4 -1
- package/lib/SelectableMesh.d.ts +2 -1
- package/lib/api/ViewerApi.d.ts +15 -0
- package/lib/api/loader.d.ts +7 -1
- package/lib/index.d.ts +5 -2
- package/lib/index.js +12720 -11728
- package/lib/utils/DimentionsUtils/DimentionLine.d.ts +59 -0
- package/lib/utils/DimentionsUtils/DimentionsUtils.d.ts +97 -0
- package/lib/utils/DimentionsUtils/index.d.ts +2 -0
- package/lib/utils/GeometryUtils/useGeometryIndex.d.ts +2 -0
- package/lib/utils/GeometryUtils/useGeometryUtils.d.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { BufferGeometry, Color, ConeGeometry, Group, Line, LineDashedMaterial, Mesh, MeshBasicMaterial, Sprite, Vector3, type Camera } from "three";
|
|
2
|
+
export type DimensionUnit = "m" | "mm";
|
|
3
|
+
export type DimensionLineOptions = {
|
|
4
|
+
boundingMaterial: MeshBasicMaterial;
|
|
5
|
+
endpointGeometry: ConeGeometry;
|
|
6
|
+
endpointMaterial: MeshBasicMaterial;
|
|
7
|
+
endpointScale: Vector3;
|
|
8
|
+
lineMaterial: LineDashedMaterial;
|
|
9
|
+
root: Group;
|
|
10
|
+
start: Vector3;
|
|
11
|
+
end: Vector3;
|
|
12
|
+
};
|
|
13
|
+
export declare class DimensionLine {
|
|
14
|
+
static scale: number;
|
|
15
|
+
static scaleFactor: number;
|
|
16
|
+
static units: DimensionUnit;
|
|
17
|
+
readonly root: Group<import("three").Object3DEventMap>;
|
|
18
|
+
readonly start: Vector3;
|
|
19
|
+
readonly endpointMeshes: Mesh[];
|
|
20
|
+
boundingMesh: Mesh | null;
|
|
21
|
+
end: Vector3;
|
|
22
|
+
line: Line;
|
|
23
|
+
private readonly boundingMaterial;
|
|
24
|
+
private readonly endpointGeometry;
|
|
25
|
+
private readonly endpointMaterial;
|
|
26
|
+
private readonly lineGeometry;
|
|
27
|
+
private readonly lineMaterial;
|
|
28
|
+
private readonly ownerRoot;
|
|
29
|
+
private endpointBaseScale;
|
|
30
|
+
private labelHeight;
|
|
31
|
+
private labelSprite;
|
|
32
|
+
private labelText;
|
|
33
|
+
private labelTexture;
|
|
34
|
+
private labelWidth;
|
|
35
|
+
constructor({ boundingMaterial, endpointGeometry, endpointMaterial, endpointScale, lineMaterial, root, start, end, }: DimensionLineOptions);
|
|
36
|
+
get length(): number;
|
|
37
|
+
get center(): Vector3;
|
|
38
|
+
get text(): Sprite<import("three").Object3DEventMap>;
|
|
39
|
+
get boundingBox(): Mesh<BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>, import("three").Material<import("three").MaterialEventMap> | import("three").Material<import("three").MaterialEventMap>[], import("three").Object3DEventMap> | null;
|
|
40
|
+
set dimensionColor(dimensionColor: Color);
|
|
41
|
+
set visibility(visible: boolean);
|
|
42
|
+
set endpointScale(scale: Vector3);
|
|
43
|
+
set endPoint(point: Vector3);
|
|
44
|
+
createBoundingBox(): void;
|
|
45
|
+
removeFromScene(): void;
|
|
46
|
+
dispose(): void;
|
|
47
|
+
updateForCamera(camera: Camera, viewportHeight: number): void;
|
|
48
|
+
private addEndpointMeshes;
|
|
49
|
+
private addEndpointMesh;
|
|
50
|
+
private createLabelSprite;
|
|
51
|
+
private createBoundingBoxMesh;
|
|
52
|
+
private getTextContent;
|
|
53
|
+
private updateLabel;
|
|
54
|
+
private updatePositions;
|
|
55
|
+
private updateBoundingBox;
|
|
56
|
+
private rescaleMesh;
|
|
57
|
+
private rescaleBoundingMesh;
|
|
58
|
+
private rescaleLabel;
|
|
59
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Color, ConeGeometry, SphereGeometry, type Camera, type Scene } from "three";
|
|
2
|
+
import type { CameraUtilsApi } from "../../Camera/useCameraUtils";
|
|
3
|
+
import type { ViewerStoreApi } from "../../store/ViewerStore";
|
|
4
|
+
import type { ViewerControlsRef, ViewerModelRef } from "../../types";
|
|
5
|
+
import { DimensionLine, type DimensionUnit } from "./DimentionLine";
|
|
6
|
+
type DimensionsContext = {
|
|
7
|
+
camera: Camera;
|
|
8
|
+
cameraUtils: CameraUtilsApi;
|
|
9
|
+
controlRef: ViewerControlsRef;
|
|
10
|
+
domElement: HTMLCanvasElement;
|
|
11
|
+
modelRef: ViewerModelRef;
|
|
12
|
+
scene: Scene;
|
|
13
|
+
viewerStore: ViewerStoreApi;
|
|
14
|
+
viewportHeight: number;
|
|
15
|
+
};
|
|
16
|
+
export type ViewerDimensionsApi = {
|
|
17
|
+
cancelDrawing: () => void;
|
|
18
|
+
changeAxes: () => void;
|
|
19
|
+
delete: () => void;
|
|
20
|
+
deleteAll: () => void;
|
|
21
|
+
getActive: () => boolean;
|
|
22
|
+
getDimensions: () => DimensionLine[];
|
|
23
|
+
getSnapDistance: () => number;
|
|
24
|
+
getUnit: () => DimensionUnit;
|
|
25
|
+
setActive: (active: boolean) => void;
|
|
26
|
+
setColor: (color: string | Color) => void;
|
|
27
|
+
setEndpointScaleFactor: (factor: number) => void;
|
|
28
|
+
setSnapDistance: (distance: number) => void;
|
|
29
|
+
setUnit: (unit: DimensionUnit) => void;
|
|
30
|
+
setWidth: (width: number) => void;
|
|
31
|
+
toggle: () => void;
|
|
32
|
+
};
|
|
33
|
+
export declare class DimensionsUtils {
|
|
34
|
+
private active;
|
|
35
|
+
private axis;
|
|
36
|
+
private readonly boundingMaterial;
|
|
37
|
+
private context;
|
|
38
|
+
private currentDimension;
|
|
39
|
+
private dimensions;
|
|
40
|
+
private readonly endpointGeometry;
|
|
41
|
+
private readonly endpointMaterial;
|
|
42
|
+
private endpointScale;
|
|
43
|
+
private readonly lineMaterial;
|
|
44
|
+
private measureInProcess;
|
|
45
|
+
private moveState;
|
|
46
|
+
private readonly previewMarker;
|
|
47
|
+
private readonly root;
|
|
48
|
+
private snapDistance;
|
|
49
|
+
private startPoint;
|
|
50
|
+
private unit;
|
|
51
|
+
constructor(context: DimensionsContext);
|
|
52
|
+
setContext(context: DimensionsContext): void;
|
|
53
|
+
getActive(): boolean;
|
|
54
|
+
getDimensions(): DimensionLine[];
|
|
55
|
+
getSnapDistance(): number;
|
|
56
|
+
getUnit(): DimensionUnit;
|
|
57
|
+
setActive(active: boolean): void;
|
|
58
|
+
toggle(): void;
|
|
59
|
+
setColor(color: string | Color): void;
|
|
60
|
+
setEndpointScaleFactor(factor: number): void;
|
|
61
|
+
setSnapDistance(distance: number): void;
|
|
62
|
+
setUnit(unit: DimensionUnit): void;
|
|
63
|
+
setWidth(width: number): void;
|
|
64
|
+
cancelDrawing(): void;
|
|
65
|
+
delete(): void;
|
|
66
|
+
deleteAll(): void;
|
|
67
|
+
changeAxes(): void;
|
|
68
|
+
updateFrame(): void;
|
|
69
|
+
syncWithModel(): void;
|
|
70
|
+
dispose(): void;
|
|
71
|
+
private addEventListeners;
|
|
72
|
+
private removeEventListeners;
|
|
73
|
+
private drawStart;
|
|
74
|
+
private drawPreview;
|
|
75
|
+
private drawEnd;
|
|
76
|
+
private createDimension;
|
|
77
|
+
private getModelHit;
|
|
78
|
+
private getBoundingBoxes;
|
|
79
|
+
private getClosestVertex;
|
|
80
|
+
private getPreviewEndPoint;
|
|
81
|
+
private getNextAxis;
|
|
82
|
+
private getIsMoving;
|
|
83
|
+
private rescalePreviewMarker;
|
|
84
|
+
private setSelectionInteractionDisabled;
|
|
85
|
+
private onClick;
|
|
86
|
+
private onPointerMove;
|
|
87
|
+
private onPointerDown;
|
|
88
|
+
private onPointerUp;
|
|
89
|
+
private onControlsChange;
|
|
90
|
+
private onKeyDown;
|
|
91
|
+
static createEndpointGeometry(height?: number, radius?: number): ConeGeometry;
|
|
92
|
+
static createPreviewGeometry(): SphereGeometry;
|
|
93
|
+
}
|
|
94
|
+
export declare function useDimensionsUtils(modelRef: ViewerModelRef, controlRef: ViewerControlsRef, cameraUtils: CameraUtilsApi): ViewerDimensionsApi & {
|
|
95
|
+
syncWithModel: () => void;
|
|
96
|
+
};
|
|
97
|
+
export {};
|
|
@@ -9,6 +9,7 @@ export type IndexRange = {
|
|
|
9
9
|
export type MeshGeometryRecord = {
|
|
10
10
|
hiddenIds: Set<number>;
|
|
11
11
|
initialVisible: boolean;
|
|
12
|
+
isIfcSpace: boolean;
|
|
12
13
|
mesh: Mesh;
|
|
13
14
|
modelID: number;
|
|
14
15
|
originalBoundsTree: MeshBVH | null;
|
|
@@ -24,6 +25,7 @@ export type ElementIndexEntry = {
|
|
|
24
25
|
};
|
|
25
26
|
export type GeometryIndex = {
|
|
26
27
|
elementIndex: Map<number, ElementIndexEntry[]>;
|
|
28
|
+
ifcSpacesVisible: boolean;
|
|
27
29
|
indexedModel: Object3D | null;
|
|
28
30
|
isolatedIdsByModel: Map<number, Set<number>> | null;
|
|
29
31
|
isolatedIds: Set<number> | null;
|
|
@@ -2,12 +2,15 @@ import type { GeometryIndexApi } from "./useGeometryIndex";
|
|
|
2
2
|
export type GeometryUtilsApi = {
|
|
3
3
|
buildIndex: GeometryIndexApi["buildIndex"];
|
|
4
4
|
getAllIds: () => number[];
|
|
5
|
+
getIfcSpacesVisibility: () => boolean;
|
|
5
6
|
hideByIds: (ids: number[]) => void;
|
|
6
7
|
hideSelected: () => void;
|
|
7
8
|
isolateByIds: (ids: number[]) => void;
|
|
8
9
|
isolateSelected: () => void;
|
|
9
10
|
resetIsolation: () => void;
|
|
11
|
+
setIfcSpacesVisibility: (visible: boolean) => void;
|
|
10
12
|
showAll: () => void;
|
|
11
13
|
showByIds: (ids: number[]) => void;
|
|
14
|
+
toggleIIfcSpacesVisibility: () => void;
|
|
12
15
|
};
|
|
13
16
|
export default function useGeometryUtils(geometryIndex: GeometryIndexApi): GeometryUtilsApi;
|