Api - PointGraph Class
Type parameters
-
T
Hierarchy
- PointGraph
Index
Constructors
Properties
Methods
Constructors
constructor
-
Returns PointGraph
Properties
graph
Map of unique points by x, then y, to a point id. This will remain intact even after merging.
Type declaration
-
[x: number]: object
-
[y: number]: number
-
index
Index of points by id.
Type declaration
-
[pointId: number]: IPointGraphIndexElement
insertedCount
Number of points inserted
merged
Map of point ids which once existed but have been merged into another id due to close proximity.
Type declaration
-
[pointId: number]: number
values
List of values inserted at points.
Methods
forEachPoint
-
Iterate over points in the index.
Parameters
-
cb: function
Callback for each point in the index.
-
-
Parameters
-
p: IPoint
-
values: T[]
-
Optional pointId: number
-
Optional el: IPointGraphIndexElement
Returns void
-
-
-
Returns void
-
getElementAtPoint
-
Get the index element of a point, after merging.
Parameters
-
p: IPoint
Point to look up index element.
Returns IPointGraphIndexElement
-
getIdOfPoint
-
Gets the id of a point, after merging.
Parameters
-
p: IPoint
Point to look up id.
Returns number
-
insertValue
-
Insert a value.
Parameters
-
value: T
Value associated with this point.
Returns number
valueId of the inserted value.
-
insertValueIdAtPoint
-
Insert a value at a point.
Parameters
-
valueId: number
-
p: IPoint
Point.
Returns object
-
existed: boolean
-
point
Id: number
-
mergeNearestSinglePoints
-
Finds all points which have only one value associated. Then, merge to the nearest other point within this set. Call this after inserting values.
Parameters
-
withinDistance: number
Distance to consider points equal.
Returns void
-
mergePoints
-
Merge points within a given distance from each other. Call this after inserting values.
Parameters
-
withinDistance: number
Distance to consider points equal.
Returns void
-
reset
-
Reset the stored points, graphs, lists, to initial state.
Returns void
Generated using TypeDoc
A graph of items which may be located on the same points.