declare namespace Bimsync { namespace ViewerUI { type JoystickPosition = 'bottom-left' | 'bottom-center' | 'bottom-right' | 'middle-left' | 'middle-right'; interface PluginOptions { enableKeyboard?: boolean; enableJoystick?: boolean; joystickBorderOffset?: string; joystickColor?: string; joystickHidden?: boolean; joystickPosition?: JoystickPosition; joystickRotationClamp?: number; joystickSize?: number; spacesVisible?: boolean; viewer2dId?: string; enableViewer2dIntegration?: boolean; showViewer2dStoreySelect?: boolean; showViewer2dLockedNavigationToggle?: boolean; lockStoreyMode?: boolean; enableContextMenu?: boolean; translations?: Record; } interface BuildingStorey { id: string; name: string; elevation: number; } interface Building { id: string; name: string; buildingStoreys: BuildingStorey[]; } interface Site { id: string; name: string; buildings: Building[]; } interface Project { id: string; name: string; sites: Site[]; } interface SpatialStructure { projects: Project[]; } } interface AntiAliasingSettings { samples: number; maxSamples: number; isSupported: boolean; } interface Box2 { min: Vector2; max: Vector2; } interface Box3 { min: Vector3; max: Vector3; } interface Matrix3 { elements: number[]; } interface Building { id: string; guid?: string; name?: string; modelId: string; modelName?: string; } type Color = { r: number; g: number; b: number; }; type ColorSetting = { color: Color; opacity: number; style: string; }; export interface Icon { url: string; size: Size; anchor: Vector2; } interface Image { url?: string; size: Size; transform?: TransformParams; } interface ShapeStyleParams { strokeWidth?: number; strokeUnit?: 'pixels' | 'meter'; color?: string; } type ShapeParams2D = LineShapeParams; interface LineShapeParams { id?: string; type: 'line'; style?: ShapeStyleParams; start: Vector2; end: Vector2; } interface PolygonShapeParams { id?: string; type: 'polygon'; style?: ShapeStyleParams; points: Vector2[]; } type ImageClippingShapeParams = PolygonShapeParams; interface ImageClippingParams { shape: ImageClippingShapeParams; opacity?: number; } interface ImageParams { id?: string; url: string; x: number; y: number; width: number; height: number; zIndex?: number; rotate?: boolean; matrix?: Matrix3; clipping?: ImageClippingParams[]; onLoad?: () => void; onError?: () => void; } type KeyboardState = { [key: string]: number | null }; interface LookAtOptions { expand?: number | Vector2; retainStoreys?: boolean; } interface Marker { id: string; x: number; y: number; color: string; text?: string; data?: unknown; } // Support existing hover event interface MarkerHover { id: string; fillColor: string; position: Vector2; element?: SVGElement; icon: MarkerIcon; text?: string; data?: unknown; clickable: boolean; draggable: boolean; } type MarkerIcon = { url: string; size: Size; anchor: Vector2; }; export interface MarkerParams { id?: string; x: number; y: number; color?: string; text?: string; data?: unknown; icon?: Icon; clickable?: boolean; draggable?: boolean; } type MeasureMode = 'dimension' | 'laser' | 'point'; interface MeasureEnableParameters { mode?: MeasureMode; } /** * Laser measure parameters */ interface LaserMeasureParameters { /** Measure mode */ mode: 'laser'; /** Optional id for the added measure */ uuid?: string; /** The point to measure */ point: Bimsync.Vector3; /** The normal vector */ normal: Bimsync.Vector3; } /** * Measure label mode */ type MeasureLabelMode = 'pointDistance' | 'segmentLength' | 'segmentIndex'; /** * Measure parameters */ type MeasureParameters = LaserMeasureParameters; /** * Measure options */ interface MeasureSettings { /** Replace any existing measures when using `addMeasure` method */ appendMeasures?: boolean; /** Conversion factor applied to measure values */ conversionFactor?: number; /** Number of decimals to display for measure values */ decimals?: number; /** Display mode for measure values */ labelMode?: MeasureLabelMode; markMeasuredDrawables?: boolean; /** Custom number formatter function for measure values */ numberFormatter?: NumberFormatter; opacity?: number; } interface ModelInfo { id: string; boundingBox: Box3; originalBoundingBox: Box3; } type ModelType = 'bim' | 'grid' | 'point-cloud' | '3d-tiles' | 'mesh'; type ModelFormat = 'gltf'; type ModuleName = 'viewer2d' | 'viewer3d' | 'viewer-ui'; type NamedDirection = 'front' | 'back' | 'left' | 'right' | 'top' | 'bottom' | 'home'; type NamedViewpoint = NamedDirection; /** * Named navigation modes */ type NamedNavigationMode = 'orbit' | 'pan' | 'pivot'; type NamedPlane = 'top' | 'bottom' | 'left' | 'right' | 'front' | 'back'; type NavigationAction = 'click' | 'doubleClick' | 'select' | 'contextMenu' | 'fitToView' | 'zoom' | 'zoomMove' | 'rotateZ' | 'rotateX' | 'moveLeft' | 'moveUp' | 'moveForward' | 'orbit' | 'pivot' | 'pan'; type NavigationDevice = 'mouse' | 'touch' | 'keyboard'; type NavigationMouseEvent = 'click' | 'doubleClick' | 'wheel' | 'drag'; type NavigationTouchEvent = 'tap' | 'doubleTap' | 'longPress' | 'pinch' | 'pan'; type NavigationKeyboardEvent = 'rotateLeft' | 'rotateRight' | 'rotateUp' | 'rotateDown' | 'moveForward' | 'moveBackward' | 'moveUp' | 'moveDown' | 'moveLeft' | 'moveRight'; type NavigationEvent = NavigationMouseEvent | NavigationTouchEvent | NavigationKeyboardEvent; /** * Navigation event action */ interface NavigationEventAction { /** The action to perform */ action: NavigationAction; /** The event to listen for */ event: NavigationEvent; /** Filter the event */ filter?: NavigationFilter; /** Scale the action */ scale?: number; } type NavigationFilter = Partial>; type NavigationFilterProperty = 'button' | 'pointers' | 'longPress'; type NavigationInput = { [key in NavigationKey]?: number; }; type NavigationKey = 'moveForward' | 'moveBackward' | 'moveLeft' | 'moveRight' | 'moveUp' | 'moveDown' | 'rotateUp' | 'rotateDown' | 'rotateLeft' | 'rotateRight'; type NavigationMode = Partial>; interface NavigationSettings { elevationSpeed: number; rotationSpeed: number; walkSpeed: number; } type NamedViewport = 'fit'; interface ViewportOptions { expandInPercentage?: number; marginInPercentage?: number; // legacy } interface StringAttribute { type: 'string'; ifcType: string; value: string; } type Attribute = StringAttribute; /** * Number formatter */ type NumberFormatter = (_: number) => string; interface ObjectState { selected: string[]; visible: string[]; hidden: string[]; translucent: string[]; } /** * Point cloud settings */ interface PointCloudSettings { /** The active attribute for the point cloud */ activeAttribute: string; /** The available attributes for the point cloud */ availableAttributes: string[]; /** The opacity of the point cloud */ opacity: number; /** The size of the points in the point cloud */ pointSize: number; /** The type of point size used */ pointSizeType: string; } /** * Point cloud settings params */ interface PointCloudSettingsParams { /** The active attribute for the point cloud */ activeAttribute?: string; /** The opacity of the point cloud */ opacity?: number; /** The size of the points in the point cloud */ pointSize?: number; /** The type of point size used */ pointSizeType?: string; } interface Product { modelId: string; objectId: string; ifcType: string; attributes: Record; } export type ObjectMetadataAttribute = { type: 'NUMBER' | 'BOOLEAN' | 'STRING' | 'DATETIME' | 'URI'; value: number | boolean | string; }; export type ObjectMetadata = { parentId?: string; objectType?: string; attributes: Record; }; interface ObjectInfo { id: string; modelId: string; triangleCount: number; metadata?: ObjectMetadata; } interface ObjectIntersection { objectId: string; point: Vector3; normal: Vector3; } type AxisClippingPlane = Plane & { axis: string; axisDistance: number; clipSide: 'back' | 'front'; }; type ClippingPlane = (Plane | AxisClippingPlane) & { active: boolean; measure: boolean; }; type AxisClippingPlaneParams = { axis: string; axisDistance?: number; clipSide?: 'back' | 'front'; }; type ClippingPlaneParams = (Plane | AxisClippingPlaneParams) & { active?: boolean; measure?: boolean; }; interface Plane { location: Vector3; direction: Vector3; } interface Point { location?: Vector3; direction?: Vector3; image?: Image; objects?: string[]; } type GridType = 'grid' | 'alignment'; interface Grid { id: string; globalId?: string; name?: string; type: GridType; modelId: string; axes: GridAxis[]; } interface GridAxis { id: string; name?: string; length: number; } interface CurvePoint { location: Vector3; direction: Vector3; } interface GridAxisState { visible: boolean; extrudeCurve: boolean; } interface AxisSegmentColor { start: number; end: number; color: string; } type QueryBody = { [field: string]: unknown | unknown[] }; type RenderMode = 'regular' | 'incremental'; interface RenderSettings { depthBuffer: 'logarithmic' | 'standard'; pixelRatio: number; renderMode: RenderMode; shading: NamedShading; } interface AppearanceSettings { defaultColor: string | number; translucentOpacity: number; selectedColor: string | number; measureOpacity: number; } interface CameraSettings { fov: number; near: number; far: number; } interface Rotation { centerOfRotation: Vector3; angle: number; x: number; y: number; z: number; } interface RotationParams { centerOfRotation?: Vector3; angle?: number; x: number; y: number; z: number; } interface ScreenshotOptions { width: number; height: number; } interface Size { width: number; height: number; } interface Space { id?: string; guid?: string; name?: string; modelId: string; modelName?: string; } type SpaceNameFormat = 'regular' | 'long'; type SpaceNames = { [name: string]: { name?: string; longName?: string } }; interface SpaceOptions { all?: boolean; buildingId?: string; storeyId?: string; visible?: boolean; } interface Storey { id: string; guid?: string; name?: string; elevation: number; modelId: string; modelName?: string; buildingId?: string; } interface StoreyOptions { all?: boolean; buildingId?: string; visible?: boolean; } type Style = string | number; interface ToolTarget { point: Vector3; } type Tool = 'select' | 'create-plane' | 'laser-measure' | 'point-measure' | 'dimension-measure'; interface CreatePlaneToolParams { tool: 'create-plane'; onCreatePlane?: () => void; onTargetChange?: (target: ToolTarget | null) => void; } interface DimensionMeasureToolParams { tool: 'dimension-measure'; onTargetChange?: (target: ToolTarget | null) => void; } interface LaserMeasureToolParams { tool: 'laser-measure'; onTargetChange?: (target: ToolTarget | null) => void; } interface PointMeasureToolParams { tool: 'point-measure'; onTargetChange?: (target: ToolTarget | null) => void; } interface SelectToolParams { tool: 'select'; } type NamedShading = 'regular' | 'sketch' | 'hidden-line' | 'ssao'; type ToolParams = SelectToolParams | CreatePlaneToolParams | DimensionMeasureToolParams | LaserMeasureToolParams | PointMeasureToolParams; interface TransformParams { position?: Vector3; rotation?: RotationParams; scale?: Vector3; } interface Transform { position: Vector3; rotation: Rotation; scale: Vector3; } interface TransitionSettings { duration?: number; easing?: string; } interface Viewer2DLoadParameters { append?: boolean; modelId: string; modelName?: string; } interface Viewer3DLoadParameters { modelId?: string; query?: QueryBody; color?: string | number; headers?: {[ key: string ]: string }; initialState?: 'visible' | 'hidden' | 'translucent'; mapObjectId?: (modelId: string, objectId: string) => string; } interface Viewer2DOptions { enableViewpoint?: boolean; showViewpoint?: boolean; selectColor?: string; hoverSpaces?: boolean; } interface Viewer3DSettings extends NavigationSettings { textRenderMode: 'dom' | 'canvas'; enableClippingPlaneWidget: boolean; activeClippingPlaneBorderColor: string | number; navigationMode: Bimsync.NamedNavigationMode; navigationOrbitSphereColor: string | number; boundingBoxLimits: string; enableTouch: boolean; logLevel: number; measureOpacity: number; selectedColor: string; } type Viewer3DOptions = Partial; interface ViewerEventListener { remove(): void; } interface Vector2 { x: number; y: number; } interface Vector3 { x: number; y: number; z: number; } interface Viewpoint2D { rotation: number; direction: Vector3; location: Vector2 | Vector3; } interface Viewpoint2DParams { direction: number | Vector2; location: Vector2; } interface OrthogonalViewpoint { type: 'orthogonal'; direction: Vector3; location: Vector3; up: Vector3; aspectRatio: number; viewToWorldScale: number; } interface PerspectiveViewpoint { type: 'perspective'; direction: Vector3; location: Vector3; up: Vector3; aspectRatio: number; fov: number; } type Viewpoint3D = OrthogonalViewpoint | PerspectiveViewpoint; interface OrthogonalViewpointParams { type: 'orthogonal'; direction?: Vector3; location: Vector3; up?: Vector3; aspectRatio?: number; viewToWorldScale?: number; } interface PerspectiveViewpointParams { type: 'perspective'; direction?: Vector3; location: Vector3; up?: Vector3; aspectRatio?: number; fov?: number; } type Viewpoint3DParams = OrthogonalViewpointParams | PerspectiveViewpointParams; export interface CircleShapeParams { id?: string; type: 'circle'; position: Vector3; radius: number; color?: string; onClick?: () => void; } export interface SphereShapeParams { id?: string; type: 'sphere'; position: Vector3; radius: number; color?: string; onClick?: () => void; } export interface BoxShapeParams { id?: string; type: 'box'; position: Vector3; extents: Vector3; color?: string; onClick?: () => void; } export type ShapeParams3D = CircleShapeParams | SphereShapeParams | BoxShapeParams; /** * Represents an area on the screen. */ interface Viewport { /** X coordinate of the viewport */ x: number; /** Y coordinate of the viewport */ y: number; /** Width of the viewport */ width: number; /** Height of the viewport */ height: number; } interface ZoomOptions { minWidth?: number; } interface Event { readonly timeStamp: number; preventDefault(): void; } interface MarkerEvent extends Event { readonly marker: Marker | MarkerHover; readonly srcEvent: MouseEvent | PointerEvent | KeyboardEvent; } interface ViewerInputEvent extends Event { readonly intersects?: ObjectIntersection; readonly srcEvent: MouseEvent | PointerEvent | KeyboardEvent; } interface ViewerSelectEvent extends Event { readonly selected: string[]; } type Viewer3DErrorType = 'no-webgl' | 'load-failed'; interface Viewer3DErrorEvent extends Event { readonly type: Viewer3DErrorType; } interface ViewerViewpointEvent extends Event { readonly viewpoint: T; } interface Viewer2DEventMap { 'viewer2d.contextmenu': ViewerInputEvent; 'viewer2d.click': ViewerInputEvent; 'viewer2d.dblclick': ViewerInputEvent; 'viewer2d.markerclick': MarkerEvent; 'viewer2d.markerdrag': MarkerEvent; 'viewer2d.markerdragend': MarkerEvent; 'viewer2d.markerhover': MarkerEvent; 'viewer2d.select': ViewerSelectEvent; 'viewer2d.viewpoint': ViewerViewpointEvent; } interface Viewer3DEventMap { 'viewer3d.contextmenu': ViewerInputEvent; 'viewer3d.click': ViewerInputEvent; 'viewer3d.dblclick': ViewerInputEvent; 'viewer3d.select': ViewerSelectEvent; 'viewer3d.viewpoint': ViewerViewpointEvent; } export class Viewer2D { constructor(element: HTMLElement, options?: Viewer2DOptions); get element(): HTMLElement; /** * Dispose the viewer. Clears memory allocated by the viewer. */ dispose(): void; addEventListener(type: K, listener: (event: Viewer2DEventMap[K]) => void): void; addMarker(marker: MarkerParams): string; addImage(image: ImageParams): string; addShape(shape: ShapeParams2D): string; clearColors(): void; clearImages(): void; clearMarkers(): void; deselect(id: string[]): void; deselectAll(): void; getBoundingBox(id: string[] | null): Box3; getBuildings(): Building[]; getLocation(point: Bimsync.Vector2): Bimsync.Vector2 | Bimsync.Vector3; getRotation(): number; getSelected(): string[]; getSpaces(options: SpaceOptions): Space[]; getStoreyByElevation(elevation: number): Storey | null; getStoreys(options?: StoreyOptions): Storey[]; getStoreysByElevation(elevation: number): Storey[]; getViewpoint(): Viewpoint2D; hideStorey(id: string): void; hideStoreys(): void; hideViewpoint(): void; loadUrl(url: string, parameters?: Viewer2DLoadParameters): Promise; lookAt(id: string[], options?: LookAtOptions): void; lookAtBoundingBox(boundingBox: Box2 | Box3, options?: LookAtOptions): void; moveTo(x: number, y: number): void; removeMarker(id: string): void; removeImage(id: string): void; removeShape(id: string): void; hideImage(id: string): void; showImage(id: string): void; captureScreenshot(options: ScreenshotOptions): Promise; select(id: string[]): void; setColor(id: string[], color: string): void; setRotation(rotation: number): void; setSpaceNameFormat(format: SpaceNameFormat): void; setSpaceNames(names: SpaceNames): void; setViewpoint(viewpoint: Viewpoint2DParams): void; setViewport(viewport: Bimsync.NamedViewport, options?: Bimsync.ViewportOptions): void; showStorey(id: string): void; showViewpoint(): void; transformModel(modelId: string, transform: Bimsync.TransformParams): void; unloadModel(modelId: string): void; } export class Viewer3D { /** * Create a new viewer inside the given element. * * @param element * @param options */ constructor(element: HTMLElement, options?: Viewer3DOptions); /** * The element containing the viewer. */ get element(): HTMLElement; /** * Dispose the viewer. * * Releases all resources allocated by the viewer. */ dispose(): void; /** * Resize the viewer to fit its container. */ resize(): void; /** * Show the given objects. * * @param id */ show(id: string[]): void; /** * Show all objects. */ showAll(): void; /** * Hide the given objects. * * @param id */ hide(id: string[]): void; /** * Hide all objects. */ hideAll(): void; /** * Make the given objects translucent. * * @param id */ makeTranslucent(id: string[]): void; /** * Make all objects translucent. */ makeAllTranslucent(): void; /** * Make the given objects opaque. * * @param id */ makeOpaque(id: string[]): void; /** * Make all objects opaque. */ makeAllOpaque(): void; /** * Select the given objects. * * @param id */ select(id: string[]): void; /** * Deselect the given objects. * * @param id */ deselect(id: string[]): void; /** * Deselect all currently selected objects. */ deselectAll(): void; /** * Show the given model. * * @param modelId */ showModel(modelId: string, type?: ModelType): void; /** * Hide the given model. * * @param modelId */ hideModel(modelId: string, type?: ModelType): void; /** * Load one or more models from a Viewer3D token. * * @param url * @param parameters */ loadModelsFromToken(url: string, parameters?: Viewer3DLoadParameters): Promise; /** * Load the model from url * * @param url * @param parameters */ loadModel(url: string, parameters?: Bimsync.Viewer3DLoadParameters & { modelType?: ModelType; format?: ModelFormat }): Promise; /** * Unload the given model. * * @param modelId */ unloadModel(modelId: string, type?: ModelType): void; /** * Move, scale and rotate the given model. * * @param modelId * @param transform */ setTransform(modelId: string, transform: Bimsync.TransformParams, type?: ModelType): void; /** * Get the transform for the given model. * * @param modelId */ getTransform(modelId: string, type?: ModelType): Bimsync.Transform | null; /** * Add a geometric shape * * @param shape */ addShape(shape: ShapeParams3D): string; /** * Remove the give shape * * @param id */ removeShape(id: string): void; /** * Clear all shapes */ clearShapes(): void; /** * Add a listener function to a given event type. * * @param type * @param listener */ addEventListener(type: K, listener: (event: Viewer3DEventMap[K]) => void): ViewerEventListener; /** * Returns the axis aligned bounding box fitting the given objects. * * @param id */ getBoundingBox(id?: string[]): Box3; /** * Set the color for the given objects. * * @param id * @param style */ setObjectColors(id: string[], style: Style): void; /** * Return the current clipping planes. */ getClippingPlanes(): ClippingPlane[]; /** * Set the current clipping planes. * * @param planes */ setClippingPlanes(planes: ClippingPlaneParams[]): void; /** * Return the current viewpoint. */ getViewpoint(): Viewpoint3D; /** * Set the current viewpoint. * * @param viewpoint */ setViewpoint(viewpoint: Viewpoint3DParams | NamedViewpoint): void; /** * Returns a promise resolving to a data URL in PNG format. */ captureScreenshot(): Promise; /** * Enable measure mode. * * @param parameters object defining the measure behaviour. If `parameters.mode` is omitted, the previously used measure mode will be activated. Default measure mode is **'laser'**. */ enableMeasure(parameters: MeasureEnableParameters): void; /** * Disable measure mode. * * @param parameters */ disableMeasure(): void; /** * Clear measures. */ clearMeasure(): void; /** * Move given objects into view. * * @param id * @param direction */ lookAt(id: string[], direction?: NamedDirection | Vector3): void; /** * Move the given bounding box into view. * * @param boundingBox * @param direction */ lookAtBoundingBox(boundingBox: Box3, direction?: NamedDirection | Vector3): void; getModels(id?: string[]): (ModelInfo | null)[]; getObjects(id?: string[]): (ObjectInfo | null)[]; getProducts(id?: string[]): (Product | null)[]; getGrids(): Grid[]; calculatePointOnAxis(id: string, distance: number): CurvePoint | null; setGridAxisState(id: string, state: Partial): void; getGridAxisState(id: string): GridAxisState | null; setAxisSegmentColors(id: string, colors: AxisSegmentColor[]): void; /** * Reset object colors back to the original colors. */ resetObjectColors(): void; /** * Get the colors for the given objects. * * @param id * @param style */ getObjectColors(id: string[]): Record; calculateSectionPlanes(id: string[], planes: NamedPlane[]): Plane[]; /** * Return the selected objects. */ getSelected(): string[]; getCameraSettings(): CameraSettings; setCameraSettings(settings: Partial): void; setPointBudget(pointBudget: number): void; setTransitionSettings(settings: TransitionSettings): void; setNavigationSettings(settings: Partial): void; getNavigationSettings(): NavigationSettings; /** * Get render settings. */ getRenderSettings(): RenderSettings; /** * Set render settings. */ setRenderSettings(settings: Partial): void; /** * Add a measure. * * @param measure Measure parameters */ addMeasure(measure: Bimsync.MeasureParameters): void; /** * Get the anti-aliasing settings. * * @returns Anti-aliasing settings */ getAntiAliasingSettings(): Bimsync.AntiAliasingSettings; /** * Get images in the scene. * * @returns List of images */ getImages(): Bimsync.Image[]; /** * Get the measure tool settings. * */ getMeasureSettings(): MeasureSettings; /** * Get point cloud settings for the specified model id. * * @param id Model id */ getPointCloudSettings(id: string): Bimsync.PointCloudSettings | null; /** * Get scene state. * * @param modelIds Model ids to limit the objects to */ getSceneState(modelIds?: string[]): Bimsync.ObjectState; /** * Set the measure tool settings. * * @param settings Measure settings */ setMeasureSettings(settings: Bimsync.MeasureSettings): void; /** * Query the objects in the scene. * * @param query Query object * @returns Array of object ids */ query(query: Bimsync.QueryBody): string[]; /** * Remove measure by id. * * @param id Measure id */ removeMeasure(id: string): void; /** * Reset the opacity of translucent objects to the default value. */ resetTranslucentOpacity(): void; /** * Set the anti-aliasing settings. * * @param settings Anti-aliasing settings */ setAntiAliasingSettings(settings: Partial): void; /** * Set images in the scene. * * @param images List of images */ setImages(images: Bimsync.Image[]): void; /** * Set the navigation mode. * * @param mode Navigation mode */ setNavigationMode(mode: NavigationMode | NamedNavigationMode): void; /** * Set the position and size of the clipping plane widget. * * @param viewport Position and size of the clipping plane widget */ setPlaneWidgetViewport(viewport: Bimsync.Viewport): void; /** * Set point cloud settings for the specified model id. * * @param id Model id * @param params Point cloud settings */ setPointCloudSettings(id: string, params: Bimsync.PointCloudSettingsParams): void; /** * Set the opacity of translucent objects. * * @param opacity Opacity value between 0 and 1 */ setTranslucentOpacity(opacity: number): void; /** * Stop navigating. */ stopNavigation(): void; /** * Start navigating. * * @param input Map of navigation movements to start with scale factor */ updateNavigation(input: Bimsync.NavigationInput): void; } export interface Base { viewer2d: { Viewer2D: { new(element: HTMLElement, options?: Viewer2DOptions): Viewer2D; }; }; viewer3d: { Viewer3D: { new(element: HTMLElement, options?: Viewer3DOptions): Viewer3D; }; }; viewerhost?: string; viewer2dhost?: string; vieweruihost?: string; load(modules?: ModuleName[]): void; setOnLoadCallback(callback: () => void): void; loadViewer2d(): void; setOnViewer2dLoadCallback(callback: () => void): void; } } interface ViewerPlugin { (options?: Bimsync.Viewer3DOptions): JQuery; /** * Dispose the viewer. * * Releases all resources allocated by the viewer. */ (method: 'dispose'): JQuery; /** * Show the given objects. * * @param id */ (method: 'show', id: string | string[]): JQuery; /** * Show all objects. */ (method: 'showAll'): JQuery; /** * Hide the given objects. * * @param id */ (method: 'hide', id: string | string[]): JQuery; /** * Hide all objects. */ (method: 'hideAll'): JQuery; /** * Make the given objects translucent. * * @param id */ (method: 'makeTranslucent', id: string | string[]): JQuery; /** * Make all objects translucent. */ (method: 'makeAllTranslucent'): JQuery; /** * Make the given objects opaque. * * @param id */ (method: 'makeOpaque', id: string | string[]): JQuery; /** * Make all objects opaque. */ (method: 'makeAllOpaque'): JQuery; /** * Select the given objects. * * @param id */ (method: 'select', id: string | string[]): JQuery; /** * Deselect the given objects. * * @param id */ (method: 'deselect', id: string | string[]): JQuery; /** * Deselect all currently selected objects. */ (method: 'deselectAll'): JQuery; /** * Show the given model. * * @param modelId */ (method: 'showModel', modelId: string, type?: Bimsync.ModelType): JQuery; /** * Hide the given model. * * @param modelId */ (method: 'hideModel', modelId: string, type?: Bimsync.ModelType): JQuery; /** * Load one or more models from a Viewer3D token. * * @param url * @param parameters */ (method: 'loadModelsFromToken', url: string, parameters: Bimsync.Viewer3DLoadParameters): Promise; /** * Load one or more models from a Viewer3D token. * * @param url */ (method: 'loadModelsFromToken', url: string): Promise; /** * Load one or more models from a Viewer3D token. * * @param url * @param parameters */ (method: 'loadModelsFromToken', url: string, parameters: Bimsync.Viewer3DLoadParameters, callback: (result: Bimsync.ModelInfo[]) => void): JQuery; /** * Load one or more models from a Viewer3D token. * * @param url */ (method: 'loadModelsFromToken', url: string, callback: (result: Bimsync.ModelInfo[]) => void): JQuery; (method: 'loadModel', url: string): Promise; (method: 'loadModel', url: string, callback: (result: Bimsync.ModelInfo[]) => void): JQuery; (method: 'loadModel', url: string, parameters: Bimsync.Viewer3DLoadParameters & { modelType?: Bimsync.ModelType; format?: Bimsync.ModelFormat }, callback: (result: Bimsync.ModelInfo[]) => void): JQuery; (method: 'loadModel', url: string, parameters: Bimsync.Viewer3DLoadParameters & { modelType?: Bimsync.ModelType; format?: Bimsync.ModelFormat }): Promise; /** * Unload the given model. * * @param modelId */ (method: 'unloadModel', modelId: string, type?: Bimsync.ModelType): JQuery; /** * Move, scale and rotate the given model. * * @param modelId * @param transform */ (method: 'setTransform', modelId: string, transform: Bimsync.TransformParams, type?: Bimsync.ModelType): JQuery; /** * Get the transform for the given model. * * @param modelId */ (method: 'getTransform', modelId: string): Bimsync.Transform | null; /** * Get the transform for the given model. * * @param modelId */ (method: 'getTransform', modelId: string, type: Bimsync.ModelType): Bimsync.Transform | null; /** * Get the transform for the given model. * * @param modelId */ (method: 'getTransform', modelId: string, callback: (result: Bimsync.Transform | null) => void): JQuery; /** * Get the transform for the given model. * * @param modelId */ (method: 'getTransform', modelId: string, type: Bimsync.ModelType, callback: (result: Bimsync.Transform | null) => void): JQuery; (method: 'resetObjectColors'): JQuery; (method: 'setObjectColors', id: string[], style: Bimsync.Style): JQuery; (method: 'getObjectColors', id: string[], callback: (result: Record) => void): JQuery; (method: 'getObjectColors', id: string[]): Record; (method: 'getObjects', id: string[], callback: (result: (Bimsync.ObjectInfo | null)[]) => void): JQuery; (method: 'getObjects', id: string[]): (Bimsync.ObjectInfo | null)[]; (method: 'getObjects', callback: (result: Bimsync.ObjectInfo[]) => void): JQuery; (method: 'getObjects'): Bimsync.ObjectInfo[]; (method: 'getProducts', id: string[], callback: (result: (Bimsync.Product | null)[]) => void): JQuery; (method: 'getProducts', id: string[]): (Bimsync.Product | null)[]; (method: 'getProducts', callback: (result: Bimsync.Product[]) => void): JQuery; (method: 'getProducts'): Bimsync.Product[]; (method: 'getModels', modelId: string[], callback: (result: Bimsync.ModelInfo[]) => void): JQuery; (method: 'getModels', callback: (result: Bimsync.ModelInfo[]) => void): JQuery; (method: 'getModels', modelId: string[]): Bimsync.ModelInfo[]; (method: 'getModels'): Bimsync.ModelInfo[]; (method: 'setViewpoint', viewpoint: Bimsync.Viewpoint3DParams | Bimsync.NamedViewpoint): JQuery; (method: 'getViewpoint', callback: (result: Bimsync.Viewpoint3D) => void): JQuery; (method: 'getViewpoint'): Bimsync.Viewpoint3D; (method: 'setClippingPlanes', planes: Bimsync.ClippingPlaneParams[]): JQuery; (method: 'getGrids'): Bimsync.Grid[]; (method: 'getGrids', callback: (result: Bimsync.Grid[]) => void): JQuery; (method: 'setAppearanceSettings', settings: Partial): JQuery; (method: 'setRenderSettings', settings: Partial): JQuery; (method: 'getRenderSettings'): Bimsync.RenderSettings; (method: 'setCameraSettings', settings: Partial): JQuery; (method: 'getCameraSettings'): Bimsync.CameraSettings; (method: 'getRenderSettings', callback: (result: Bimsync.RenderSettings) => void): JQuery; (method: 'calculatePointOnAxis', id: string, distance: number): Bimsync.CurvePoint | null; (method: 'calculatePointOnAxis', id: string, distance: number, callback: (result: Bimsync.CurvePoint | null) => void): JQuery; (method: 'captureScreenshot'): Promise; (method: 'captureScreenshot', callback: (result: string) => void): JQuery; (method: 'setNavigationSettings', settings: Partial): JQuery; (method: 'getNavigationSettings', callback: (result: Bimsync.NavigationSettings) => void): JQuery; (method: 'getNavigationSettings'): Bimsync.NavigationSettings; (method: 'setGridAxisState', id: string, settings: Partial): JQuery; (method: 'getGridAxisState', id: string, callback: (result: Bimsync.GridAxisState | null) => void): JQuery; (method: 'getGridAxisState', id: string): Bimsync.GridAxisState | null; (method: 'setAxisSegmentColors', id: string, settings: Bimsync.AxisSegmentColor[]): JQuery; /** * Return the current clipping planes. */ (method: 'getClippingPlanes', callback: (result: Bimsync.ClippingPlane[]) => void): JQuery; /** * Return the current clipping planes. */ (method: 'getClippingPlanes'): Bimsync.ClippingPlane[]; (method: 'lookAt', id: string[], direction?: Bimsync.NamedDirection | Bimsync.Vector3): JQuery; (method: 'lookAtBoundingBox', boundingBox: Bimsync.Box3, direction?: Bimsync.NamedDirection | Bimsync.Vector3): JQuery; (method: 'section', id: string | string[], planes: Bimsync.NamedPlane[]): JQuery; /** * Returns the axis aligned bounding box fitting the given objects. * * @param id */ (method: 'getBoundingBox', id: string | string[] | null, callback: (result: Bimsync.Box3) => void): JQuery; /** * Returns the axis aligned bounding box fitting the given objects. * * @param id */ (method: 'getBoundingBox', id?: string | string[]): Bimsync.Box3; (method: 'navigate', input: Bimsync.NavigationInput): JQuery; /** * Stop navigating. */ (method: 'stopNavigation'): JQuery; /** * Query the objects in the scene. * * @param query Query object * @returns Array of object ids */ (method: 'query', query: Bimsync.QueryBody, callback?: (result: string[]) => void): JQuery; (method: 'disableMeasure'): JQuery; (method: 'clearMeasure'): JQuery; (method: 'resize'): JQuery; (method: 'getSelected'): string[]; (method: 'showClippingPlaneWidget'): JQuery; (method: 'hideClippingPlaneWidget'): JQuery; (method: 'setPointBudget', pointBudget: number): JQuery; /** * Add a measure. * * @param measure Measure parameters */ (method: 'addMeasure', measure: Bimsync.MeasureParameters): JQuery; (method: 'clippingPlaneWidgetViewport', viewport: Bimsync.Viewport): JQuery; /** * Get the anti-aliasing settings. * * @returns Anti-aliasing settings */ (method: 'getAntiAliasingSettings'): Bimsync.AntiAliasingSettings; /** * Get images in the scene. * * @returns List of images */ (method: 'getImages'): Bimsync.Image[]; /** * Get the measure tool settings. * */ (method: 'getMeasureSettings'): Bimsync.MeasureSettings; /** * Get point cloud settings for the specified model id. * * @param id Model id */ (method: 'getPointCloudSettings', id: string): Bimsync.PointCloudSettings | null; /** * Get scene state. * * @param modelIds Model ids to limit the objects to */ (method: 'getSceneState', modelIds?: string[]): Bimsync.ObjectState; /** * Set the measure tool settings. * * @param settings Measure settings */ (method: 'setMeasureSettings', settings: Bimsync.MeasureSettings): JQuery; (method: 'pointCloudSettings', id: string, settings: Bimsync.PointCloudSettingsParams): JQuery; (method: 'pointCloudSettings', id: string, settings: Bimsync.PointCloudSettingsParams | null, callback: (settings: Bimsync.PointCloudSettings) => void): JQuery; /** * Remove measure by id. * * @param id Measure id */ (method: 'removeMeasure', uuid: string): JQuery; /** * Reset the opacity of translucent objects to the default value. */ (method: 'resetTranslucentOpacity'): JQuery; /** * Set the anti-aliasing settings. * * @param settings Anti-aliasing settings */ (method: 'setAntiAliasingSettings', settings: Partial): JQuery; /** * Set images in the scene. * * @param images List of images */ (method: 'setImages', images: Bimsync.Image[]): JQuery; /** * Set the navigation mode. * * @param mode Navigation mode */ (method: 'setNavigationMode', mode: Bimsync.NavigationMode | Bimsync.NamedNavigationMode): JQuery; /** * Set the position and size of the clipping plane widget. * * @param viewport Position and size of the clipping plane widget */ (method: 'setPlaneWidgetViewport', viewport: Bimsync.Viewport): JQuery; /** * Set point cloud settings for the specified model id. * * @param id Model id * @param params Point cloud settings */ (method: 'setPointCloudSettings', id: string, params: Bimsync.PointCloudSettingsParams): JQuery; /** * Set the opacity of translucent objects. * * @param opacity Opacity value between 0 and 1 */ (method: 'setTranslucentOpacity', opacity: number): JQuery; /** * Start navigating. * * @param input Map of navigation movements to start with scale factor */ (method: 'updateNavigation', input: Bimsync.NavigationInput): JQuery; defaults: Bimsync.Viewer3DSettings; } interface Viewer2DPlugin { (options?: Bimsync.Viewer2DOptions): JQuery; (method: 'dispose'): JQuery; (method: 'select', id: string[]): JQuery; (method: 'getStoreysByElevation', elevation: number): Bimsync.Storey[]; (method: 'getStoreys', options?: Bimsync.StoreyOptions): Bimsync.Storey[]; (method: 'getBuildings'): Bimsync.Building[]; (method: 'getLocation', point: Bimsync.Vector2): Bimsync.Vector2 | Bimsync.Vector3; (method: 'getViewpoint'): Bimsync.Viewpoint2D; (method: 'setViewpoint', viewpoint: Bimsync.Viewpoint2DParams): JQuery; (method: 'showStorey', id: string): JQuery; (method: 'hideStoreys'): JQuery; (method: 'hideStorey', id: string): JQuery; (method: 'moveTo', x: number, y: number): JQuery; (method: 'addImage', image: Bimsync.ImageParams): string; (method: 'addMarker', marker: Bimsync.MarkerParams): string; (method: 'addShape', shape: Bimsync.ShapeParams2D): string; (method: 'clearImages'): JQuery; (method: 'clearMarkers'): JQuery; (method: 'clearShapes'): JQuery; (method: 'removeImage', id: string): JQuery; (method: 'removeMarker', id: string): JQuery; (method: 'removeShape', id: string): JQuery; (method: 'showImage', id: string): JQuery; (method: 'hideImage', id: string): JQuery; (method: 'lookAt', id: string[], options?: Bimsync.LookAtOptions): JQuery; (method: 'lookAtBoundingBox', boundingBox: Bimsync.Box2 | Bimsync.Box3, options?: Bimsync.LookAtOptions): JQuery; (method: 'getRotation'): number; (method: 'setRotation', angle: number): JQuery; (method: 'unloadModel', modelId: string): JQuery; (method: 'loadUrl', url: string, parameters?: Bimsync.Viewer2DLoadParameters): JQuery; (method: 'setSpaceNameFormat', format: Bimsync.SpaceNameFormat): JQuery; (method: 'setViewport', vieweport: Bimsync.NamedViewport, options?: Bimsync.ViewportOptions): JQuery; defaults: Bimsync.Viewer2DOptions; } interface ViewerUIPlugin { (options?: Bimsync.ViewerUI.PluginOptions): JQuery; (method: 'showJoystick'): JQuery; (method: 'hideJoystick'): JQuery; (method: 'joystickPosition', position: Bimsync.ViewerUI.JoystickPosition): JQuery; (method: 'setLoading', loading: boolean): JQuery; (method: 'updateStoreySelect'): JQuery; (method: 'setSpatialStructure', spatialStructure: Bimsync.ViewerUI.SpatialStructure): JQuery; (method: 'set2dLockedNavigationMode', mode: boolean): JQuery; defaults: Bimsync.ViewerUI.PluginOptions; } interface JQuery { viewer: ViewerPlugin; viewer2d: Viewer2DPlugin; viewerUI: ViewerUIPlugin; } declare var bimsync: Bimsync.Base;