new Region() → {Region}
Provides a hierachical structure to objects, Each region
may contain multiple child regions and ZincObject.
Returns:
- Type
- Region
Methods
addZincObject(zincObject)
Add a zinc object into this region, the morph will be added
to the group.
Parameters:
Name | Type | Description |
---|---|---|
zincObject |
ZincObject | Zinc object to be added into this region. |
checkPickableUpdateRequred(transverse) → {Boolean}
Return true if pickable objects require an update.
Parameters:
Name | Type | Description |
---|---|---|
transverse |
Boolean | Check child regions as well if this is set to true. |
Returns:
- Type
- Boolean
clear(transverse)
Clear and dispose all objects belong to this region.
Parameters:
Name | Type | Description |
---|---|---|
transverse |
Boolean | Clear and dispose child regions as well if this is set to true. |
createChild(nameIn) → {Region}
Create a new child region with the provided name.
Parameters:
Name | Type | Description |
---|---|---|
nameIn |
String | Name to be set for the new child region. |
Returns:
- Type
- Region
createChildFromPath(path) → {Region}
Create a new child using the path. All required new regions
down the path will be created.
Parameters:
Name | Type | Description |
---|---|---|
path |
String | Relative paths from the region to the child region. |
Returns:
- Type
- Region
createChildFromSeparatedPath(pathArray) → {Region}
Create a new child using the path array. All required new regions
down the path will be created.
Parameters:
Name | Type | Description |
---|---|---|
pathArray |
Array | Array containing regions' name, new regions will be created along the path if not found. |
Returns:
- Type
- Region
createGeometryFromThreeJSGeometry()
Add a new geometry
createLines()
Update geometries and glyphsets based on the calculated time.
createPoints()
Update geometries and glyphsets based on the calculated time.
findChildFromPath(path) → {Region}
Find the region using the provided relative path.
Parameters:
Name | Type | Description |
---|---|---|
path |
String | Relative paths from this region to the child region. |
Returns:
- Type
- Region
findChildFromSeparatedPath(pathArray) → {Region}
Find a child region using the path array.
Parameters:
Name | Type | Description |
---|---|---|
pathArray |
Array | Array containing regions' name at each hierarchy to match. |
Returns:
- Type
- Region
findGeometriesWithGroupName(groupName, transverse) → {Array}
Find and return all geometries in this and child regions with
the matching GroupName.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
String | Groupname to match with. |
transverse |
Boolean | Also look for the object with groupName in child regions if set to true. |
Returns:
- Type
- Array
findGlyphsetsWithGroupName(groupName, transverse) → {Array}
Find and return all glyphsets in this and child regions with
the matching groupName.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
String | Groupname to match with. |
transverse |
Boolean | Also look for the object with groupName in child regions if set to true. |
Returns:
- Type
- Array
findLinesWithGroupName(groupName, transverse) → {Array}
Find and return all lines in this and child regions with
the matching groupName.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
String | Groupname to match with. |
transverse |
Boolean | Also look for the object with groupName in child regions if set to true. |
Returns:
- Type
- Array
findObjectsWithGroupName(groupName, transverse) → {Array}
Find and return all zinc objects in this and child regions with
the matching GroupName.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
String | Groupname to match with. |
transverse |
Boolean | Also look for the object with groupName in child regions if set to true. |
Returns:
- Type
- Array
findOrCreateChildFromPath(path) → {Region}
Return existing region if it exists, otherwise, create a new
region with the provided path.
Parameters:
Name | Type | Description |
---|---|---|
path |
String | Relative paths from the region to the child region. |
Returns:
- Type
- Region
findPointsetsWithGroupName(groupName, transverse) → {Array}
Find and return all pointsets in this and child regions with
the matching groupName.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
String | Groupname to match with. |
transverse |
Boolean | Also look for the object with groupName in child regions if set to true. |
Returns:
- Type
- Array
forEachGeometry(callbackFunction, transverse)
A function which iterates through the list of geometries and call the callback
function with the geometries as the argument.
Parameters:
Name | Type | Description |
---|---|---|
callbackFunction |
function | Callback function with the geometry as an argument. |
transverse |
Boolean | Also perform the same callback function for all child regions if this is set to be true. |
forEachGlyphset(callbackFunction, transverse)
A function which iterates through the list of glyphsets and call the callback
function with the glyphset as the argument.
Parameters:
Name | Type | Description |
---|---|---|
callbackFunction |
function | Callback function with the glyphset as an argument. |
transverse |
Boolean | Also perform the same callback function for all child regions if this is set to be true. |
forEachLine(callbackFunction, transverse)
A function which iterates through the list of lines and call the callback
function with the lines as the argument.
Parameters:
Name | Type | Description |
---|---|---|
callbackFunction |
function | Callback function with the lines as an argument. |
transverse |
Boolean | Also perform the same callback function for all child regions if this is set to be true. |
forEachPointset(callbackFunction, transverse)
A function which iterates through the list of pointsets and call the callback
function with the pointset as the argument.
Parameters:
Name | Type | Description |
---|---|---|
callbackFunction |
function | Callback function with the pointset as an argument. |
transverse |
Boolean | Also perform the same callback function for all child regions if this is set to be true. |
getAllObjects(transverse) → {Array}
Get all zinc objects in this region.
Parameters:
Name | Type | Description |
---|---|---|
transverse |
Boolean | Include zinc objects in child regions if this is set to true. |
Returns:
- Type
- Array
getBoundingBox() → {THREE.Box3}
Get the bounding box of all the object in this and child regions only.
Do not include the matrix transformation here, it is done at the primitives
level.
Returns:
- Type
- THREE.Box3
getChildRegions(transverse) → {Array}
Get all child regions.
Parameters:
Name | Type | Description |
---|---|---|
transverse |
Boolean | Include all regions which are descendants of this reigon when this is set to true. |
Returns:
- Type
- Array
getChildWithName(childName) → {Region}
Get the child region with matching childName.
Parameters:
Name | Type | Description |
---|---|---|
childName |
String | Name to be matched. |
Returns:
- Type
- Region
getCurrentTime() → {Number}
Get the current time of the region.
Return -1 if no graphics in the region.
Returns:
- Type
- Number
getDuration()
Get the default duration value.
returns {Number}
getFullPath() → {String}
Get the full paths from the root region to this region.
Returns:
- Type
- String
getFullSeparatedPath() → {Array}
Get the array of each hierarachy from the root region to this region.
Returns:
- Type
- Array
getGroup() → {THREE.Group}
Get the {THREE.Group} containing all child regions and their
primitives.
Returns:
- Type
- THREE.Group
getName() → {String}
Get the name of this region.
Returns:
- Type
- String
getParent() → {Region}
Get the parent region.
Returns:
- Type
- Region
getPickableThreeJSObjects()
Get all pickable objects.
getVisibility() → {Boolean}
Get the visibility of the region and its children.
Returns:
- Type
- Boolean
hideAllPrimitives()
Hide all primitives belong to this region.
isTimeVarying() → {Boolean}
Check if any object in this region is time varying.
Returns:
- Type
- Boolean
objectIsInRegion(zincObject, transverse) → {Boolean}
Check if a zincObject is a member of this region.
Parameters:
Name | Type | Description |
---|---|---|
zincObject |
ZincObject | The ZincObject to be checked. |
transverse |
Boolean | Also check the child regions. |
Returns:
- Type
- Boolean
removeZincObject(zincObject)
Remove a ZincObject from this region if it presents. This will eventually
destroy the object and free up the memory.
Parameters:
Name | Type | Description |
---|---|---|
zincObject |
ZincObject | object to be removed from this region. |
setDuration(durationIn)
Set the default duration value for all zinc objects
that are to be loaded into this region.
Parameters:
Name | Type | Description |
---|---|---|
durationIn |
Number | duration of the scene. |
setMorphTime(time, transverse)
Set the current time of all the objects of this region.
Parameters:
Name | Type | Description |
---|---|---|
time |
Number | Value to set the time to. |
transverse |
Boolean | Set the time for chidl regions if this is set to true. |
setName(nameIn)
Set the name of this region.
Parameters:
Name | Type | Description |
---|---|---|
nameIn |
String | Name to be set for this region. It must be defined and non-empty. |
setTransformation(transformation)
Set the transformation with a {THREE.Matrix4} matrix, this will affect
all primitives in this and its child regions
Parameters:
Name | Type | Description |
---|---|---|
transformation |
THREE.Matrix4 | The transformation matrix used for the transformation. |
setVisibility(flag)
Set the visibility and propagate it down the hierarchies
depending on the flag.
Parameters:
Name | Type | Description |
---|---|---|
flag |
Boolean | A flag indicating either the visibilty to be on/off. |
showAllPrimitives()
Show all primitives belong to this region.