Methods
(async) createEdge(nodeAId, nodeBId) → {EdgeRef}
Create a new edge between two nodes.
Order of node IDs does not matter.
Parameters:
Name | Type | Description |
---|---|---|
nodeAId |
number | The ID of one of the nodes on the edge. |
nodeBId |
number | The ID of the other node on the edge. |
- Source:
Returns:
A reference to the new edge.
- Type
- EdgeRef
(async) createEntity(type) → {EntityRef}
Create a new entity in the backend.
Parameters:
Name | Type | Description |
---|---|---|
type |
string | Type of the new entity. |
- Source:
Returns:
- Type
- EntityRef
(async) createNode(parentId, nodeType) → {NodeRef}
Creates a new "node" entity.
Parameters:
Name | Type | Description |
---|---|---|
parentId |
number | undefined | ID of the parent node, or undefined if the node has no parent. |
nodeType |
string | Type of the node. "object" or "point". |
- Source:
Returns:
- Type
- NodeRef
(async) entityExists() → {boolean}
Check if an entity exists.
- Source:
Returns:
- Type
- boolean
(async) flush()
Flush the backend to storage.
This may happen automatically, but flush forces it.
Has a default implementation that does nothing.
- Source:
getBackendVersionNumber() → {number}
Get the latest backend version number. Implementation defined. Must be greater than zero.
- Source:
Returns:
- Type
- number
(async, generator) getConnectedNodes(nodeRef) → {AsyncIterable.<NodeRef>}
Get all nodes connected to the specified node by one level of edges (that is, one edge).
Has a default implementation based on #getNodeEdges().
Parameters:
Name | Type | Description |
---|---|---|
nodeRef |
NodeRef | The node to search for connections on. |
- Source:
Returns:
The connected nodes.
- Type
- AsyncIterable.<NodeRef>
getDirEdgeRef(id, startId) → {DirEdgeRef}
Create a DirEdgeRef to an edge in this backend, starting from the specified node.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | The ID of the edge to get. |
startId |
number | The ID of a node attached to this edge. |
- Source:
Returns:
Starting from the specified start ID.
- Type
- DirEdgeRef
getEdgeBetween(nodeAId, nodeBId) → {EdgeRef}
Get the edge between two nodes, if it exists.
Parameters:
Name | Type | Description |
---|---|---|
nodeAId |
number | The ID of one of the nodes on the edge to find. |
nodeBId |
number | The ID of the other node on the edge to find. |
- Source:
Returns:
- Type
- EdgeRef
(async) getEdgeNodes() → {AsyncIterable.<NodeRef>}
Get the two nodes attached to an edge, in no particular order.
- Source:
Returns:
- Type
- AsyncIterable.<NodeRef>
(async) getEdgeOtherNode(edgeId, nodeId) → {NodeRef}
Given an edge and one of the nodes on the edge, get the other node on the edge.
Parameters:
Name | Type | Description |
---|---|---|
edgeId |
number | |
nodeId |
number | Has a default implementation based on #getEdgeNodes(). |
- Source:
Returns:
- Type
- NodeRef
getEdgeRef()
Create an EdgeRef to an edge in this backend.
- Source:
getEntityRef()
Create an EntityRef to an entity in this backend.
Use getNodeRef, getEdgeRef, or getDirEdgeRef for greater type-specific functionality if the entity is a node or edge.
- Source:
(async, generator) getIntersectingEdges(edgeRef, blendDistance) → {AsyncIterable.<EdgeRef>}
Get all edges within a specified blend distance that intersect with the given edge.
Has a default implementation based on #getNodesInArea() and #NodeRef.getEdges().
Parameters:
Name | Type | Description |
---|---|---|
edgeRef |
EdgeRef | The edge to search for intersections on. |
blendDistance |
number | How far out to search for intersections? (Necessary to avoid searching the entire map.) |
- Source:
Returns:
Each intersecting edge found.
- Type
- AsyncIterable.<EdgeRef>
(async, generator) getNearbyNodes(nodeRef, blendDistance) → {AsyncIterable.<NodeRef>}
Get all nearby nodes within a specified blend distance of the specified node.
Has a default implementation based on #getNodesInArea().
Parameters:
Name | Type | Description |
---|---|---|
nodeRef |
NodeRef | The node that is the spatial center of the search. |
blendDistance |
number | How far out to look for nodes? (Necessary to avoid searching the entire map.) |
- Source:
Returns:
All the discovered nodes. Does not include the original node.
- Type
- AsyncIterable.<NodeRef>
(async) getNodeChildren() → {AsyncIterable.<NodeRef>}
Get all direct children of a node.
- Source:
Returns:
- Type
- AsyncIterable.<NodeRef>
(async) getNodeEdges() → {AsyncIterable.<EdgeRef>}
Get all edges attached to a node.
- Source:
Returns:
- Type
- AsyncIterable.<EdgeRef>
(async) getNodeParent() → {NodeRef|null}
Get the parent node of a node by ID, or null if the node has no parent.
- Source:
Returns:
- Type
- NodeRef | null
getNodeRef()
Create a NodeRef to a node in this backend.
- Source:
getNodesInArea(box) → {AsyncIterable.<NodeRef>}
Get all nodes within a spatial box.
Parameters:
Name | Type | Description |
---|---|---|
box |
Box3 | The box to find nodes within. |
- Source:
Returns:
- Type
- AsyncIterable.<NodeRef>
(async) getNodeType() → {string}
Get a node's type.
- Source:
Returns:
- Type
- string
getObjectNodesTouchingArea(box, minRadius) → {AsyncIterable.<NodeRef>}
Get all nodes in or near a spatial box (according to their radii).
Parameters:
Name | Type | Description |
---|---|---|
box |
Box3 | The box to find nodes within or near. |
minRadius |
number | The minimum radius of nodes to return. |
- Source:
Returns:
- Type
- AsyncIterable.<NodeRef>
(async) getPNumber() → {number}
Get a number property on an entity.
Has a default implementation based on string properties.
- Source:
Returns:
- Type
- number
(async) getPString() → {string}
Get a string property on an entity.
- Source:
Returns:
- Type
- string
(async) getPVector3() → {Vector3}
Get a Vector3 property on an entity.
Has a default implementation based on string properties.
- Source:
Returns:
- Type
- Vector3
getVersionNumber() → {number}
Get the database version number. Implementation defined.
- Source:
Returns:
- Type
- number
(async) nodeHasChildren() → {boolean}
Check if a node has any children.
Has a default implementation based on #getNodeChildren().
- Source:
Returns:
- Type
- boolean
(async) removeEdge()
Remove an edge from the backend.
Has a default implementation that just removes the entity.
- Source:
(async) removeEntity()
Remove an entity from the backend.
This method should work to remove any entity.
However, calling code should use #removeEdge() and #removeNode() when applicable instead, for potential optimization purposes.
- Source:
(async) removeNode()
Remove a node from the backend.
Has a default implementation that just removes the entity.
- Source:
(async) setPNumber()
Set a number property on an entity.
Has a default implementation based on string properties.
- Source:
(async) setPString()
Set a string property on an entity.
- Source:
(async) setPVector3()
Set a Vector3 property on an entity.
Has a default implementation based on string properties.
- Source: