new IsoVist( [config] [, typeName])
Creates a new isovist element.
Parameters:
| Name | Type | Argument | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object |
<optional> |
An optional configuration object. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties of
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Name | Type | Argument | Description |
|---|---|---|---|
name |
string |
<optional> |
A human-readable name for this isovist element. |
uuid |
string |
<optional> |
A universally unique identifier of this isovist element. |
visible |
boolean |
<optional> |
Whether or not the isovist element is visible in the model. |
extents |
THREE.Box3 |
<optional> |
The bounding box of the isovist element in model space. |
path |
BIM.Path |
<optional> |
A path that the isovist element geometry follows. |
shell |
PD.Shell |
<optional> |
The shell object to use when generating geometry. |
level |
BIM.Level |
<optional> |
The building/structure level this isovist element belongs to. |
space |
BIM.Space |
<optional> |
The space that this isovist element belongs to. |
height |
number |
<optional> |
The height of the isovist element above the floor. |
subType |
number |
<optional> |
An optional sub-type to specify the type of metric being measured. |
elementType |
number |
<optional> |
The BIM element type bitmask, defaults to DRAWING + ANALYSIS. |
typeComponent |
object |
<optional> |
An optional configuration object for the isovist type component. |
updateSpeed |
number |
<optional> |
The interactive update speed, (0:Manual, 1:Slow, 2:Fast, 3:Real-time). |
viewAngle |
number |
<optional> |
The angle of view from the data point with maximum sensitivity, defaults to 60deg. |
viewFalloff |
number |
<optional> |
The angle outside the view angle where sensitivity falls to zero, defaults to 15deg. |
viewEasing |
number |
<optional> |
The easing method used to transition over the falloff angle, defaults to |
typeNameAn additional parameter typically used by subclasses to set
an the default name without modifying the config object.
Extends
Members
-
:Map
attributes
-
Stores any arbitrary attributes associated with this entity.
This is a simple key/value map that can be used to store any additional information about the entity that may be required by the application such as reference ids, material types, fire ratings, costings, etc.
Type
- Map
- Inherited From:
- Overrides:
-
:PD.BRep|null
brep
-
An optional boundary representation defining the element shape.
Whilst some elements store all of their geometry in their shell, this is not always the most effective and efficient approach for all element types. For example, railings, fences and stairs have complex post, rail, infill and tread geometry between each path segment, which may add up to many thousands of surfaces. This would make interactive selection and collision detection more computationally expensive if all of that geometry had to be tested each time. Moreover, when selecting a railing, you would need to click exactly on one of its surfaces, which may not be easy if the post, rail and slat sizes are small compared to their spans.
To address this, such element types can store complex geometry in a
PD.BRepinstance, which uses less memory than a shell and can store curved surfaces as well as planar ones. To make selection easier, these elements can also store a simplified shell representation of their geometry, which is used for interactive selection and collision detection. This shell is typically composed of a few polygons that cover the main spans of the element, such as the vertical spans between each post in a railing, or the vertical and horizontal planes of a chair's seat and backrest. The rest of the detailed geometry is then stored in this brep.Type
- PD.BRep | null
- Inherited From:
- Overrides:
-
:number
buildRef
-
A reference value used exclusively by the host level of the element.
This value is used by the level that hosts the element, or the level that hosts its parent element if it has one. It is used internally to determine if and when the level needs to update various parts of its own managed geometries.
Type
- number
- Inherited From:
- Overrides:
-
:Array.<Array.<number>>
calculationResults
-
Stores view distance data for each arc segment of the isovist.
This is an array of ray data generated during the isovist calculation, where each entry is a array of 7 numbers in the following order:
- 0: X coordinate of ray endpoint in model space,
- 1: Y coordinate of ray endpoint in model space,
- 2: Distance from isovist center to the XY coordinates in mm,
- 3: Distance from isovist center to XY coordinates as fraction of
maxRadius(0 to 1), - 4: Horizontal angle from isovist forward direction in radians,
- 5: Visible light transmittance at the end of travel (0 to 1),
- 6: View angle factor for ray segment (0 to 1).
You can also use the static indices
BIM.IsoVist.RESULTS_X,BIM.IsoVist.RESULTS_Y,BIM.IsoVist.RESULTS_DISTANCE,BIM.IsoVist.RESULTS_FRACTION,BIM.IsoVist.RESULTS_ANGLE,BIM.IsoVist.RESULTS_TRANSMITTANCE, andBIM.IsoVist.RESULTS_VIEW_FACTORto access the ray-specific data within each entry of this array as a way to ensure that you are referencing the correct array value.The transmittance is a fractional value (0 to 1) that indicates how much light or visibility is able to pass through the model in the direction of the ray segment, based on any obstructions in the model. A value of 1 means the ray segment is completely unobstructed, while a value of 0 means it is fully blocked by at least one opaque object. Values between 0 and 1 indicate partial obstruction, such as through transparent or semi-transparent materials. This is governed by the visible light transparency property of each intersected material.
The angle factor is a fractional value (0 to 1) that indicates the relative contribution of that ray segment to the overall visibility, based on the angle the ray makes with the forward direction of the isovist point. A value of 1 means the ray segment is in front of the isovist point and within the angle given by its type component's
viewAngleproperty. Values less than 1 and greater than zero indicate the ray segment is outside the view angle, but within theviewFalloffrange on either side. A value of zero means the ray segment is outside both the view and falloff angles on either side.If the view angle is 360 degrees, all angle factors will be 1. If the sum of the view angle plus two times the falloff angle is less than 360 degrees, then there will be some rays with angle factors of zero.
Type
- Array.<Array.<number>>
-
:boolean
canBelongToSpace <readonly>
-
Whether or not this element can belong to a space.
When true, the element can be added to a
BIM.Spaceby interactively dragging it into the volume of the space. When false, the element can only be added to a space programmatically, typically belonging only to a level.For most element this property is true, but for elements such as roofs and footings, where they are typically dragged around above, below and through existing spaces, this property should be false.
addElement()method on the space instance.Type
- boolean
- Inherited From:
- Overrides:
-
:THREE.Vector3
center
-
A 3D point representing the center of the view isovist.
This is typically located above the position of the first point in the isovist element's path, offset by its height property.
This property is an alias for the
posproperty, providing a more descriptive name for the center of the view isovist and ensuring that new position values are always valid even if given as an [x,y,z] array or another type of {x,y,z} object.Type
- THREE.Vector3
-
:string
className <readonly>
-
The name of the subclass for this object instance.
This name must match the name of this class within the
PD.Registry. Thus, the base implementation simply referencesthis.constructor.getClassName()to ensure that this is always the case even for subclasses. As a result, there is rarely any need to override this method.This property is used when copying, storing and exporting data for subclass instances to ensure that they are recreated as instances of the right class.
Type
- string
- Inherited From:
- Overrides:
-
:string
displayName <readonly>
-
The name to display for this class within the user interface.
Type
- string
- Inherited From:
- Overrides:
-
:BIM.ELEMENT
elementType
-
The BIM element type for the element.
Whilst the entity type is very specific regarding the actual class of an element, the element type is a broader categorisation intended primarily for compatibility with gbXML element types and the various analysis tools that use them. However, it can also be a very useful internal filter when searching for elements of a particular type.
Type
- Inherited From:
- Overrides:
-
:BIM.ENTITY
entityType <readonly>
-
Defines the type of BIM entity this class represents.
This value is used by the
PD.Registryfor grouping elements and matching components. The base implementation simply referencesthis.constructor.getEntityType()so that only a static method needs to be added to subclasses.Type
- Inherited From:
- Overrides:
-
:THREE.Box3
extents
-
The 3D extents of the element as a bounding box.
Type
- THREE.Box3
- Inherited From:
- Overrides:
-
:boolean
hasChanged
-
Whether or not the entity has recently changed and needs to update.
This property is typically set by the user interface or other parts of the framework when the entity's properties have changed and any visual representations need to be updated.
Type
- boolean
- Inherited From:
- Overrides:
-
:number
height
-
The height of the element in model units, if applicable.
Type
- number
- Inherited From:
- Overrides:
-
:number
id
-
A unique integer identifier for fast discovery and/or equality checking.
This identifier is unique within the current project data and is primarily intended to facilitate fast lookup and equality checking. It is assigned automatically when the element is created and should not change. It is much simpler than the
uuidproperty, being a numeric integer rather than a long string of characters, and is the preferred way of comparing elements to see if they are the same.Type
- number
- Inherited From:
- Overrides:
-
:boolean
isDataPoint <readonly>
-
A flag identifying this object as a data point element.
Type
- boolean
- Inherited From:
- Overrides:
-
:boolean
isElement <readonly>
-
A flag identifying this object as a BIM element.
Type
- boolean
- Inherited From:
- Overrides:
-
:boolean
isEntity <readonly>
-
A flag identifying this object as an entity.
Type
- boolean
- Inherited From:
- Overrides:
-
:boolean
isIsoVist <readonly>
-
A flag identifying this object as a isovist element.
Type
- boolean
-
:boolean
isSurfaceMounted <readonly>
-
Whether or not this element should be mounted on a surface.
When true, the element will try to attach itself to the nearest vertical surface within the model rather than being free-standing. This is mainly used when interactively dragging and dropping elements into the model.
Type
- boolean
- Inherited From:
- Overrides:
-
:BIM.Renderable|BIM.Level|null
level <readonly>
-
The level within a building/structure that this element belongs to.
To add an element to a level, use the
BIM.Level#addElementmethod on the level you wish to add the element to.Type
- BIM.Renderable | BIM.Level | null
- Inherited From:
- Overrides:
-
:number
maxRadius
-
The maximum radius/distance that the isovist will check for visibility.
This defines the maximum distance that each ray segment will be cast from the isovist point when calculating visibility. This value is set during each calculation and is typically some factor of the current model scene size.
Type
- number
-
:PD.PolyMesh
meshIsoVist
-
The mesh used to overlay the actual visible area.
Type
-
:object
metrics
-
A data object that stores the computed metrics for the isovist.
This data object contains a number of properties that summarise the overall characteristics of the isovist based on the latest calculation results. These are computed within the
computeMetrics()method.These metrics provide insights into the spatial characteristics of the isovist and can be used for further analysis or visualisation. When the
validproperty is false, it indicates that the metrics have either not been computed yet or that the isovist calculation did not produce valid results. In this case, the other metric properties should be considered unreliable.Type
- object
-
:string
name
-
A human-readable name for this item instance.
Type
- string
- Inherited From:
- Overrides:
-
:boolean
onlyUsesOwnMesh <readonly>
-
Whether or not this element exclusively renders to its own mesh and does not use any level meshes.
This value will be
falsefor the majority of building and drawing elements as they use the primary level meshes to render themselves and will likely react to any changes in the built form. However, some analytical element classes such asBIM.SunPath3DandBIM.IsoVistuse entirely their own meshes so can be updated completely independently of the rest of the building model.Thus, a
truevalue here allows elements that only use their own dedicated mesh to regenerate themselves without triggering a full level-wide model regeneration when their parameters are edited. This happens in the element'sBIM.Element#updateDynamicParametersmethod which checks this property to determine whether to just call thePD.GlobalActions.updateSelectionMeshesmethod instead of returningtrueand rebuilding the entire level.Type
- boolean
- Inherited From:
- Overrides:
-
:boolean
onlyUsesSiteMesh <readonly>
-
Whether or not this element exclusively renders to its level site mesh.
This value will be
falsefor the majority of building and drawing elements as they use the primary level meshes to render themselves and will likely react to any changes in the built form. However, some site elements such as plants, rocks, terrains and pots only use the on-demand site mesh, which can be updated completely independently of the rest of the building model.Thus, a
truevalue here allows elements that only use their level's site mesh to regenerate themselves without triggering a full level-wide model regeneration when their parameters are edited. This happens in the element'sBIM.Element#updateDynamicParametersmethod which checks this property to determine whether to just call theBIM.Level#rebuildSiteMeshmethod instead of returningtrueand rebuilding the entire level.Type
- boolean
- Inherited From:
- Overrides:
-
:BIM.Element|null
parent <readonly>
-
The container element that this element belongs to.
To add an element to a container element, use the
addElement()method on the container you wish to add the element to.Type
- BIM.Element | null
- Inherited From:
- Overrides:
-
:number
pointSize
-
The relative size of visual data point indicators.
As data points have no actual geometry of their own, their position in the model and defining visual characteristics need to be displayed using markers and indicator lines. The relative size of these lines are determined dynamically based on the size of the model extents to ensure that they are always visible and appropriately scaled. Thus, this is effectively a cached value based on some multiple of
PD.GlobalView.pointSizeModel, as determined by each different type of data point.Whilst you can set it's value directly, this property is typically set automatically during the
rebuild()process, so any value you set will be soon overridden.Type
- number
- Inherited From:
- Overrides:
-
:THREE.Vector3
pos
-
Stores the actual position of the point, which can be offset from its path.
Type
- THREE.Vector3
- Inherited From:
- Overrides:
-
:boolean
selectSegmentsByShell <readonly>
-
Whether or not to select path segments in 3D using each junction's shell.
When true, the selection process will check if the user has clicked or tapped on any of the shell facets of a path junction and, if so, will set that junction's path segment as selected. This is typically only true for extruded elements such as spaces, walls, slabs, railings and stairs, as well as those with per-junction geometry such as plants and rocks.
Type
- boolean
- Inherited From:
- Overrides:
-
:boolean
selected
-
Whether or not the entity is in the current selection set.
This property is typically set by the user interface when the user selects or deselects entities within the model view. The
PD.SelectionManageruses this property to keep track of which entities are currently selected.Type
- boolean
- Inherited From:
- Overrides:
-
:PD.LocalCoordinates
sharedLocalCoordinates <readonly>
-
A shared local coordinate system to use for generating geometry.
This coordinate system is shared with all elements and is intended only for temporary use when generating each element's geometry. Thus, it should be considered highly volatile and only safely used within the
BIM.Element#rebuildmethod of each element. You must initialise it on every use and can then pass it around to other functions/methods called from within the initialising method. However, you should assume that it will be immediately used again by another element as soon as yourrebuildmethod returns, so it will not hold or persist any particular value beyond that.Type
- Inherited From:
- Overrides:
-
:PD.Shell|null
shell
-
Stores the 3D shell geometry for this element.
Shell geometry is typically used to represent the base shape of an element and is the default geometry for interactive selection testing and collision detection. Some elements, such as walls, slabs and columns, have relatively simple geometry so use their shell for both selection and visual representation. Other elements, such as railings, use their shell to store single vertical selection planes between each corner post, but store the more detailed post, rail and infill geometry in their
brepproperty.A shell is composed of one or more
PD.Polygoninstances, which are bounded planar surfaces that each store their own boundary contours, plane equations, center position and 3D extents, as well as fill and line colours. This makes them ideal for fast ray intersection and adjacency calculations, but means they use more memory than an equivalentPD.BRep.Faceinstance. Thus, rather than store thousands of post, rail and infill surfaces as shell polygons, the railings element stores all that in itsPD.BRep, but just a few shell polygons to cover each span. As well as being much faster, this has the additional benefit of allowing selection by simply clicking anywhere on the span, rather than having to click directly on an actual post, rail or slat surface.What Goes in a Shell
It is not always obvious what should go in the shell and what in the brep, so it will always be up to the element developer to decide. However, as an illustration, consider something like a wooden chair element. All it needs for selection and collision detection is a horizontal polygon for the seat and an inclined polygon for the backrest. This provides intuitive targets for user selection and sufficient geometry for determining if an avatar has bumped into it. It also allows the avatar to sit and lean against the backrest without falling through. All of the detailed leg, armrest and horizontal/vertical backrest supports can then be stored in the brep, with just the two planes stored in the shell.
A couch or sofa element on the other hand, may be a little different. It will likely need boxes for the spans of both the seat and backrest, but also for each armrest. For a simple low-poly visual representation this could be just enough, so it could all be stored in the shell and nothing in the brep. However, once you start adding curved padding, cushions and other embellishments, the shell representation could likely remain just boxes, but the more complex and curved geometry would likely be best added to the brep.
Type
- PD.Shell | null
- Inherited From:
- Overrides:
-
:BIM.Space|null
space <readonly>
-
The space that this element belongs to.
To add an element to a space, use the
BIM.Space#addElementmethod on the space you wish to add the element to.Type
- BIM.Space | null
- Inherited From:
- Overrides:
-
:BIM.Structure|null
structure <readonly>
-
The building/structure that this element belongs to.
This is dynamically extracted from either the level or the space that the element belongs to within the model.
Type
- BIM.Structure | null
- Inherited From:
- Overrides:
-
:BIM.ISOVIST
subType
-
Stores the type enumerator for this element.
Type
- Overrides:
-
:BIM.SYSTEM
systems
-
The building system(s) this element contributes to or draws from.
Systems essentially categorise elements based on the purpose they serve. The can be holding the building up, delivering water, clearing waste, conducting electricity or managing operations. They can also be used to differentiate between different domains of interest, professions or trades. For example, a wall is part of the structural system, a sink is part of the plumbing system, a light fitting is part of the electrical system, and a radiator is part of the HVAC system.
Elements can belong to multiple systems, for example a heating boiler is part of both the plumbing and HVAC systems. This property is therefore a bitwise OR combination of the different
BIM.SYSTEMenumerators.Type
- Inherited From:
- Overrides:
-
:boolean
trackSpaceBoundary
-
Whether or not to check for path alignment relationships with parent space path, defaults to false.
When true and belonging to a parent space, the element checks each of its path junctions to see if they are coincident with the host space boundary path junctions or lie along any of its boundary segments. If a coincident or inline relationship is found, a
BIM.Relationis created and stored on both the element and space junctions. This allows the space to update each element when it is moved and the user to remove the link by simply moving the element junction away from the space boundary.This value is primarily intended for use by elements such as cupboards, switches, sockets, radiators, wall lights and other fixtures that are typically mounted on or against walls and need to track/update their position relative to the space boundary as it changes.
Type
- boolean
- Inherited From:
- Overrides:
-
:BIM.Component|null
typeComponent
-
A type component reference.
This is typically determined by the
subTypeproperty and assigned when a new instance is created.Different entity types use type components differently, and some not at all. However, the referenced component typically defines a sub-type for the entity and either influences or entirely dictates its overall parametric form or shape. For example, a wall can reference a
BIM.Wallstype component, which defines its thickness, surface properties and material layers via aBIM.Construction. A chair references aBIM.Chairstype component to actually generate the entire geometry of each chair instance as laid out by its path junctions.Type
- BIM.Component | null
- Inherited From:
- Overrides:
-
:string
typeDisplayName <readonly>
-
Retrieves the display name of this element or its assigned type component.
Type
- string
- Inherited From:
- Overrides:
-
:number
updateSpeed <readonly>
-
Determines the dynamic update speed.
Some point calculations can be quite expensive, so it is really up to the user to determine how frequently they want each data point to update when it or the model changes. This setting is element-based rather than global as there may be some specific points that the user wants to drag around and need to update more frequently, and others that are more static.
You can also set this value using the
setUpdateSpeed()method.The potential values for update speed are as follows:
- 0: Manual update only (use button).
- 1: Slow updates (250ms).
- 2: Fast updates (50ms).
- 3: Real-time updates (0ms).
Type
- number
- Inherited From:
- Overrides:
-
:string
uuid
-
A universally unique identifier for the item instance.
Type
- string
- Inherited From:
- Overrides:
-
:boolean
visible
-
Whether or not the entity is visible within the model.
The framework tries its best to avoid rendering invisible entities, but depending on the type of entity and how it is represented, this may not always be possible. For example, not rendering a chair is
Type
- boolean
- Inherited From:
- Overrides:
-
:boolean
wasRebuilt
-
Stores whether or not the element's geometry has recently been rebuilt, which may affect the host level's geometry.
This value must be set to
truewhenever the element's geometry changes and is used by the host level to determine if it needs to update level geometry as a result. The host level itself will reset this value tofalseonce it has processed the change, so no other method or action anywhere should ever set this value to anything other thantrue.NOTE: It is the responsibility of the element's own
update()method to set this value to true when calling itsrebuild()method. The reason this is not left to therebuild()method is that virtually every element subclass requires its own specificrebuild()method to generate its geometry, making this one of the most overridden methods in the entire framework. Thus, to avoid the risk of having custom class developers forget to set this flag in every single overriddenrebuild()method, it is left to theupdate()method which is overridden far less often and is also responsible for managing other element state such as thehasChangedflag.Type
- boolean
- Inherited From:
- Overrides:
-
:number
RESULTS_ANGLE <static>
-
The index of the horizontal angle in radians from the isovist forward direction to the ray intersection point in each entry within the
calculationResultsarray.Type
- number
Example
/// Accessing the angle value from the first ray result. const firstRayAngle = isoVist.calculationResults[0][BIM.IsoVist.RESULTS_ANGLE];
-
:number
RESULTS_DISTANCE <static>
-
The index of the distance from the isovist center to the ray intersection point in each entry within the
calculationResultsarray.Type
- number
Example
/// Accessing the distance from center to XY coordinates from the first ray result. const firstRayDistance = isoVist.calculationResults[0][BIM.IsoVist.RESULTS_DISTANCE];
-
:number
RESULTS_FRACTION <static>
-
The index of the distance fraction (0 to 1) from the isovist center to the ray intersection point in each entry within the
calculationResultsarray.Type
- number
Example
/// Accessing the fractional distance from center to XY coordinates from the first ray result. const firstRayFraction = isoVist.calculationResults[0][BIM.IsoVist.RESULTS_FRACTION];
-
:number
RESULTS_SIZE <static>
-
The number of entries in each result array within the
calculationResultsarray.Type
- number
Example
/// Accessing the size of each ray result array. const rayResultSize = BIM.IsoVist.RESULTS_SIZE;
-
:number
RESULTS_TRANSMITTANCE <static>
-
The index of the visible light transmittance (0 to 1) at the ray intersection point in each entry within the
calculationResultsarray.Type
- number
Example
/// Accessing the transmittance value from the first ray result. const firstRayTransmittance = isoVist.calculationResults[0][BIM.IsoVist.RESULTS_TRANSMITTANCE];
-
:number
RESULTS_VIEW_FACTOR <static>
-
The index of the view angle factor (0 to 1) for the ray segment in each entry within the
calculationResultsarray.Type
- number
Example
/// Accessing the view factor from the first ray result. const firstRayViewFactor = isoVist.calculationResults[0][BIM.IsoVist.RESULTS_VIEW_FACTOR];
-
:number
RESULTS_X <static>
-
The index of the X-axis ray intersection position in each entry within the
calculationResultsarray.Type
- number
Example
/// Accessing the X-axis position from the first ray result. const firstRayX = isoVist.calculationResults[0][BIM.IsoVist.RESULTS_X];
-
:number
RESULTS_Y <static>
-
The index of the Y-axis ray intersection position in each entry within the
calculationResultsarray.Type
- number
Example
/// Accessing the Y-axis position from the first ray result. const firstRayY = isoVist.calculationResults[0][BIM.IsoVist.RESULTS_Y];
-
:object
icon <static>
-
The icon associated with this class in the
PD.Registry.See
PD.Base.iconfor more information on this object format.Type
- object
Methods
-
addEventListeners()
-
Adds event listeners required by this data point.
- Inherited From:
- Overrides:
Returns:
Returns this point instance to support method chaining.
- Type
- BIM.DataPoint
-
addJunction(junction [, contour_index] [, ordinal_index])
-
Adds a new junction at the given index within the given contour.
Parameters:
Name Type Argument Description junctionBIM.Junction The junction to be inserted.
contour_indexnumber <optional>
The ordinal index of the path contour to insert the junction in, defaults to 0.
ordinal_indexnumber <optional>
The ordinal index of the junction within the specified contour, defaults to the end.
- Inherited From:
- Overrides:
Throws:
-
Throws an exception if the element has no path.
- Type
- Error
Returns:
Returns true if a new vertex was successfully inserted.
- Type
- boolean
-
calculate()
-
Performs view distance calculation(s) for the isovist.
- Inherited From:
- Overrides:
Returns:
Returns this isovist instance to support method chaining.
- Type
- BIM.IsoVist
-
checkJunctionRelationships(space, junctions)
-
Checks the element for junction relationships.
This method is only called on elements when their
BIM.Element#trackSpaceBoundaryproperty is true.Parameters:
Name Type Description spaceBIM.Space The parent space of the element.
junctionsBIM.Junction The junction to check for relationships for.
- Inherited From:
- Overrides:
-
checkToSelectElementByRay(selection)
-
Checks if the given ray intersects this element, but don't actually select it yet.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if the element should/would be selected, otherwise false.
- Type
- boolean
-
clearSelection()
-
Deselects the element path and all its points.
- Inherited From:
- Overrides:
Returns:
Returns this path to support method chaining.
- Type
- BIM.Element
-
clone()
-
Creates a copy of this instance with different name and uuid.
- Inherited From:
- Overrides:
Returns:
Returns a new instance with copied values.
- Type
- PD.Base | null
-
closestPoint3D(snapper, ray, test_pt)
-
Checks for points in the element path near the 3D ray.
Parameters:
Name Type Description snapperPD.Snapper The snap helper object.
rayTHREE.Ray The ray through the 3D cursor.
test_ptTHREE.Vector3 The point to find the closest snap to.
- Inherited From:
- Overrides:
Returns:
Returns true if a feature in the element was found and added to the snapper, otherwise false.
- Type
- boolean
-
closestPointOnAperture(snapper, ray, point [, selected_aperture])
-
Checks for points in the element path near the 3D ray.
Parameters:
Name Type Argument Default Description snapperPD.Snapper The snap helper object.
rayTHREE.Ray The ray through the 3D cursor.
pointTHREE.Vector3 The point to find the closest snap to.
selected_apertureBIM.Aperture <optional>
null The currently selected aperture, defaults to null.
- Inherited From:
- Overrides:
Returns:
Returns true if a feature in an aperture was found and added to the snapper, otherwise false.
- Type
- boolean
-
closestPointXY(snapper, test_pt)
-
Checks for points in the element path near the given point in the XY plane.
Parameters:
Name Type Description snapperPD.Snapper The snap helper object.
test_ptTHREE.Vector3 The point to find the closest snap to.
- Inherited From:
- Overrides:
Returns:
Returns true if a feature in the element was found and added to the snapper, otherwise false.
- Type
- boolean
-
computeHeight()
-
Calculates the absolute height of the element.
Default element heights vary wildly. For example, a structural wall should run from the top of the floor slab of its level to the bottom of the floor slab of the level above, whereas an internal partition should run from the top of the floor slab to the bottom of the ceiling on its level. A kitchen cabinet should default to around 900mm or 36", but you may want a built-in cabinet to be full floor-to-ceiling height.
To support this, element heights can be given as either absolute model units (mm) or as a fractional value (0 to 1). The role of this method is to detect any fractional values and convert them to absolute values relative to the value returned by the
BIM.Element#getReferenceHeightmethod.- Inherited From:
- Overrides:
Returns:
Returns the calculated height of the element.
- Type
- number
-
computeMetrics()
-
Computes the area and perimeter of the computed isovist shape, as well as a range of derived metrics.
This method uses the ray intersection points stored in the
calculationResultsarray to calculate the area and perimeter of the visible shape formed by the isovist rays. It also computes several other metrics including occluded fraction, average distance to obstructions, circularity, and drift.The area is calculated using Heron's formula for each triangle formed between consecutive ray intersection points and the center of the isovist. The perimeter is computed by summing the distances between consecutive ray intersection points, weighted by their view angle factors.
The computed metrics are stored in the
metricsobject for later use. If there are no calculation results, the metrics are invalidated (this.metrics.valid == false).Internally, this method calls the static
BIM.IsoVist.computeMetricsmethod to perform the calculations, passing in the isovist center, maximum radius, calculation results and metrics object.Returns:
Returns true if calculation results are available and metrics were successfully computed, otherwise false.
- Type
- boolean
-
deleteAttribute(name)
-
Removes an attribute from this entity.
Parameters:
Name Type Description namestring The name of the attribute to remove.
- Inherited From:
- Overrides:
Returns:
Returns this entity to support method chaining.
- Type
- PD.Base
-
dimension(mesh, size)
-
Adds dimension lines around an element when selected.
Parameters:
Name Type Description meshPD.PolyMesh The mesh to render to.
sizenumber The size of dimension in model units.
- Inherited From:
- Overrides:
Returns:
Returns true if anything was added to the mesh.
- Type
- boolean
-
ensureValidBRep()
-
Retrieves the element's boundary representation (BRep), ensuring that it has a valid one.
If the element does not currently have a BRep, this method will create a new empty one and assign it to it. If it does have a BRep, it is simply returned. If you do not want to create a new BRep if one does not already exist, simply access the
brepproperty instead.- Inherited From:
- Overrides:
Returns:
Returns the element's BRep, creating one if necessary.
- Type
- PD.BRep
Example
/// Rather than using: const brep = element.brep; if (!brep) { element.brep = new PD.BRep(); } /// You can simply use: const brep = element.ensureValidBRep(); /// Now safe to use `brep` without having to check if it exists first. -
ensureValidPath()
-
Retrieves the element's path, ensuring that it has a valid one.
If the element does not currently have a path, this method will create a new empty one and assign it to it. If it does have a path, it is simply returned. If you do not want to create a new path if one does not already exist, simply access the
pathproperty instead.If a new path is created, the element's
hasChangedproperty is also set to true to indicate that the element needs to be updated.- Inherited From:
- Overrides:
Returns:
Returns the element's path, creating one if necessary.
- Type
- BIM.Path
Example
/// Rather than using: const path = element.path; if (!path) { element.path = new BIM.Path(); } /// You can simply use: const path = element.ensureValidPath(); /// Now safe to use `path` without having to check if it exists first. -
ensureValidShell()
-
Retrieves the element's shell, ensuring that it has a valid one.
If the element does not currently have a shell, this method will create a new empty one and assign it to it. If it does have a shell, it is simply returned. If you do not want to create a new shell if one does not already exist, simply access the
shellproperty instead.- Inherited From:
- Overrides:
Returns:
Returns the element's shell, creating one if necessary.
- Type
- PD.Shell
Example
/// You can simply use: const shell = element.ensureValidShell(); /// Now safe to use `shell` without having to check if it exists first. /// Rather than using: const shell = element.shell; if (!shell) { element.shell = new PD.Shell(); } -
findApertureByRay(selection)
-
Checks if the given ray intersects any apertures belonging to this element and, if so, updates the selection with the intersected aperture details.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if an aperture in the element was selected and the selection updated, otherwise false.
- Type
- boolean
-
findAperturesByFrustum(selection)
-
Searches for apertures inside the given frustum and, if found, adds them to the selection.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if any apertures within the element were added to the selection, otherwise false.
- Type
- boolean
-
findBRepByFrustum(selection)
-
Checks if element's boundary representation is inside the frustum and updates the selection.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if the boundary of the element was selected and the selection updated, otherwise false.
- Type
- boolean
-
findBRepEdgeByRay(selection)
-
Checks if the given ray intersects a boundary edge in this element and updates the selection.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if a boundary edge within the element was selected and the selection updated, otherwise false.
- Type
- boolean
-
findBRepFaceByRay(selection)
-
Checks if the given ray intersects a boundary facet in this element and updates the selection.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if a boundary facet within the element was selected and the selection updated, otherwise false.
- Type
- boolean
-
findBRepVertexByRay(selection)
-
Checks if the given ray intersects a BRep vertex in this element and updates the selection.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if a boundary vertex within the element was selected and the selection updated, otherwise false.
- Type
- boolean
-
findByFrustum(selection)
-
Checks if element is inside frustum and updates the selection.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if a path segment in the element was selected and the selection updated, otherwise false.
- Type
- boolean
-
findFacetByRay(selection [, front])
-
Checks if the given ray intersects any shell facets belonging to this element's path junctions and, if found, updates the selection with the intersected facet details.
Parameters:
Name Type Argument Description selectionPD.Selection The interactive selection accumulator.
frontTHREE.Vector3 <optional>
An optional position that must be in front of the plane.
- Inherited From:
- Overrides:
Returns:
Returns true if a path segment in the element was selected and the selection updated, otherwise false.
- Type
- boolean
-
findJunctionByRay(selection)
-
Checks if the given ray hits or passes close to any junctions and, if found, updates the selection with the closest junction details.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if a vertex in the element was selected and the selection updated, otherwise false.
- Type
- boolean
-
findJunctionsByFrustum(selection)
-
Searches for path junctions inside frustum and, if found, adds them to the selection.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if any junctions within the element path were added to the selection, otherwise false.
- Type
- boolean
-
findSegmentByRay(selection [, shallow])
-
Checks if the given ray hits or passes close to any path segments and, if found, updates the selection with the closest segment details.
Parameters:
Name Type Argument Default Description selectionPD.Selection The interactive selection accumulator.
shallowboolean <optional>
false When true, only segments checked, not any aperture elements.
- Inherited From:
- Overrides:
Returns:
Returns true if a path segment in the element was selected and the selection updated, otherwise false.
- Type
- boolean
-
findSegmentsByFrustum(selection)
-
Searches for path segments inside the given frustum and, if found, adds them to the selection.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if any segments within the element path were added to the selection, otherwise false.
- Type
- boolean
-
getAttribute(name)
-
Retrieve an attribute stored on this entity, if it exists.
Parameters:
Name Type Description namestring The name of the attribute to retrieve.
- Inherited From:
- Overrides:
Returns:
Returns the attribute value, or undefined if it does not exist.
- Type
- any | undefined
-
getJunctionParameters(junction)
-
Provides a list of parameter groups for the given element junction.
This methods provides each element an opportunity to store junction-specific parameters that can be used when generating their geometry. Exactly what these parameters are will depend on the nature of each element. For example, a cabinet may allow each junction to define the height of its segment and whether it has swinging doors, sliding doors or open shelves. A tree on the other hand, may allow each junction to override any of the procedural tree parameters as well as defining a rotation angle and relative scale.
See the
PD.Base#getDynamicParametersmethod for more details.Parameters:
Name Type Description junctionBIM.Junction The junction to create dynamic parameters for.
- Inherited From:
- Overrides:
Returns:
Returns an array of
PD.ParamGroupobjects.- Type
- Array
-
getReferenceHeight()
-
Calculates the reference height for this element.
The default height for typical elements is either the element's bounding space height or the height of the level on which it sits. This method determines which of those values to use.
- Inherited From:
- Overrides:
Returns:
Returns the reference height for this element.
- Type
- number
-
getTypeComponentParameters()
-
Provides a list of component parameter groups for this element.
See the
PD.Base#getDynamicParametersmethod for more details.- Inherited From:
- Overrides:
Returns:
Returns an array of
PD.ParamGroupobjects.- Type
- Array
-
handleAfterMove( [junction])
-
Called when a transformation sequence has completed.
This method will always be called as part of a sequence, which starts with
handleBeforeMove, followed by one or more calls tohandleMove,handleMoveByQuaternionorhandleMoveByMatrixand finishes withhandleAfterMove.If the
trackSpaceBoundaryproperty is true, and the element is owned by a space, the element's path junctions will be checked and their relationships updated.Parameters:
Name Type Argument Description junctionBIM.Junction <optional>
If moving a single junction, that junction.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
handleBeforeMove()
-
Initialises reference positions just prior to an interactive drag.
For safety and stability, interactive movement is done using an absolute drag vector, matrix or quaternion rather than incrementally each frame. Thus the main function of this method is to store reference positions for all parts of the element that will move as part of an interactive drag or transform.
This method will always be called as part of a sequence, which starts with
handleBeforeMove, followed by one or more calls tohandleMove,handleMoveByQuaternionorhandleMoveByMatrixand finishes withhandleAfterMove.- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
handleMove(vector)
-
Moves the element by the given vector from its reference position(s).
This method will always be called as part of a sequence, which starts with
handleBeforeMove, followed by one or more calls tohandleMoveand finishes withhandleAfterMove.Parameters:
Name Type Description vectorTHREE.Vector The absolute direction vector of the current drag.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
handleMoveByMatrix(matrix [, about])
-
Transforms the element by applying the given matrix from its reference position(s).
This method will always be called as part of a sequence, which starts with
handleBeforeMove, followed by one or more calls tohandleMoveByMatrix and finishes withhandleAfterMove`.Parameters:
Name Type Argument Description matrixTHREE.Matrix4 The transform matrix to apply to the path.
aboutTHREE.Vector3 <optional>
An optional point about which to apply the transform.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
handleMoveByQuaternion(quat [, about])
-
Rotates the element by applying the given quaternion from its reference position(s).
This method will always be called as part of a sequence, which starts with
handleBeforeMove, followed by one or more calls tohandleMoveByQuaternionand finishes withhandleAfterMove.Parameters:
Name Type Argument Description quatTHREE.Quaternion The quaternion to apply.
aboutTHREE.Vector3 <optional>
An optional point about which to apply the transform.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
handleOnCursorMove(new_pos, cursor [, junction])
-
Provides an opportunity for elements to constrain cursor movements.
This method is called whenever an interactive cursor is moved with this element selected. If one of the element's junctions is selected, it will be included as the last argument. If the element itself is being moved, the last argument will be undefined.
The default implementation simply returns
false. Override this method to perform whatever checking is required and modifynew_posto constrain the movement.Parameters:
Name Type Argument Default Description new_posTHREE.Vector3 The proposed new position of the cursor.
cursorPD.Cursor The cursor that is being interactively dragged.
junctionBIM.Junction <optional>
null The junction that is being dragged, if selected.
- Inherited From:
- Overrides:
Returns:
Returns
trueif the point was changed, otherwisefalse.- Type
- boolean
-
handleOnCursorSelect(cursor [, junction])
-
Provides an opportunity for elements to initialise the cursor when selected.
This method is called whenever the element or one of its junction is selected. If one of the element's junctions is selected, it will be included as the last argument. If the element itself is selected, the 'junction' argument will be null.
The default implementation simply calls the
cursor.clearRotation()method. Override it to orient the cursor as appropriate.Parameters:
Name Type Argument Default Description cursorPD.Cursor The cursor that is being interactively dragged.
junctionBIM.Junction <optional>
null The junction that was selected, defaults to
null.- Inherited From:
- Overrides:
Returns:
Returns
trueif the cursor orientation was changed.- Type
- boolean
-
handleOnJunctionChange()
-
Provides an opportunity for elements to react to junction property changes.
- Inherited From:
- Overrides:
-
highlight(mesh, view)
-
Renders a highlighted view of the element to show it as selected.
Parameters:
Name Type Description meshPD.PolyMesh The selection mesh to render highlighting to.
viewPD.ViewData The view definition to render the model within.
- Overrides:
Returns:
Returns true if anything was added to the mesh.
- Type
- boolean
-
intersectExtents(ray, intersection)
-
Determines if the given ray intersects the entity extents.
Parameters:
Name Type Description rayTHREE.Ray The ray to find the intersection for.
intersectionTHREE.Vector3 The vector to store the intersection point, if any.
- Inherited From:
- Overrides:
Returns:
Returns the
intersectionpoint, or null if no intersection.- Type
- THREE.Vector3 | null
-
invalidate()
-
Hides the display mesh when the isovist becomes invalid.
This method is called whenever the isovist data changes in a way that invalidates the current calculation results and metrics, such as when the model changes or the isovist element itself is modified.
- Inherited From:
- Overrides:
Returns:
Returns this isovist instance to support method chaining.
- Type
- BIM.IsoVist
-
mounted(parent)
-
Called when the isovist is added to a space or level.
Parameters:
Name Type Description parentBIM.Level | BIM.Space The level or space that the element was added to.
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
moveByMatrix4(matrix)
-
Transforms the element by applying the matrix to it.
NOTE: This is not an interactive method that is part of a transform sequence. Rather it is one that is meant to reposition, scale and/or rotate the element with a single call. As such, it first calls
BIM.Element#handleBeforeMoveon the element, followed byBIM.Element#handleMoveByMatrixand thenBIM.Element#handleAfterMove.Parameters:
Name Type Description matrixTHREE.Matrix4 The transform matrix to apply to the element.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Path
-
moveByVector3(vector)
-
Move the element by a relative vector.
NOTE: This is not an interactive method that is part of a move sequence. Rather it is one that is meant to reposition the element with a single call. As such, it first calls
BIM.Element#handleBeforeMoveon the element, followed byBIM.Element#handleMoveand thenBIM.Element#handleAfterMove.Parameters:
Name Type Description vectorTHREE.Vector3 The relative movement vector.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Path
-
moveJunctionListByVector(list, vector [, undo])
-
Moves the list of junctions within the element.
This method is used when dragging one or more junctions and during the undo/redo of that process. It checks for any specific settings or rules (such as a rectangular shape) and tries to comply whenever possible.
Parameters:
Name Type Argument Description listArray.<BIM.Junction> A list of one or more junctions belonging to this element.
vectorTHREE.Vector3 The movement vector to apply.
undoboolean <optional>
Whether or not this is being called by undo/redo.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
moveSegmentListByVector(list, vector [, undo])
-
Moves the list of path segments within the element.
This method is used when dragging one or more segments and during the undo/redo of that process. It checks for any specific settings or rules (such as a rectangular shape) and tries to comply whenever possible.
Parameters:
Name Type Argument Description listArray.<BIM.Junction> A list of one or more segments belonging to this element.
vectorTHREE.Vector3 The movement vector to apply.
undoboolean <optional>
Whether or not this is being called by undo/redo.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
removeEventListeners()
-
Removes any active event listeners set by this data point.
- Inherited From:
- Overrides:
Returns:
Returns this point instance to support method chaining.
- Type
- BIM.DataPoint
-
removeJunction(junction [, contour_index])
-
Removes a junction from the element path.
If the contour or ordinal index is not given, the path will be searched for the given point.
Parameters:
Name Type Argument Description junctionBIM.Junction The junction to be removed.
contour_indexnumber <optional>
The ordinal index of the path contour to remove the junction from.
- Inherited From:
- Overrides:
Returns:
Returns the index of the junction removed, or -1.
- Type
- number
-
renderBoundaryRepresentation(mesh, view)
-
Renders the boundary representation of the element if it has one.
Parameters:
Name Type Description meshPD.PolyMesh The mesh to render the boundary representation to.
viewPD.ViewData The view definition to render the model within.
- Inherited From:
- Overrides:
Returns:
Returns true if anything was added to the mesh.
- Type
- boolean
-
renderExtraShellToMesh(shell, mesh, view, level)
-
Renders the given shell to the given mesh using the same handling of
viewas in the element's own shell.NOTE: This method must only be called from somewhere within the
BIM.Element#rendermethod of the subclassed element. Otherwise any additions to the shell won't make it to the canvas as they will be overridden on the next render when the shell is reinitialised.Parameters:
Name Type Description shellPD.Shell The shell to render.
meshPD.PolyMesh The mesh to add shell geometry to.
viewPD.ViewData The view definition to render the model within.
levelBIM.Level The level currently being rebuilt and rendered.
- Inherited From:
- Overrides:
Returns:
Returns true if anything was added to the mesh.
- Type
- boolean
-
renderShell(meshes, view, level)
-
An alternative render method to support furnishing and fixtures.
This is a utility method that subclasses can use instead fo the default render method. It renders the shell of the element and not its path.
Parameters:
Name Type Description meshesBIM.Meshes The collection of meshes to render to.
viewPD.ViewData The view definition to render the model within.
levelBIM.Level The level currently being rebuilt and rendered.
- Inherited From:
- Overrides:
Returns:
Returns true if anything was added to any mesh.
- Type
- boolean
-
selectedSnapBehavior(selMan)
-
Provides the base snap behavior when an element is selected and dragged.
By default, the element will snap to the junctions of its outer path boundary, if it has one. If you would like your element to snap against something other than its path, you can override this method.
See also
snapPointToPath.If you do override this method, the following example shows the default snap behavior as a basis for you to use.
Parameters:
Name Type Description selManPD.SelectionManager The selection manager that is handling the snap.
- Inherited From:
- Overrides:
Example
selectedSnapBehavior(selMan) { /// Temporarily show the snap paths of other elements as /// dotted lines so you can see what you are snapping to. selMan.showSnapPaths = true; /// Don't use the dragged cursor as a snap point /// as the element centroid is often not relevant. selMan.snapper.directSnap = false; if (this.path) { /// Snap to each boundary point. for (const junction of this.path.getContour(0)) { selMan.modelManager.snapLineToNearestElement(selMan.snapper, junction, selMan.selectionSet); } } }; -
setAttribute(name, value)
-
Stores an attribute on this entity, or replaces it's existing value.
Parameters:
Name Type Description namestring The name of the attribute to store.
valuestring The attribute value to store.
- Inherited From:
- Overrides:
Returns:
Returns this entity to support method chaining.
- Type
- PD.Base
-
setExtents(bbox)
-
Set the 3D extents of the element as a bounding box.
Override this method in bounding box driven building elements such as equipment, imported or parametric meshes to rescale or regenerate their underlying geometry whenever it changes.
Parameters:
Name Type Description bboxTHREE.Box3 The new bounding box extents to set.
- Inherited From:
- Overrides:
Returns:
Returns this entity to support method chaining.
- Type
- PD.Base
-
setUpdateSpeed(speedType)
-
Sets the type of interactive update speed when the data point is being interactively moved or the model edited.
Some point calculations can be quite expensive, so it is really up to the user to determine how frequently they want each data point to update when it or the model changes. This setting is element-based rather than global as there may be some specific points that the user wants to drag around and need to update more frequently, and others that are more static.
The
speedTypeparameter can have the following values.- 0: Manual updates only (use button).
- 1: Slow updates (250ms).
- 2: Fast updates (100ms).
- 3: Instant updates (0ms).
Parameters:
Name Type Description speedTypenumber The type of update speed (0 to 3).
- Inherited From:
- Overrides:
-
snapPointToPath(snapper, test_pt)
-
Checks for points to snap to within the element path.
Parameters:
Name Type Description snapperPD.Snapper The snap helper object.
test_ptTHREE.Vector3 The point to find the closest snap.
- Inherited From:
- Overrides:
Returns:
Returns true if a feature in the element was found and added to the snapper, otherwise false.
- Type
- boolean
-
unmounted(parent)
-
Called when the isovist is removed from a space or level.
Parameters:
Name Type Description parentBIM.Level | BIM.Space The level or space that the element was just removed from.
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
update( [forceUpdate])
-
Updates the element and checks to rebuild its geometry.
Elements should override this method to implement whatever custom logic is required to determine if their geometry needs to be rebuilt. If so, then this method should call the element's own
rebuild()method before returning. It is also an opportunity for the element to modify its ownextents.The default implementation checks the
hasChangedflags on both the element itself and itspath. If either are set to true, the element'srebuild()method is called before both flags are cleared. This is suitable for most elements as the editor will set the path changed flag whenever it is changed and the dynamic parameter system will update the element's changed flag whenever a value is changed.The default implementation sets the element's bounding box to match its path extents and adds the element's
heightproperty if non-zero.NOTE: All overridden versions of this method must set the element's
hasChangedandwasRebuiltproperties appropriately when calling therebuild()method, as shown in the example below. When rebuilt, thehasChangedproperty must be set tofalseand thewasRebuiltproperty must be set totrue.Parameters:
Name Type Argument Description forceUpdateboolean <optional>
Whether or not to update even if element has not changed, defaults to false.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
Example
update(forceUpdate) { const path = this.path; if (path) { path.element = this; if (forceUpdate || path.hasChanged) { this.hasChanged = true; if (forceUpdate) path.hasChanged = true; path.update(); } /// Use path extents as the default for the element extents. this.extents.copy(path.extents); if (!PD.Utils.closeToZero(this.height)) { const extents = this.extents; if (this.height < 0) extents.min.z = Math.min(extents.min.z, this.height); else extents.max.z = Math.max(extents.max.z, this.height); } } if (forceUpdate || this.hasChanged) { this.hasChanged = false; // ? <-- IMPORTANT: Must clear this flag when rebuilt. this.wasRebuilt = true; // ? <-- IMPORTANT: Must set this flag when rebuilt. this.rebuild(); } return this; }; -
updateRelativeHeight()
-
Updates the element's computed height if it is given as a relative value rather than an absolute dimension.
- Inherited From:
- Overrides:
Returns:
Returns true if the computed height changed, otherwise false.
- Type
- boolean
-
usesJunctionOrientation(junction)
-
Determines if this element responds to the orientation of the given junction.
This implementation returns true if the junction has no previous or next junctions, indicating it is a single point. This allows the isovist to use the junction's orientation when positioning the view direction. When more than one junction is present, the orientation is computed from the first two points in the path instead.
Parameters:
Name Type Description junctionBIM.Junction The junction to apply the logic to.
- Inherited From:
- Overrides:
Returns:
Return true to show a rotation cursor manipulator.
- Type
- boolean
-
computeMetrics(center, radius, calcResults [, metrics]) <static>
-
Computes the area and perimeter of a computed isovist shape, as well as a range of derived metrics.
This method uses the ray intersection points stored in the given
calcResultsarray to calculate the area and perimeter of the visible shape formed by the isovist rays. It also computes several other metrics including occluded fraction, average distance to obstructions, circularity, and drift.The area is calculated using Heron's formula for each triangle formed between consecutive ray intersection points and the center of the isovist. The perimeter is computed by summing the distances between consecutive ray intersection points, weighted by their view angle factors.
The computed metrics are stored in the given
metricsobject If there are no calculation results, the metrics are invalidated (metrics.valid == false).Parameters:
Name Type Argument Description centerTHREE.Vector3 The center point of the isovist in model space.
radiusnumber The maximum radius to calculate distances for in mm.
calcResultsArray An array of calculation results, in the same format as the
calculationResultsarray.metricsObject <optional>
An object to store the computed metrics, in the same format as the
metricsobject.Returns:
Returns true if calculation results are available and metrics were successfully computed, otherwise false.
- Type
- boolean
-
getClassDescription() <static>
-
A brief description of this class to accompany its icon.
Returns:
Returns a brief description.
- Type
- string
-
getClassName() <static>
-
The name of this class within the
PD.Registry.See
PD.Base.getClassNamefor more details as this is required for use with thePD.Registry.Returns:
Returns the registered name of this class.
- Type
- string
-
getEntityType() <static>
-
Defines the type of BIM entity this class represents.
See
BIM.Entity.getEntityTypefor more details as this is required for use with thePD.Registry.Returns:
Returns the BIM entity type this class represents.
- Type
- BIM.ENTITY