CorePlotting::GapDetector
CorePlotting::GapDetector
Detects gaps in analog time series and produces segmented poly-line batches. More…
#include <GapDetector.hpp>
Public Classes
| Name | |
|---|---|
| struct | Config Configuration for gap detection. |
Public Functions
| Name | |
|---|---|
| GapDetector() =default | |
| GapDetector(Config const & config) | |
| void | setTimeThreshold(int64_t threshold) Set time-based gap threshold. |
| void | setValueThreshold(float threshold) Set value-based gap threshold. |
| void | setMinSegmentLength(int length) Set minimum segment length. |
| Config const & | getConfig() const Get current configuration. |
| RenderablePolyLineBatch | transform(AnalogTimeSeries const & series, TimeFrame const & time_frame, EntityId entity_id =EntityId(0)) const Transform analog time series into segmented poly-line batch. |
| RenderablePolyLineBatch | transform(std::vector< float > const & time_values, std::vector< float > const & data_values, EntityId entity_id =EntityId(0)) const Transform with explicit time and value arrays. |
| template <std::ranges::input_range Range> RenderablePolyLineBatch |
segmentByGaps(Range && vertices, Config const & config) Segment a range of MappedAnalogVertex by detecting gaps. |
| RenderablePolyLineBatch | segmentByGaps(std::vector< MappedAnalogVertex > const & vertices, Config const & config) Segment a vector of MappedAnalogVertex by detecting gaps. |
Detailed Description
class CorePlotting::GapDetector;Detects gaps in analog time series and produces segmented poly-line batches.
This transformer analyzes an AnalogTimeSeries for discontinuities (gaps) based on either:
- Time threshold: If time between samples exceeds threshold, insert gap
- Value threshold: If value change exceeds threshold, insert gap
The output is a RenderablePolyLineBatch with multiple line segments, where each segment is a contiguous portion of the signal without gaps.
USAGE: ```cpp
GapDetector detector; detector.setTimeThreshold(1000); // 1000 time units RenderablePolyLineBatch batch = detector.transform(series, time_frame, entity_id);
Or with range-based API for mapped vertices: ```cpp
auto mapped = TimeSeriesMapper::mapAnalogSeriesWithIndices(series, layout, tf, 1.0f, start, end);
auto batch = GapDetector::segmentByGaps(mapped, config);
Public Functions Documentation
function GapDetector
GapDetector() =defaultfunction GapDetector
explicit GapDetector(
Config const & config
)function setTimeThreshold
void setTimeThreshold(
int64_t threshold
)Set time-based gap threshold.
Parameters:
- threshold Maximum time between samples
function setValueThreshold
void setValueThreshold(
float threshold
)Set value-based gap threshold.
Parameters:
- threshold Maximum value change between samples
function setMinSegmentLength
void setMinSegmentLength(
int length
)Set minimum segment length.
Parameters:
- length Minimum number of samples per segment
function getConfig
inline Config const & getConfig() constGet current configuration.
function transform
RenderablePolyLineBatch transform(
AnalogTimeSeries const & series,
TimeFrame const & time_frame,
EntityId entity_id =EntityId(0)
) constTransform analog time series into segmented poly-line batch.
Parameters:
- series Source analog time series
- time_frame Time frame for converting indices to time
- entity_id EntityId for all segments (optional)
Return: Renderable batch with segmented geometry
function transform
RenderablePolyLineBatch transform(
std::vector< float > const & time_values,
std::vector< float > const & data_values,
EntityId entity_id =EntityId(0)
) constTransform with explicit time and value arrays.
Parameters:
- time_values Time values for each sample
- data_values Data values for each sample
- entity_id EntityId for all segments (optional)
Return: Renderable batch with segmented geometry
Useful when data is already in array form or for testing.
function segmentByGaps
template <std::ranges::input_range Range>
static RenderablePolyLineBatch segmentByGaps(
Range && vertices,
Config const & config
)Segment a range of MappedAnalogVertex by detecting gaps.
Parameters:
- vertices Range of MappedAnalogVertex to segment
- config Gap detection configuration
Template Parameters:
- Range Input range type (must yield MappedAnalogVertex)
Return: Renderable batch with segmented geometry
This is the preferred method for use with TimeSeriesMapper output. Uses the time_index field of MappedAnalogVertex for gap detection.
function segmentByGaps
static RenderablePolyLineBatch segmentByGaps(
std::vector< MappedAnalogVertex > const & vertices,
Config const & config
)Segment a vector of MappedAnalogVertex by detecting gaps.
Parameters:
- vertices Vector of MappedAnalogVertex to segment
- config Gap detection configuration
Return: Renderable batch with segmented geometry
Convenience overload for materialized vectors.
Updated on 2026-11-13 at 20:25:42 +0000