new SubSurfaces(element, hostJunction, linkedJunctions)
Creates a new relationship between a host junction and one or more tracking junctions.
Parameters:
| Name | Type | Description |
|---|---|---|
element |
BIM.Element | The element that contains the junction. |
hostJunction |
BIM.Junction | The junction to add the sub-surfaces to. |
linkedJunctions |
Array.<BIM.Junction> | An array of one or more junctions that lie along the junction segment. |
Throws:
-
Throws an error if the host junction is not a valid junction.
- Type
- Error
Extends
Members
-
:BIM.Element
hostElement
-
The element hosting the items in the relationship.
Type
- Inherited From:
- Overrides:
-
:BIM.Junction
hostJunction
-
The junction that owns the virtual junction.
Type
-
:boolean
isActive
-
Whether or not the relationship is active.
Type
- boolean
- Inherited From:
- Overrides:
-
:boolean
isRelation <readonly>
-
A flag identifying this object as a relationship.
Type
- boolean
- Inherited From:
- Overrides:
-
:Array.<BIM.Junction>
linkedJunctions
-
The junction(s) that should be tracked by virtual junction(s).
Type
- Array.<BIM.Junction>
-
:BIM.Junction
nextJunction
-
The non-virtual junction the host junction connects to in the path.
Type
-
:number
type
-
The type of relationship.
Type
- number
- Inherited From:
- Overrides:
-
:BIM.Junction
virtualJunctions
-
The virtual junction added to monitor the tracked junction.
Type
Methods
-
addSubSurfaces(linkedJunctionArray [, update])
-
Adds new virtual junctions to generate sub-surfaces for each tracked junction.
Parameters:
Name Type Argument Default Description linkedJunctionArrayArray.<BIM.Junction> An array of one or more junctions that lie along the junction segment.
updateboolean <optional>
true Whether or not to update affected junctions, defaults to true.
Returns:
Returns true if there were sub-surfaces added to the host.
- Type
- boolean
-
cleanUpCache()
-
Cleans up any virtual junctions that have been unused for more than 5 min.
This method is typically called as part of a
requestIdleCallbackto release memory that is unlikely to be reused.Returns:
Returns this relationship to support method chaining.
-
clear()
-
Frees up all memory associated with this relationship.
It is not necessary to call this method when you delete a relationship as it will be garbage collected in due course. However, doing so will free all references in arrays and the cache immediately.s
Returns:
Returns this relationship to support method chaining.
-
findNewJunctions(linkedJunctions)
-
Compares the new junction list with the existing tracked junctions.
This method returns an array of new junctions that are not already being tracked by the host junction. If the returned array is empty, then the two arrays already contain the same junctions.
Parameters:
Name Type Description linkedJunctionsArray.<BIM.Junction> An array of one or more junctions that lie along the junction segment.
Returns:
Returns an array of new junctions not already being tracked.
- Type
- Array.<BIM.Junction>
-
removeSubSurface(virtualJunction)
-
Removes the given sub-surface virtual junction from host junction.
Given the dynamic nature of adding and removing virtual junctions, this method keeps a copy of previously generated virtual junctions in a cache so that they can be immediately reused if added again.
Parameters:
Name Type Description virtualJunctionBIM.Junction The virtual junction to remove.
Returns:
Returns true if the sub-surface was successfully removed from the host.
- Type
- boolean
-
removeSubSurfaces()
-
Clears all sub-surfaces and associated virtual junctions from host junction.
Given the dynamic nature of adding and removing virtual junctions, this method keeps a copy of previously generated virtual junctions in a cache so that they can be immediately reused if added again.
Returns:
Returns true if there were sub-surfaces cleared from the host.
- Type
- boolean
-
sortJunctionsByDistance(linkedJunctionArray)
-
Sorts the array of tracked junctions in order of increasing distance from host junction.
This method returns an array of [junction,distance] pairs for each valid junction in sorted order.
Parameters:
Name Type Description linkedJunctionArrayArray.<BIM.Junction> An array of one or more junctions that lie along the junction segment.
Returns:
Returns an array of [junction,distance] arrays, sorted in order of increasing distance from host junction.
- Type
- Array.<Array.<BIM.Junction, distance>>
-
stillValid()
-
Checks that the relationship is still valid.
- Inherited From:
- Overrides:
Returns:
Returns true if the relationship is still valid.
- Type
- boolean
-
update(element [, junction])
-
Updates the relationship.
Any party to the relationship should be able to update the relationship by calling this method with itself as the argument.
Parameters:
Name Type Argument Description elementBIM.Element The element that is updating the relationship.
junctionBIM.Junction <optional>
An optional junction that is updating the relationship.
- Inherited From:
- Overrides:
Returns:
Returns true if something changed and needs updating.
- Type
- boolean
-
updateSubSurfaces(linkedJunctions)
-
Parameters:
Name Type Description linkedJunctionsArray.<BIM.Junction> An array of one or more junctions that lie along the junction segment.