CorePlotting::SpatialMapper
CorePlotting::SpatialMapper
Mapper for spatial data (SpatialOverlay-style visualization). More…
Functions
| Name | |
|---|---|
| std::vector< MappedElement > | mapPointsAtTime(PointData const & points, TimeFrameIndex time, float x_scale =1.0f, float y_scale =1.0f, float x_offset =0.0f, float y_offset =0.0f) Map points at a specific time to world-space positions (materialized). |
| MappedElement | mapPoint(Point2D< float > const & point, EntityId entity_id, float x_scale =1.0f, float y_scale =1.0f, float x_offset =0.0f, float y_offset =0.0f) Map a single Point2D to MappedElement. |
| template <std::ranges::input_range R> auto |
mapPoints(R const & points, std::function< EntityId(size_t)> get_entity_id, float x_scale =1.0f, float y_scale =1.0f, float x_offset =0.0f, float y_offset =0.0f) Map a range of Point2D to MappedElement range. |
| std::vector< OwningLineView > | mapLinesAtTime(LineData const & lines, TimeFrameIndex time, float x_scale =1.0f, float y_scale =1.0f, float x_offset =0.0f, float y_offset =0.0f) Map lines at a specific time to line views. |
| OwningLineView | mapLine(Line2D const & line, EntityId entity_id, float x_scale =1.0f, float y_scale =1.0f, float x_offset =0.0f, float y_offset =0.0f) Map a single Line2D to a line view. |
| auto | mapLineLazy(Line2D const & line, EntityId entity_id, float x_scale =1.0f, float y_scale =1.0f, float x_offset =0.0f, float y_offset =0.0f) Create a lazy line view (no vertex materialization). |
| template <MappedElementRange R> std::vector< EntityId > |
extractEntityIds(R const & elements) Extract entity IDs from a range of mapped elements. |
| template <MappedElementRange R> std::vector< glm::vec2 > |
extractPositions(R const & elements) Extract positions from a range of mapped elements. |
| std::vector< MappedElement > | mapAllPoints(PointData const & points, float x_scale =1.0f, float y_scale =1.0f, float x_offset =0.0f, float y_offset =0.0f) Flatten all points across all time frames into a single vector. |
| std::vector< OwningLineView > | mapAllLines(LineData const & lines, float x_scale =1.0f, float y_scale =1.0f, float x_offset =0.0f, float y_offset =0.0f) Flatten all lines across all time frames into a single vector. |
| std::vector< TimedMappedElement > | mapPointsInWindow(PointData const & points, TimeFrameIndex center, int behind, int ahead, float x_scale =1.0f, float y_scale =1.0f, float x_offset =0.0f, float y_offset =0.0f) Map points within a temporal window around a center time. |
| std::vector< TimedOwningLineView > | mapLinesInWindow(LineData const & lines, TimeFrameIndex center, int behind, int ahead, float x_scale =1.0f, float y_scale =1.0f, float x_offset =0.0f, float y_offset =0.0f) Map lines within a temporal window around a center time. |
| std::vector< TimedOwningLineView > | mapMaskContoursInWindow(MaskData const & masks, TimeFrameIndex center, int behind, int ahead, float x_scale =1.0f, float y_scale =1.0f, float x_offset =0.0f, float y_offset =0.0f) Map mask contours within a temporal window around a center time. |
Detailed Description
Mapper for spatial data (SpatialOverlay-style visualization).
Transforms spatial data (PointData, LineData) directly to world-space coordinates. Unlike TimeSeriesMapper, X and Y coordinates come directly from the data’s spatial coordinates, not from time conversion.
This mapper is used for:
- SpatialOverlay: displaying points, lines, masks over video frames
- Scatter plots: displaying point clouds
- Any visualization where X/Y are spatial, not temporal
All methods return ranges for zero-copy single-traversal consumption.
Functions Documentation
function mapPointsAtTime
inline std::vector< MappedElement > mapPointsAtTime(
PointData const & points,
TimeFrameIndex time,
float x_scale =1.0f,
float y_scale =1.0f,
float x_offset =0.0f,
float y_offset =0.0f
)Map points at a specific time to world-space positions (materialized).
Parameters:
- points Point data source
- time Current time frame index
- x_scale X coordinate scale (e.g., for aspect ratio correction)
- y_scale Y coordinate scale
- x_offset X offset applied after scaling
- y_offset Y offset applied after scaling
Return: Vector of MappedElement
Extracts points from PointData at the given time frame index and transforms to world coordinates with optional scaling. Returns a vector since we need to zip data and entity IDs together.
function mapPoint
inline MappedElement mapPoint(
Point2D< float > const & point,
EntityId entity_id,
float x_scale =1.0f,
float y_scale =1.0f,
float x_offset =0.0f,
float y_offset =0.0f
)Map a single Point2D to MappedElement.
Parameters:
- point Source point
- entity_id Entity identifier
- x_scale X coordinate scale
- y_scale Y coordinate scale
- x_offset X offset
- y_offset Y offset
Return: MappedElement with transformed coordinates
Direct conversion with scaling/offset.
function mapPoints
template <std::ranges::input_range R>
inline auto mapPoints(
R const & points,
std::function< EntityId(size_t)> get_entity_id,
float x_scale =1.0f,
float y_scale =1.0f,
float x_offset =0.0f,
float y_offset =0.0f
)Map a range of Point2D to MappedElement range.
Parameters:
- points Range of points
- get_entity_id Function to get EntityId for each point (called with index)
- x_scale X coordinate scale
- y_scale Y coordinate scale
- x_offset X offset
- y_offset Y offset
Template Parameters:
- R Range type yielding Point2D
Return: Range of MappedElement
function mapLinesAtTime
inline std::vector< OwningLineView > mapLinesAtTime(
LineData const & lines,
TimeFrameIndex time,
float x_scale =1.0f,
float y_scale =1.0f,
float x_offset =0.0f,
float y_offset =0.0f
)Map lines at a specific time to line views.
Parameters:
- lines Line data source
- time Current time frame index
- x_scale X coordinate scale
- y_scale Y coordinate scale
- x_offset X offset
- y_offset Y offset
Return: Vector of OwningLineView (vertices materialized for stable iteration)
Each line in LineData at the given time becomes an OwningLineView with transformed vertices.
function mapLine
inline OwningLineView mapLine(
Line2D const & line,
EntityId entity_id,
float x_scale =1.0f,
float y_scale =1.0f,
float x_offset =0.0f,
float y_offset =0.0f
)Map a single Line2D to a line view.
Parameters:
- line Source line
- entity_id Entity identifier for this line
- x_scale X coordinate scale
- y_scale Y coordinate scale
- x_offset X offset
- y_offset Y offset
Return: OwningLineView with transformed vertices
Creates an OwningLineView from a Line2D with coordinate transformation.
function mapLineLazy
inline auto mapLineLazy(
Line2D const & line,
EntityId entity_id,
float x_scale =1.0f,
float y_scale =1.0f,
float x_offset =0.0f,
float y_offset =0.0f
)Create a lazy line view (no vertex materialization).
Parameters:
- line Source line
- entity_id Entity identifier
- x_scale X coordinate scale
- y_scale Y coordinate scale
- x_offset X offset
- y_offset Y offset
Return: MappedLineView with lazy transformation
For cases where you want to iterate once without storing vertices. The returned view applies transforms lazily during iteration.
function extractEntityIds
template <MappedElementRange R>
inline std::vector< EntityId > extractEntityIds(
R const & elements
)Extract entity IDs from a range of mapped elements.
Parameters:
- elements Range of mapped elements
Template Parameters:
- R Range type ([MappedElementRange])
Return: Vector of EntityId
Utility for building spatial indices.
function extractPositions
template <MappedElementRange R>
inline std::vector< glm::vec2 > extractPositions(
R const & elements
)Extract positions from a range of mapped elements.
Parameters:
- elements Range of mapped elements
Template Parameters:
- R Range type ([MappedElementRange])
Return: Vector of glm::vec2 positions
Utility for building glyph batches.
function mapAllPoints
inline std::vector< MappedElement > mapAllPoints(
PointData const & points,
float x_scale =1.0f,
float y_scale =1.0f,
float x_offset =0.0f,
float y_offset =0.0f
)Flatten all points across all time frames into a single vector.
Parameters:
- points Point data source
- x_scale X coordinate scale
- y_scale Y coordinate scale
- x_offset X offset applied after scaling
- y_offset Y offset applied after scaling
Return: Vector of MappedElement containing all points across all times
Iterates every time frame that contains point data and maps all points at each time to world-space coordinates. The result is a single flat vector suitable for static rendering (TemporalProjectionView).
function mapAllLines
inline std::vector< OwningLineView > mapAllLines(
LineData const & lines,
float x_scale =1.0f,
float y_scale =1.0f,
float x_offset =0.0f,
float y_offset =0.0f
)Flatten all lines across all time frames into a single vector.
Parameters:
- lines Line data source
- x_scale X coordinate scale
- y_scale Y coordinate scale
- x_offset X offset applied after scaling
- y_offset Y offset applied after scaling
Return: Vector of OwningLineView containing all lines across all times
Iterates every time frame that contains line data and maps all lines at each time to world-space OwningLineViews. The result is a single flat vector suitable for static rendering (TemporalProjectionView).
function mapPointsInWindow
inline std::vector< TimedMappedElement > mapPointsInWindow(
PointData const & points,
TimeFrameIndex center,
int behind,
int ahead,
float x_scale =1.0f,
float y_scale =1.0f,
float x_offset =0.0f,
float y_offset =0.0f
)Map points within a temporal window around a center time.
Parameters:
- points Point data source
- center Center time frame index (current position)
- behind Number of time indices to look behind (positive value)
- ahead Number of time indices to look ahead (positive value)
- x_scale X coordinate scale
- y_scale Y coordinate scale
- x_offset X offset applied after scaling
- y_offset Y offset applied after scaling
Return: Vector of TimedMappedElement with temporal_distance set
Gathers points from [center - behind, center + ahead] and tags each with its signed temporal distance from center. Used by OnionSkinView for alpha-graded rendering.
function mapLinesInWindow
inline std::vector< TimedOwningLineView > mapLinesInWindow(
LineData const & lines,
TimeFrameIndex center,
int behind,
int ahead,
float x_scale =1.0f,
float y_scale =1.0f,
float x_offset =0.0f,
float y_offset =0.0f
)Map lines within a temporal window around a center time.
Parameters:
- lines Line data source
- center Center time frame index (current position)
- behind Number of time indices to look behind (positive value)
- ahead Number of time indices to look ahead (positive value)
- x_scale X coordinate scale
- y_scale Y coordinate scale
- x_offset X offset applied after scaling
- y_offset Y offset applied after scaling
Return: Vector of TimedOwningLineView with temporal_distance set
Gathers lines from [center - behind, center + ahead] and tags each with its signed temporal distance from center.
function mapMaskContoursInWindow
inline std::vector< TimedOwningLineView > mapMaskContoursInWindow(
MaskData const & masks,
TimeFrameIndex center,
int behind,
int ahead,
float x_scale =1.0f,
float y_scale =1.0f,
float x_offset =0.0f,
float y_offset =0.0f
)Map mask contours within a temporal window around a center time.
Parameters:
- masks Mask data source
- center Center time frame index (current position)
- behind Number of time indices to look behind (positive value)
- ahead Number of time indices to look ahead (positive value)
- x_scale X coordinate scale
- y_scale Y coordinate scale
- x_offset X offset applied after scaling
- y_offset Y offset applied after scaling
Return: Vector of TimedOwningLineView with temporal_distance set
Gathers masks from [center - behind, center + ahead], converts each to a contour polyline via MaskContourMapper, and tags each with its signed temporal distance from center.
Updated on 2026-11-13 at 20:25:42 +0000