string ID of the canvas or HTML canvas element.
Animations functionality
Number of milliseconds for animated zooming
Returns a filtered array of currently active handles
The viewer is watching the performance based on the FPS. When performance drops down, it can reduce amount of geometry to be rendered. This is usefull for some navigation and animations but might not be convenient in all scenarios like in a wals mode. This property can be used to switch the addaptive performance on and off.
The viewer is watching the performance based on the FPS. When performance drops down, it can reduce amount of geometry to be rendered. This is usefull for some navigation and animations but might not be convenient in all scenarios like in a wals mode. This property can be used to switch the addaptive performance on and off.
This can be used to adjust ortgographic and perspective camera properties to be close. Particularly useful when restoring orthographic view with displaced camera.
Array of four integers between 0 and 255 representing RGBA colour components. This defines background colour of the viewer. You can change this value at any time with instant effect.
Array of four integers between 0 and 255 representing RGBA colour components. This defines background colour of the viewer. You can change this value at any time with instant effect.
Allows to adjust brightness of the view
Allows to adjust brightness of the view
Type of camera to be used. Available values are 'perspective' and 'orthogonal' You can change this value at any time with instant effect.
Type of camera to be used. Available values are 'perspective' and 'orthogonal' You can change this value at any time with instant effect.
Allows to adjust contrast of the view
Allows to adjust contrast of the view
Allows to adjust gamma of the view
Allows to adjust gamma of the view
Array of four integers between 0 and 255 representing RGBA colour components. This defines colour for highlighted elements. You can change this value at any time with instant effect.
Array of four integers between 0 and 255 representing RGBA colour components. This defines colour for highlighted elements. You can change this value at any time with instant effect.
Array of four integers between 0 and 255 representing RGBA colour components. This defines colour for elements when hovered over. You can change this value at any time with instant effect.
Array of four integers between 0 and 255 representing RGBA colour components. This defines colour for elements when hovered over. You can change this value at any time with instant effect.
Determines whether the viewer raised 'hoverpick' events when the mouse hovers over an element. When enabled the currently hovered item will be be highlighted. The 'hoverpicked' event can be used to provide tooltips/context menus etc.
Determines whether the viewer raised 'hoverpick' events when the mouse hovers over an element. When enabled the currently hovered item will be be highlighted. The 'hoverpicked' event can be used to provide tooltips/context menus etc.
Indicates if the viewer is running the rendering loop
World matrix
World matrix
Returns number of milliseconds for which Model View Matris hasn't been changed. This can be used for optimisations and actions to happen after vertain amount of time after the last movement of the model.
Switch between different navigation modes for left mouse button. Allowed values: 'pan', 'zoom', 'orbit' (or 'fixed-orbit') , 'free-orbit' and 'none'. Default value is 'orbit';
Switch between different navigation modes for left mouse button. Allowed values: 'pan', 'zoom', 'orbit' (or 'fixed-orbit') , 'free-orbit' and 'none'. Default value is 'orbit';
Camera matrix (perspective or orthogonal)
Camera matrix (perspective or orthogonal)
Current performance based on FPS. Updated approx. every 500 ms
Current performance based on FPS. Updated approx. every 500 ms
Returns readonly array of plugins
Options that can control the behaviour of the geometry loader
Switch between different rendering modes.
Switch between different rendering modes.
Returns number of units in active model (1000 is model is in mm)
Array of four integers between 0 and 255 representing RGBA colour components. This defines colour for xray mode rendering. You can change this value at any time with instant effect.
Array of four integers between 0 and 255 representing RGBA colour components. This defines colour for xray mode rendering. You can change this value at any time with instant effect.
Adds plugin to the viewer. Plugins can implement certain methods which get called in certain moments in time like before draw, after draw etc. This makes it possible to implement functionality tightly integrated into Viewer like navigation cube or others.
plug-in object
You can use this function to change state of products in the model. State has to have one of values from {@link xState xState} enumeration. Target is either enumeration from {@link xProductType xProductType} or array of product IDs. If you specify type it will effect all elements of the type.
One of State enumeration values.
Target of the change. It can either be array of product IDs or product type from {@link xProductType xProductType}.
Clears all highlighting in all visible models
Use this method to clip the model with A plane. Use {@link Viewer#unclip unclip()} method to unset clipping plane.
point in clipping plane
normal pointing to the half space which will be hidden
Use this function to define up to 224 optional styles which you can use to change appearance of products and types if you pass the index specified in this function to {@link Viewer#setState setState()} function.
Index of the style to be defined. This has to be in range 0 - 224. Index can than be passed to change appearance of the products in model
Array of four numbers in range 0 - 255 representing RGBA colour. If there are less or more numbers exception is thrown.
This is the main draw method. You can use it if you just want to render model once with no navigation and interaction. If you want interactive model, call {@link Viewer#start start()} method. {@link Viewer#frame Frame event} is fired when draw call is finished.
Fires error event. This might be used by plugins.
Use this method to get camera direction
Use this method to get camera direction
Use this method to get actual camera position.
Use this method to get camera position in the WCS coordinates. Useful for persistance accross executions.
Gets clipping plane of the defined model or of the first clipping plane curently visible. Bare in mind that every model might have different clipping plane
Optional ID of the model which clipping plane we want to obtain
Gets current WCS displacement used for visualisation
This renders the colour coded model into the memory buffer not to the canvas and use it to identify ID, model id and 3D location at canvas location [x,y]
This renders the colour coded model into the memory buffer not to the canvas and use it to identify ID, model id and 3D location at canvas location [x,y]
X coordinate on the canvas
Y coordinate on the canvas
This function can be used to place HTML markup relative to the centroid of a product
ID of the product
ID of the model
HTML foordinates of the centroid of the product bounding box
Gets list of isolated product IDs
Gets complete model state and style. Resulting object can be used to restore the state later on.
Model ID which you can get from {@link Viewer#event:loaded loaded} event.
Counts number of triangles for every product. This is usefull to understand performance of certain models. The default sort order is by number of triangles, but density of triangles (number of triangles per a volume unit) might also be a good measure to find the most expensive products to draw.
Measure to use for the default ascending sort order. Default value: 'triangles'
List of product analytical results sorted in descendent order by number of triangles or density (number of triangles per volumetric unit of the product bounding box)
Bounding box of the product in model coordinates (not reduced by current WCS)
Product type ID. This is either null if no type is identified or one of {@link xProductType type ids}.
Use this function to get state of the products in the model. You can compare result of this function with one of values from {@link xState xState} enumeration. 0xFF is the default value.
Id of the product. You would typically get the id from {@link Viewer#event:pick pick event} or similar event.
Use this function to get overriding colour style of the products in the model. The number you get is the index of your custom colour which you have defined in {@link Viewer#defineStyle defineStyle()} function. 0xFF is the default value.
Id of the product. You would typically get the id from {@link Viewer#event:pick pick event} or similar event.
Returns style index or 255 (State.UNDEFINED) if there is no overriding style defined for the product. Use viewer.defineStyle()
to define overriding style and viewer.setStyle()
to set it for a product.
This method returns specified product's bounding box or bbox of the current acite models if no product ID is specified.
Product ID. You can get ID either from semantic structure of the model or from {@link Viewer#event:pick pick event}.
Returns bounding box of the target, null if not found
Checks if the model with defined ID is currently loaded in the viewer.
Model ID
True if model is loaded, false otherwise
Checks if the model with defined ID is currently loaded and running
Model ID
True if model is loaded and running, false otherwise
Returns true if model participates in picking, false otherwise
ID of the model
Checks if product with this ID exists in the model
Stops all models and only shows a single product
Model ID
Isolates products which have most geometry (number of triangles). This function is meant for data debugging, identifying products which are likely to be over-detailed or poorly modeled.
Use {@link Viewer#isolate isolate()} to cancel this operation
Measure to use for sorting and selection. Defaul value: 'triangles'
Top ratio to isolate. Should be a number between 0.0 - 1.0. Default value is 0.2 which means top 20% of the geometry
The set of product analytical results isolated, sorted in descendent order by number of triangles or density (number of triangles per volumetric unit of the product bounding box)
This method is used to load model data into viewer. Model has to be either URL to wexBIM file or Blob or File representing wexBIM file binary data. Any other type of argument will throw an exception.
Region extend is determined based on the region of the model
Default view if 'front'. If you want to define different view you have to set it up in handler of {@link Viewer#event:loaded loaded} event.
You can load more than one model if they occupy the same space, use the same scale and have unique product IDs. Duplicated IDs won't affect
visualization itself but would cause unexpected user interaction (picking, zooming, ...)
Model has to be either URL to wexBIM file or Blob or File representing wexBIM file binary data.
Tag to be used to identify the model in {@link Viewer#event:loaded loaded} event.
Headers to be used for request. This can be used for authorized access for example.
Progress reporting delegate
This method uses WebWorker if available to load the model into this viewer. Model has to be either URL to wexBIM file or Blob or File representing wexBIM file binary data. Any other type of argument will throw an exception. You can load more than one model if they occupy the same space, use the same scale and have unique product IDs. Duplicated IDs won't affect visualization itself but would cause unexpected user interaction (picking, zooming, ...).
Model has to be either URL to wexBIM file or Blob or File representing wexBIM file binary data.
Tag to be used to identify the model in {@link Viewer#event:loaded loaded} event.
Headers to be used for request. This can be used for authorized access for example.
Use this method to unregister handlers from events. You can add event handlers by calling the {@link Viewer#on on()} method.
Name of the event
Handler to be removed
Use this method to register to events of the viewer like {@link Viewer#event:pick pick}, {@link Viewer#event:mouseDown mouseDown}, {@link Viewer#event:loaded loaded} and others. You can define arbitrary number of event handlers for any event. You can remove handler by calling {@link Viewer#off off()} method.
Name of the event you would like to listen to.
Callback handler of the event which will consume arguments and perform any custom action.
Removes plugin from the viewer. Plugins can implement certain methods which get called in certain moments in time like before draw, after draw etc. This makes it possible to implement functionality tightly integrated into Viewer like navigation cube or others.
plug-in object
Use this function to reset state of all products to 'UNDEFINED' which means visible and not highlighted. You can use optional hideSpaces parameter if you also want to show spaces. They will be hidden by default.
Target of the change. It can either be array of product IDs or product type from {@link xProductType xProductType}.
Use this function to reset appearance of all products to their default styles.
Restores model state from the data previously captured with {@link Viewer#getModelState getModelState()} function
ID of the model
State of the model as obtained from {@link Viewer#getModelState getModelState()} function
This method can be used for batch setting of viewer members. It doesn't check validity of the input.
Object containing key - value pairs
Use this method to clip the model with A plane. Use {@link Viewer#unclip unclip()} method to unset clipping plane.
normal equation of the plane
Use this method to clip the model with A plane. Use {@link Viewer#unclip unclip()} method to unset clipping plane.
normal equation of the plane
Sets state of the given item to be hovered over, unsetting an previous item. Setting the id to undefined will clear the current.
The product Id
Id of the model
Sets camera parameters (near and far clipping planes) from current active models. This should be called whenever active models are very different (size, units)
Use this method for restyling of the model. This doesn't change the default appearance of the products so you can think about it as an overlay. You can remove the overlay if you set the style to {@link State#UNSTYLED State.UNSTYLED} value. You can combine restyling and hiding in this way. Use {@link Viewer#defineStyle defineStyle()} to define styling first.
style defined in {@link Viewer#defineStyle defineStyle()} method
Target of the change. It can either be array of product IDs or product type from {@link xProductType xProductType}.
Use this function to show default views.
Type of view. Allowed values are 'top', 'bottom', 'front', 'back', 'left', 'right'. Directions of this views are defined by the coordinate system. Target and distance are defined by {@link Viewer#setCameraTarget setCameraTarget()} method to certain product ID or to the model extent if {@link Viewer#setCameraTarget setCameraTarget()} is called with no arguments.
Optional parameter, default is 'true'. When true, transition to the view is animated. When false, view is changed imediately.
Use this function to start animation of the model. If you start animation before geometry is loaded it will wait for content to render it. This function is bound to browser framerate of the screen so it will stop consuming any resources if you switch to another tab.
Optional ID of the model to be stopped. You can get this ID from {@link Viewer#event:loaded loaded} event.
Use this function to start all models. You can switch animation of the model off by calling {@link Viewer#stop stop()}.
Use this function to enable picking of the objects in the specified model. All models are pickable by default when loaded. You can stop the model from being pickable using {@link Viewer#stopPicking} function.
ID of the model to be stopped. You can get this ID from {@link Viewer#event:loaded loaded} event.
Starts rotation around to present the model
Use this function to stop animation of the model. User will still be able to see the latest state of the model. You can switch animation of the model on again by calling {@link Viewer#start start()}.
Optional ID of the model to be stopped. You can get this ID from {@link Viewer#event:loaded loaded} event.
Use this function to stop all models. You can switch animation of the model on again by calling {@link Viewer#start start()}.
Use this function to stop picking of the objects in the specified model. It will behave as if not present for all picking operations. All models are pickable by default when loaded.
ID of the model to be stopped. You can get this ID from {@link Viewer#event:loaded loaded} event.
Stops rotation of the model
This method will cancel any clipping plane if it is defined. Use {@link Viewer#clip clip()} method to define clipping by point and normal of the plane.
Unloads model from the GPU. This action is not reversible.
ID of the model which you can get from {@link Viewer#event:loaded loaded} event.
Use this method to zoom to specified element. If you don't specify a product ID it will zoom to full extent. If you specify list of products, this function will zoom to grouped bounding box. You should use this only for elements which are close to each other (like aggregations)
Optional parameter, default is 'true'. When true, transition to the view is animated. When false, view is changed imediately.
True if target exists and zoom was successful, False otherwise
This is a static function which should always be called before Viewer is instantiated. It will check all prerequisites of the viewer and will report all issues. If Prerequisities.errors contain any messages viewer won't work. If Prerequisities.warnings contain any messages it will work but some functions may be restricted or may not work or it may have poor performance.
Generated using TypeDoc
This is constructor of the xBIM Viewer. It gets HTMLCanvasElement or string ID as an argument. Viewer will than be initialized in the context of specified canvas. Any other argument will throw exception.
If any Zone technology is in use, this constructor should run in the root zone without any additional load. It has global event handlers and hooks in document.mousemove, document.keyup, requestAnimationFrame and otherw which need to run fast and should not cause any additional sideeffects (like data binding refresh in Angular)
Viewer
This is the main and the only class you need to load and render IFC models in wexBIM format. This viewer is part of xBIM toolkit which can be used to create wexBIM files from IFC, ifcZIP and ifcXML. WexBIM files are highly optimized for transmition over internet and rendering performance. Viewer uses WebGL technology for hardware accelerated 3D rendering and SVG for certain kinds of user interaction. This means that it won't work with obsolete and non-standard-compliant browsers like IE10 and less.