bimatter-viewer-react 1.0.1 → 1.0.3

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.
@@ -1,11 +1,13 @@
1
1
  import { Object3D, Plane } from "three";
2
2
  import type { BmtModelData } from "../Loaders/BmtLoader";
3
3
  import type { ViewerCameraRef, ViewerControlsRef, ViewerLightRef, ViewerMaterialMode, ViewerModelRef } from "../types";
4
+ import { type CreatedBmtElement } from "../utils/GeometryUtils/createElements";
4
5
  import { type ViewerNotesApi } from "../utils/NotesUtils";
5
6
  import { type ViewerApi, type ViewerSceneApi } from "../api/ViewerApi";
6
7
  export type ModelsData = Record<number, BmtModelData>;
7
8
  export type CameraDprMode = "wake" | "move" | "sleep";
8
- export declare const ViewerScene: import("react").MemoExoticComponent<({ autoFitCamera, cameraRef, controlRef, fitToView, loadGeneration, lightRef, materialMode, modelRef, modelsData, modelsLoading, initialPlanPlane, createPlanComment, createPlanMarkupCloud, deleteAllPlanNotes, onReady, onModelsReady, onCameraDprModeChange, publicApi, invalidatePlanViews, setPlanPreselectionHandler, setPlanVisualObjectsGetter, setSceneApi, setPlanNotesModeActive, usePerformanceMoving, useWebGPU, }: {
9
+ type ElementCreatedHandler = (modelID: number, elementID: number, element: CreatedBmtElement) => void;
10
+ export declare const ViewerScene: import("react").MemoExoticComponent<({ autoFitCamera, cameraRef, controlRef, fitToView, loadGeneration, lightRef, materialMode, modelRef, modelsData, modelsLoading, initialPlanPlane, createPlanComment, createPlanMarkupCloud, deleteAllPlanNotes, onElementCreated, onReady, onModelsReady, onCameraDprModeChange, publicApi, invalidatePlanViews, setPlanPreselectionHandler, setPlanVisualObjectsGetter, setSceneApi, setPlanNotesModeActive, usePerformanceMoving, useWebGPU, }: {
9
11
  autoFitCamera: boolean;
10
12
  cameraRef: ViewerCameraRef;
11
13
  controlRef: ViewerControlsRef;
@@ -18,6 +20,7 @@ export declare const ViewerScene: import("react").MemoExoticComponent<({ autoFit
18
20
  modelsLoading: boolean;
19
21
  initialPlanPlane?: Plane | null;
20
22
  deleteAllPlanNotes: () => void;
23
+ onElementCreated: ElementCreatedHandler;
21
24
  onReady?: (api: ViewerApi) => void;
22
25
  onModelsReady: (loadGeneration: number) => void;
23
26
  onCameraDprModeChange: (mode: CameraDprMode) => void;
@@ -35,3 +38,4 @@ export declare const ViewerScene: import("react").MemoExoticComponent<({ autoFit
35
38
  usePerformanceMoving: boolean;
36
39
  useWebGPU: boolean;
37
40
  }) => import("react/jsx-runtime").JSX.Element>;
41
+ export {};
@@ -1,4 +1,4 @@
1
- import type { ColorRepresentation, Group } from "three";
1
+ import type { BufferGeometry, ColorRepresentation, Group } from "three";
2
2
  import type { SelectedStore, UserDevice, ViewerGridAxesVisibility, ViewerGridAxisSide, ViewerLightingSettings, ViewerLightingSettingsUpdate, ViewerPostproductionActivePassFilter, ViewerStoreApi } from "../store/ViewerStore";
3
3
  import type { ViewerCameraProjection, ViewerFirstPersonControlSettings, ViewerPostproductionPassType } from "../types";
4
4
  import { type ViewerPropertiesApi } from "./ViewerPropertiesApi";
@@ -11,6 +11,7 @@ import type { BmtConversionResult, BmtConverterOptions, BmtConverterSource } fro
11
11
  import { FilteredElementsCollector } from "../Selector/FilteredElementsCollector";
12
12
  import type { ViewerLoadedModels, ViewerLoadModelOptions, ViewerModelSource } from "./loader";
13
13
  import type { GeometryIndex } from "../utils/GeometryUtils/useGeometryIndex";
14
+ import type { IfcElementCreationProps, IfcElementType } from "../utils/GeometryUtils/createElements";
14
15
  import type { WorkerProgressEvent } from "../workers";
15
16
  import { type ViewerPlansApi, type ViewerPlansContainerFactory, type ViewerPlansSceneApi } from "./ViewerPlansApi";
16
17
  export type { ViewerClippingApi, ViewerClippingVector3Input, } from "../utils/ClippingUtils";
@@ -23,6 +24,11 @@ export type { ViewerPlanHandle, ViewerPlansApi, ViewerPlanVector3Input, } from "
23
24
  export type ViewerSelection = Record<number, number[]>;
24
25
  export type ViewerGeometryUtilsApi = {
25
26
  readonly indexesState: GeometryIndex | null;
27
+ cancelElementCreation: () => void;
28
+ createElement: (geometry: BufferGeometry, type: IfcElementType) => number;
29
+ createElementByGeometry(geometry: BufferGeometry, props?: IfcElementCreationProps, type?: IfcElementType): number;
30
+ createSlab: (thicknessMm?: number) => Promise<number>;
31
+ createWall: (heightMm?: number, widthMm?: number) => Promise<number>;
26
32
  getAllIds: () => number[];
27
33
  getIfcSpacesVisibility: () => boolean;
28
34
  getModelGeometry: (modelID: number) => Group | null;
@@ -133,6 +139,7 @@ export type ViewerLoadModelsOptions = ViewerLoadModelOptions & {
133
139
  onModelsDataChange?: (modelsData: ViewerLoadedModels | undefined) => void;
134
140
  };
135
141
  export type ViewerModelsApi = {
142
+ createEmptyModel: (name?: string) => number;
136
143
  getData: () => ViewerLoadedModels | undefined;
137
144
  getLoading: () => boolean;
138
145
  getProgress: () => WorkerProgressEvent | null;
@@ -41,6 +41,7 @@ declare class ViewerLoaderApi {
41
41
  private resetCoordinationMatrixState;
42
42
  private applyRenderSettings;
43
43
  resetCoordinationMatrix(): void;
44
+ allocateModelID(usedModelIDs?: number[]): number;
44
45
  loadModel(sources: ViewerModelSource | ViewerModelSource[], options?: ViewerLoadModelOptions): Promise<ViewerLoadedModels>;
45
46
  }
46
47
  export declare const loader: ViewerLoaderApi;
package/lib/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { default as Viewer } from "./Viewer";
2
2
  export type { ViewerModelsData, ViewerProps } from "./Viewer";
3
3
  export type { ViewerCameraProjection, ViewerMaterialMode, ViewerPostproductionPassType, ViewerUploadMode, } from "./types";
4
4
  export type { ViewerApi, ViewerCameraApi, ViewerCameraGetIntersection, ViewerClippingApi, ViewerClippingVector3Input, ViewerColorsApi, ViewerBmtConverterOptions, ViewerConverterApi, ViewerDimensionsApi, ViewerGeometryUtilsApi, ViewerDetectedGpuInfo, ViewerGpuInfo, ViewerHardwareInfo, ViewerLoadModelsOptions, ViewerModelsApi, ViewerPlanHandle, ViewerPlansApi, ViewerPlanVector3Input, ViewerPostproductionApi, ViewerSelection, ViewerSelectorApi, ViewerUtilsApi, } from "./api/ViewerApi";
5
+ export type { BmtElementType, IfcElementCreationProps, IfcElementCreationType, IfcElementType, } from "./utils/GeometryUtils/createElements";
5
6
  export type { ViewerModelLevel, ViewerModelLevelsByModel, ViewerPropertiesApi, ViewerPropertiesExcelOptions, } from "./api/ViewerPropertiesApi";
6
7
  export { BMTLoader } from "./Loaders/BmtLoader";
7
8
  export type { BmtGeometryChunkData, BmtParseCallbacks, BmtParseProgressData, BmtModelGeometryData, BmtGeomData, BmtIndexArray, BmtMaterialData, BmtElementProps, BmtModelData, BmtModelProps, BmtModelStructure, BmtModelStructureNode, BmtPropertyRecord, BmtPropertySet, BmtPropertyValue, } from "./Loaders/BmtLoader";