# Api - PointGraph Class

A graph of items which may be located on the same points.

• PointGraph

## Properties

### graph

graph: object

Map of unique points by x, then y, to a point id. This will remain intact even after merging.

### index

index: object

Index of points by id.

### insertedCount

insertedCount: number

Number of points inserted

### merged

merged: object

Map of point ids which once existed but have been merged into another id due to close proximity.

### values

values: T[]

List of values inserted at points.

## Methods

### forEachPoint

• forEachPoint(cb: function): void
• Iterate over points in the index.

#### Parameters

• ##### cb: function

Callback for each point in the index.

### getElementAtPoint

• Get the index element of a point, after merging.

#### Parameters

• ##### p: IPoint

Point to look up index element.

### getIdOfPoint

• getIdOfPoint(p: IPoint): number
• Gets the id of a point, after merging.

#### Parameters

• ##### p: IPoint

Point to look up id.

### insertValue

• insertValue(value: T): number
• Insert a value.

#### Parameters

• ##### value: T

Value associated with this point.

#### Returns number

valueId of the inserted value.

### insertValueIdAtPoint

• insertValueIdAtPoint(valueId: number, p: IPoint): object
• Insert a value at a point.

Point.

### mergeNearestSinglePoints

• mergeNearestSinglePoints(withinDistance: number): void
• 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.

### mergePoints

• mergePoints(withinDistance: number): void
• Merge points within a given distance from each other. Call this after inserting values.

#### Parameters

• ##### withinDistance: number

Distance to consider points equal.

### reset

• reset(): void
• Reset the stored points, graphs, lists, to initial state.

## Legend

• Module
• Object literal
• Variable
• Function
• Function with type parameter
• Index signature
• Type alias
• Enumeration
• Enumeration member
• Property
• Method
• Interface
• Interface with type parameter
• Constructor
• Property
• Method
• Index signature
• Class
• Class with type parameter
• Constructor
• Property
• Method
• Accessor
• Index signature
• Inherited constructor
• Inherited property
• Inherited method
• Inherited accessor
• Protected property
• Protected method
• Protected accessor
• Private property
• Private method
• Private accessor
• Static property
• Static method

Generated using TypeDoc