This module provides the mesh functionality for the Geoflo application. It allows users to create a mesh of features by splitting them into segments and checking for intersections.
Methods
-
static addNewFeatures(features) → {Array}
-
This function takes new features, splits them into segments, checks for intersections, and updates the existing segments accordingly.
Parameters:
Name Type Description features
Array An array of new features to be added. Returns:
Array - Returns an array containing all mesh segments. -
static getFeatureById(id) → {object}
-
Retrieves a feature by its ID.
Parameters:
Name Type Description id
number The ID of the feature to retrieve. Returns:
object - The feature object corresponding to the provided ID. -
static getFeatures() → {Array}
-
Returns all of the features in the mesh.
Returns:
Array - Returns an array containing all feature segments. -
static getFeaturesByParentId(id) → {Array}
-
Retrieves features based on the parent ID. The parent ID is used to retrieve cold features associated with the segment.
Parameters:
Name Type Description id
number The parent ID to retrieve features for. Returns:
Array - - An array of features associated with the parent ID. -
static getFeaturesFromIndex(features) → {Array}
-
This function takes an array of features and retrieves the corresponding features from an index based on their IDs.
Parameters:
Name Type Description features
Array The array of features to retrieve from the index. Returns:
Array - The array of features retrieved from the index. -
static removeFeature(id) → {boolean}
-
Removes a feature with the specified ID.
Parameters:
Name Type Description id
number The ID of the feature to be removed. Returns:
boolean - - Returns true if the feature was successfully removed, false otherwise. -
static splitSegmentAtPoint(segmentId, pointCoords)
-
This function takes a segment ID and coordinates of a point to split the segment. It creates two new segments by splitting the original segment at the specified point and updates the feature index.
Parameters:
Name Type Description segmentId
string The ID of the segment to be split. pointCoords
Array.<number> The coordinates of the point where the segment should be split.