CorePlotting::SpatialLayoutStrategy
CorePlotting::SpatialLayoutStrategy
Spatial layout strategy (SpatialOverlay style). More…
#include <SpatialLayoutStrategy.hpp>
Public Types
| Name | |
|---|---|
| enum class | Mode { Fit, Fill, Identity} Layout mode for fitting data into viewport. |
Public Functions
| Name | |
|---|---|
| SpatialLayoutStrategy() =default Construct with default mode (Fit). |
|
| SpatialLayoutStrategy(Mode mode) Construct with specific mode. |
|
| SpatialLayoutResponse | compute(BoundingBox const & data_bounds, BoundingBox const & viewport_bounds, float padding =0.0f) const Compute spatial layout transform. |
| LayoutResponse | computeFromRequest(LayoutRequest const & request) const Compute layout using standard LayoutRequest interface. |
Detailed Description
class CorePlotting::SpatialLayoutStrategy;Spatial layout strategy (SpatialOverlay style).
Computes coordinate transforms to fit spatial data (points, lines, masks) into a viewport. Unlike time-series layouts which only stack vertically, spatial layouts transform both X and Y coordinates.
LAYOUT MODES:
- Fit: Scale uniformly to fit data bounds into viewport (preserves aspect ratio)
- Fill: Scale non-uniformly to fill entire viewport (may distort aspect ratio)
- Identity: No transform (1:1 mapping, useful when data is already in viewport coords)
COORDINATE SYSTEM:
- Input coordinates are in data space (e.g., image pixels, sensor coordinates)
- Output coordinates are in viewport space (typically -1 to +1 NDC or 0 to width/height)
- Padding adds margin around data bounds
USE CASES:
- SpatialOverlay: Whisker visualization, mask overlay
- Image annotation: Points/lines over image coordinates
- Direct spatial data: Sensor readings with X/Y positions
Public Types Documentation
enum Mode
| Enumerator | Value | Description |
|---|---|---|
| Fit | Uniform scale to fit (preserves aspect ratio). | |
| Fill | Non-uniform scale to fill (may distort). | |
| Identity | No transform (1:1 mapping). |
Layout mode for fitting data into viewport.
Public Functions Documentation
function SpatialLayoutStrategy
SpatialLayoutStrategy() =defaultConstruct with default mode (Fit).
function SpatialLayoutStrategy
inline explicit SpatialLayoutStrategy(
Mode mode
)Construct with specific mode.
function compute
SpatialLayoutResponse compute(
BoundingBox const & data_bounds,
BoundingBox const & viewport_bounds,
float padding =0.0f
) constCompute spatial layout transform.
Parameters:
- data_bounds Bounding box of the data to display
- viewport_bounds Target viewport bounds
- padding Relative padding (0.0 = no padding, 0.1 = 10% padding)
Return: Spatial layout with transform
Calculates the transform to map data bounds into viewport bounds.
function computeFromRequest
LayoutResponse computeFromRequest(
LayoutRequest const & request
) constCompute layout using standard LayoutRequest interface.
Note: Prefer compute(BoundingBox, BoundingBox, float) for spatial data.
For compatibility with ILayoutStrategy interface. Uses viewport from request and assumes single series with data bounds in metadata.
Updated on 2026-11-13 at 20:25:42 +0000