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.
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.
Viewer#background
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.
Viewer#camera
Allows to adjust contrast 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.
Viewer#highlightingColour
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.
Viewer#hoverPickColour
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
Viewer#mvMatrix
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';
Viewer#navigationMode
Camera matrix (perspective or orthogonal)
Viewer#pMatrix
Current performance based on FPS. Updated approx. every 500 ms
Options that can control the behaviour of the geometry loader
Switch between different rendering modes.
Viewer#renderingMode
Returns number of units in active model (1000 is model is in mm)
Viewer#unitsInMeter
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.
Viewer#xrayColour
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.
Viewer#addPlugin
plug-in object
You can use this function to change state of products in the model. State has to have one of values from State enumeration. Target is either enumeration from ProductType or array of product IDs. If you specify type it will effect all elements of the type.
Viewer#setState
One of State enumeration values.
Target of the change. It can either be array of product IDs or product type from ProductType.
Optional
modelId: numberId of the model
Static
checkThis 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 CheckResult.errors contains any messages viewer won't work. If CheckResult.warnings contain any messages it will work but some functions may be restricted or may not work or it may have poor performance.
Viewer.check
Use this method to clip the model with A plane. Use unclip() method to unset clipping plane.
Viewer#clip
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 setState() function.
Viewer#defineStyle
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 start() method.
Viewer#draw
Viewer#frame
Optional
framebuffer: FramebufferGets 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
modelId: numberOptional ID of the model which clipping plane we want to obtain
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
HTML coordinates of the centroid of the product bounding box
ID of the product
ID of the model
This function can be used to identify the XY location on the canvas for a given 3D WCS vector. For example this can be used to identity the XY location of a pick event in 3D space.
HTML coordinates of the provided WCS vector
a vec3 - see https://glmatrix.net/docs/module-vec3.html
Gets complete model state and style. Resulting object can be used to restore the state later on.
Model ID which you can get from 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.
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)
Measure to use for the default ascending sort order. Default value: 'triangles'
Viewer#getProductBoundingBox
Bounding box of the product in model coordinates (not reduced by current WCS)
Optional
modelId: numberOptional Model ID. If not defined first type of a product with certain ID will be returned. This might be ambiguous.
Viewer#getProductType
Product type ID. This is either null if no type is identified or one of type ids.
Optional
modelId: numberOptional Model ID. If not defined first type of a product with certain ID will be returned. This might be ambiguous.
Use this function to get state of the products in the model. You can compare result of this function with one of values from State enumeration. 0xFF is the default value.
Viewer#getState
Id of the product. You would typically get the id from pick event or similar event.
Optional
modelId: numberId of the model
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 defineStyle() function. 0xFF is the default value.
Viewer#getStyle
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.
Id of the product. You would typically get the id from pick event or similar event.
Optional
modelId: numberOptional Model ID. If not defined first style available for a product with certain ID will be returned. This might be ambiguous.
This method returns specified product's bounding box or bbox of the current acite models if no product ID is specified.
Viewer#setCameraTarget
Returns bounding box of the target, null if not found
Optional
prodId: number[optional] Product ID. You can get ID either from semantic structure of the model or from pick event.
Optional
modelId: numberOptional ID of a specific model.
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 isolate() to cancel this operation
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)
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
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 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, ...)
Viewer#load
Viewer#loaded
Model has to be either URL to wexBIM file or Blob or File representing wexBIM file binary data.
Optional
tag: any[optional] - Tag to be used to identify the model in loaded event.
Optional
headers: { [optional] - Headers to be used for request. This can be used for authorized access for example.
Optional
progress: ((message: Message) => void)[optional] - 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, ...).
Viewer#load
Viewer#loaded
Model has to be either URL to wexBIM file or Blob or File representing wexBIM file binary data.
Optional
tag: any[optional] - Tag to be used to identify the model in loaded event.
Optional
headers: { [optional] - Headers to be used for request. This can be used for authorized access for example.
Optional
progress: ((message: Message) => void)Use this method to unregister handlers from events. You can add event handlers by calling the on() method.
Viewer#off
Name of the event
Handler to be removed
Use this method to register to events of the viewer like :pick, mousedown, :loaded and others. You can define arbitrary number of event handlers for any event. You can remove handler by calling off() method.
Viewer#on
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.
Viewer#removePlugin
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.
Viewer#resetStates
Target of the change. It can either be array of product IDs or product type from ProductType.
Optional
modelId: numberRestores model state from the data previously captured with getModelState() function
ID of the model
State of the model as obtained from getModelState() function
Use this method to clip the model with A plane. Use unclip() method to unset clipping plane.
Viewer#setClippingPlaneA
normal equation of the plane
Optional
modelId: numberOptional ID of the model to be clipped. All models are clipped otherwise.
Use this method to clip the model with B plane. Use unclip() method to unset clipping plane.
Viewer#setClippingPlaneB
normal equation of the plane
Optional
modelId: numberOptional ID of the model to be clipped. All models are clipped otherwise.
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 State.UNSTYLED value. You can combine restyling and hiding in this way. Use defineStyle() to define styling first.
Viewer#setStyle
style defined in defineStyle() method
Target of the change. It can either be array of product IDs or product type from ProductType.
Optional
modelId: numberOptional ID of a specific model.
Use this function to show default views.
Viewer#show
Type of view. Allowed values are 'top', 'bottom', 'front', 'back', 'left', 'right'. Directions of this views are defined by the coordinate system. The camera target and distance is determined by 'id' param, if present, or the full model extent when omitted
Optional
id: numberOptional parameter indicating the product ID to target the camera at
Optional
model: numberOptional parameter indicating the model ID the product is in
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.
Viewer#start
Optional
modelId: number[optional] - Optional ID of the model to be stopped. You can get this ID from loaded event.
Use this function to start all models. You can switch animation of the model off by calling stop().
Viewer#startAll
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 stopPicking function.
Viewer#startPicking
ID of the model to be stopped. You can get this ID from loaded event.
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 start().
Viewer#stop
Optional
id: number[optional] - Optional ID of the model to be stopped. You can get this ID from loaded event.
Use this function to stop all models. You can switch animation of the model on again by calling start().
Viewer#stopAll
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.
Viewer#stopPicking
ID of the model to be stopped. You can get this ID from loaded event.
This method will cancel any clipping plane if it is defined. Use clip() method to define clipping by point and normal of the plane.
Viewer#unclip
Optional
modelId: numberOptional ID of the model to be unclipped. All models are unclipped otherwise.
Unloads model from the GPU. This action is not reversible.
ID of the model which you can get from 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)
Viewer#zoomTo
True if target exists and zoom was successful, False otherwise
Optional
target: number | { Optional product ID or a list of products in models
Optional
model: numberOptional model ID
Optional parameter, default is 'true'. When true, transition to the view is animated. When false, view is changed imediately.
Animations functionality
Number of milliseconds for animated zooming
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.
string ID of the canvas or HTML canvas element.
Optional
errorHandler: ((__namedParameters: Object) => void)an error handler
Generated using TypeDoc
The xbim 3D viewer component enabling *.wexbim files to be viewed with WebGL.