OpenGLWidget
OpenGLWidget
#include <OpenGLWidget.hpp>
Inherits from QOpenGLWidget, QOpenGLFunctions
Public Slots
| Name | |
|---|---|
| void | updateCanvas() |
| void | updateCanvas(TimeFrameIndex time) |
| void | setLaneDragOverlay(bool active, float lane_center, float lane_extent, float marker_ndc_y) Set or clear the lane drag overlay drawn on top of the GL canvas. |
Public Signals
| Name | |
|---|---|
| void | mouseHover(float time_coordinate, float canvas_y, QString const & series_info) |
| void | mouseClick(float time_coordinate, float canvas_y, QString const & series_info) |
| void | entitySelectionChanged(EntityId entity_id, bool is_selected) Emitted when an entity is selected or deselected. |
| void | interactionModeChanged(InteractionMode mode) Emitted when the interaction mode changes. |
| void | interactionCompleted(CorePlotting::Interaction::DataCoordinates const & coords) Emitted when an interaction completes successfully. |
| void | sceneRebuilt() Emitted after the renderable scene is rebuilt. |
| void | frameRendered() Emitted after paintGL() completes. |
Public Functions
| Name | |
|---|---|
| OpenGLWidget(QWidget * parent =[nullptr]) | |
| ~OpenGLWidget() override | |
| void | addAnalogTimeSeries(std::string const & key, std::shared_ptr< AnalogTimeSeries > series, std::string const & color =““) |
| void | removeAnalogTimeSeries(std::string const & key) |
| void | addDigitalEventSeries(std::string const & key, std::shared_ptr< DigitalEventSeries > series, std::string const & color =““) |
| void | removeDigitalEventSeries(std::string const & key) |
| void | addDigitalIntervalSeries(std::string const & key, std::shared_ptr< DigitalIntervalSeries > series, std::string const & color =““) |
| void | removeDigitalIntervalSeries(std::string const & key) |
| void | clearSeries() |
| void | setState(std::shared_ptr< DataViewerState > state) Set the DataViewerState for this widget. |
| std::shared_ptr< DataViewerState > | stateShared() const Get the current DataViewerState as shared_ptr. |
| void | selectEntity(EntityId id) Select an entity by its EntityId. |
| void | deselectEntity(EntityId id) Deselect an entity by its EntityId. |
| void | toggleEntitySelection(EntityId id) Toggle selection state of an entity. |
| void | clearEntitySelection() Clear all selected entities. |
| bool | isEntitySelected(EntityId id) const Check if an entity is selected. |
| std::unordered_set< EntityId > const & | getSelectedEntities() const Get all selected entities. |
| void | setInteractionMode(InteractionMode mode) Set the current interaction mode. |
| InteractionMode | interactionMode() const Get the current interaction mode. |
| bool | isInteractionActive() const Check if any interaction is currently active. |
| void | cancelActiveInteraction() Cancel any active interaction. |
| CorePlotting::ViewStateData const & | getViewState() const Get the current view state. |
| std::string | getBackgroundColor() const |
| std::shared_ptr< TimeFrame > | getMasterTimeFrame() const |
| auto const & | getAnalogSeriesMap() const |
| auto const & | getDigitalEventSeriesMap() const |
| auto const & | getDigitalIntervalSeriesMap() const |
| void | setMasterTimeFrame(std::shared_ptr< TimeFrame > const & master_time_frame) Set the master time frame used for X-axis coordinates. |
| void | loadSpikeSorterConfiguration(std::string const & group_name, std::vector< ChannelPosition > const & positions, bool key_one_based =true, std::vector< std::string > group_keys ={}) Load spike sorter configuration for a group of analog series. |
| void | clearSpikeSorterConfiguration(std::string const & group_name) Clear spike sorter configuration for a group. |
| void | loadSpikeToAnalogPairing(std::string const & digital_group, std::string const & analog_group, std::vector< SpikeToAnalogPairing > const & pairings, SpikeToAnalogPlacementMode mode, SpikeToAnalogParseConfig const & config =SpikeToAnalogParseConfig, bool overlay_render_digital_events_as_boxes =false) Apply lane placement overrides based on spike-to-analog pairings. |
| std::pair< int, int > | getCanvasSize() const |
| void | setOverlayLaneBoundaries(bool enabled) Enable/disable lane boundary overlay lines. |
| void | setOverlayOriginMarkers(bool enabled) Enable/disable series origin marker overlay. |
| void | setOverlayCrosshair(bool enabled) Enable/disable cursor crosshair overlay. |
| DataViewerDiagnostics | getDiagnostics() const Collect a snapshot of layout and rendering diagnostics. |
| CorePlotting::LayoutResponse const & | layoutResponse() const Get the cached layout response. |
| float | canvasXToTime(float canvas_x) const |
| float | canvasYToAnalogValue(float canvas_y, std::string const & series_key) const |
| std::optional< std::pair< std::string, std::string > > | findSeriesAtPosition(float canvas_x, float canvas_y) const Find the series under the mouse cursor. |
| DataViewerState * | state() |
| DataViewerState const * | state() const |
Protected Functions
| Name | |
|---|---|
| void | initializeGL() override |
| void | paintGL() override |
| void | resizeGL(int w, int h) override |
| void | cleanup() |
| void | mousePressEvent(QMouseEvent * event) override |
| void | mouseMoveEvent(QMouseEvent * event) override |
| void | mouseReleaseEvent(QMouseEvent * event) override |
| void | mouseDoubleClickEvent(QMouseEvent * event) override |
| void | leaveEvent(QEvent * event) override |
Public Slots Documentation
slot updateCanvas
inline void updateCanvas()slot updateCanvas
void updateCanvas(
TimeFrameIndex time
)slot setLaneDragOverlay
void setLaneDragOverlay(
bool active,
float lane_center,
float lane_extent,
float marker_ndc_y
)Set or clear the lane drag overlay drawn on top of the GL canvas.
Parameters:
- active True while a drag is in progress
- lane_center NDC Y center of the lane being dragged
- lane_extent NDC Y height of the dragged lane
- marker_ndc_y NDC Y of the horizontal insertion-line marker
Called by DataViewer_Widget when MultiLaneVerticalAxisWidget emits laneDragOverlayChanged. Triggers an immediate repaint.
Public Signals Documentation
signal mouseHover
void mouseHover(
float time_coordinate,
float canvas_y,
QString const & series_info
)signal mouseClick
void mouseClick(
float time_coordinate,
float canvas_y,
QString const & series_info
)signal entitySelectionChanged
void entitySelectionChanged(
EntityId entity_id,
bool is_selected
)Emitted when an entity is selected or deselected.
Parameters:
- entity_id The EntityId that was selected/deselected
- is_selected true if selected, false if deselected
signal interactionModeChanged
void interactionModeChanged(
InteractionMode mode
)Emitted when the interaction mode changes.
Parameters:
- mode The new interaction mode
signal interactionCompleted
void interactionCompleted(
CorePlotting::Interaction::DataCoordinates const & coords
)Emitted when an interaction completes successfully.
Parameters:
- coords The data coordinates resulting from the interaction
The DataCoordinates contain all information needed to update the DataManager. Connect to this signal to handle the result of interactive operations.
signal sceneRebuilt
void sceneRebuilt()Emitted after the renderable scene is rebuilt.
The debug panel connects to this to refresh the lane table and rendering statistics. Only emitted when the scene is actually reconstructed (i.e. when layout was dirty), not on every repaint.
signal frameRendered
void frameRendered()Emitted after paintGL() completes.
Used by the debug panel to refresh live performance timing statistics.
Public Functions Documentation
function OpenGLWidget
explicit OpenGLWidget(
QWidget * parent =nullptr
)function ~OpenGLWidget
~OpenGLWidget() overridefunction addAnalogTimeSeries
void addAnalogTimeSeries(
std::string const & key,
std::shared_ptr< AnalogTimeSeries > series,
std::string const & color =""
)function removeAnalogTimeSeries
void removeAnalogTimeSeries(
std::string const & key
)function addDigitalEventSeries
void addDigitalEventSeries(
std::string const & key,
std::shared_ptr< DigitalEventSeries > series,
std::string const & color =""
)function removeDigitalEventSeries
void removeDigitalEventSeries(
std::string const & key
)function addDigitalIntervalSeries
void addDigitalIntervalSeries(
std::string const & key,
std::shared_ptr< DigitalIntervalSeries > series,
std::string const & color =""
)function removeDigitalIntervalSeries
void removeDigitalIntervalSeries(
std::string const & key
)function clearSeries
void clearSeries()function setState
void setState(
std::shared_ptr< DataViewerState > state
)Set the DataViewerState for this widget.
Parameters:
- state Shared pointer to the state object
The state manages all serializable settings including view state, theme, grid settings, and per-series display options. The UI modifies the state directly; OpenGLWidget reacts to state changes via signals.
function selectEntity
void selectEntity(
EntityId id
)Select an entity by its EntityId.
Parameters:
- id EntityId to select
Adds the entity to the selection set. Use with Ctrl+click for multi-select.
function deselectEntity
void deselectEntity(
EntityId id
)Deselect an entity by its EntityId.
Parameters:
- id EntityId to deselect
function toggleEntitySelection
void toggleEntitySelection(
EntityId id
)Toggle selection state of an entity.
Parameters:
- id EntityId to toggle
function clearEntitySelection
void clearEntitySelection()Clear all selected entities.
function isEntitySelected
bool isEntitySelected(
EntityId id
) constCheck if an entity is selected.
Parameters:
- id EntityId to check
Return: true if the entity is in the selection set
function getSelectedEntities
std::unordered_set< EntityId > const & getSelectedEntities() constGet all selected entities.
Return: Const reference to the selection set
function setInteractionMode
void setInteractionMode(
InteractionMode mode
)Set the current interaction mode.
Parameters:
- mode The new interaction mode
Changes how mouse events are interpreted. When switching modes, any active interaction is cancelled.
function interactionMode
InteractionMode interactionMode() constGet the current interaction mode.
function isInteractionActive
bool isInteractionActive() constCheck if any interaction is currently active.
Returns true if the widget is in the middle of creating or modifying a glyph (interval, line, etc.).
function cancelActiveInteraction
void cancelActiveInteraction()Cancel any active interaction.
Resets to Normal mode without committing any changes.
function getViewState
CorePlotting::ViewStateData const & getViewState() constGet the current view state.
Return: Reference to CorePlotting::ViewStateData with current state
function getBackgroundColor
std::string getBackgroundColor() constfunction getMasterTimeFrame
inline std::shared_ptr< TimeFrame > getMasterTimeFrame() constfunction getAnalogSeriesMap
inline auto const & getAnalogSeriesMap() constfunction getDigitalEventSeriesMap
inline auto const & getDigitalEventSeriesMap() constfunction getDigitalIntervalSeriesMap
inline auto const & getDigitalIntervalSeriesMap() constfunction setMasterTimeFrame
void setMasterTimeFrame(
std::shared_ptr< TimeFrame > const & master_time_frame
)Set the master time frame used for X-axis coordinates.
Parameters:
- master_time_frame Shared pointer to the master time frame
The master time frame defines the coordinate system for the X-axis display. Individual data series may have different time frames that need to be converted to/from the master time frame for proper synchronization.
Also initializes the TimeRange bounds from the TimeFrame extent.
function loadSpikeSorterConfiguration
void loadSpikeSorterConfiguration(
std::string const & group_name,
std::vector< ChannelPosition > const & positions,
bool key_one_based =true,
std::vector< std::string > group_keys ={}
)Load spike sorter configuration for a group of analog series.
Parameters:
- group_name Group identifier (series keys should be “groupname_N”)
- positions Vector of channel positions for ordering
- key_one_based true when series key suffixes are 1-based (e.g. “voltage_1” = first channel)
Applies custom ordering to analog series within a group based on physical electrode positions from spike sorting software. Series are ordered by Y position (ascending) for vertical stacking.
function clearSpikeSorterConfiguration
void clearSpikeSorterConfiguration(
std::string const & group_name
)Clear spike sorter configuration for a group.
Parameters:
- group_name Group identifier to clear
function loadSpikeToAnalogPairing
void loadSpikeToAnalogPairing(
std::string const & digital_group,
std::string const & analog_group,
std::vector< SpikeToAnalogPairing > const & pairings,
SpikeToAnalogPlacementMode mode,
SpikeToAnalogParseConfig const & config =SpikeToAnalogParseConfig{},
bool overlay_render_digital_events_as_boxes =false
)Apply lane placement overrides based on spike-to-analog pairings.
Parameters:
- digital_group Group prefix for digital (spike) series (e.g. “spikes”)
- analog_group Group prefix for analog (LFP) series (e.g. “voltage”)
- pairings Parsed pairings from
parseSpikeToAnalogCSV - mode Lane placement policy
- config Parse config; the
digital_key_one_basedandanalog_key_one_basedfields control how the numeric suffix in series key names is interpreted when building the channel-to-key lookup maps. - overlay_render_digital_events_as_boxes If true and
modeis Overlay, set each affected digital event series’glyph_shapeto Box in state.
Precondition: pairings must not be empty; zero-length pairings are no-ops.
For each pairing in pairings, locates the digital series key (digital_group + “” + (digital_channel + 1)) and the analog series key (analog_group + ”” + (analog_channel + 1)) that are currently registered in the data store.
The placement policy applied is controlled by mode:
- AdjacentBelow: the digital series is inserted in its own auto-lane immediately below the analog series’ lane.
- AdjacentAbove: the digital series is inserted immediately above.
- Overlay: the digital series shares the analog series’
lane_id(withoverlay_modeset toOverlay).
The current visual order of all displayed series is read from _multi_lane_axis_state->lanes() to determine insertion positions. New lane_order values are assigned with the same ``(N - i) * 10 formula used throughout the ordering system.
function getCanvasSize
inline std::pair< int, int > getCanvasSize() constfunction setOverlayLaneBoundaries
void setOverlayLaneBoundaries(
bool enabled
)Enable/disable lane boundary overlay lines.
function setOverlayOriginMarkers
void setOverlayOriginMarkers(
bool enabled
)Enable/disable series origin marker overlay.
function setOverlayCrosshair
void setOverlayCrosshair(
bool enabled
)Enable/disable cursor crosshair overlay.
function getDiagnostics
DataViewerDiagnostics getDiagnostics() constCollect a snapshot of layout and rendering diagnostics.
Return: DataViewerDiagnostics populated from current cache state
Returns a lightweight struct summarising per-lane transforms, rendering batch counts, and on-screen status without exposing internal data structures.
function layoutResponse
inline CorePlotting::LayoutResponse const & layoutResponse() constGet the cached layout response.
Return: Const reference to the cached LayoutResponse
Returns the most recently computed layout response. Valid after the first scene build. Used by DataViewer_Widget to extract lane descriptors for the MultiLaneVerticalAxisWidget.
function canvasXToTime
float canvasXToTime(
float canvas_x
) constfunction canvasYToAnalogValue
float canvasYToAnalogValue(
float canvas_y,
std::string const & series_key
) constfunction findSeriesAtPosition
std::optional< std::pair< std::string, std::string > > findSeriesAtPosition(
float canvas_x,
float canvas_y
) constFind the series under the mouse cursor.
Parameters:
- canvas_x X coordinate in canvas pixels
- canvas_y Y coordinate in canvas pixels
Return: Optional pair containing series type (“Analog”, “Event”, “Interval”) and series key, or nullopt if no series is under the cursor
Checks analog series and digital event series (in stacked mode) to determine which series is under the given canvas coordinates. Used by tooltip controller, input handler, and wheel modifier chords for series identification.
function state
inline DataViewerState * state()function state
inline DataViewerState const * state() constProtected Functions Documentation
function initializeGL
void initializeGL() overridefunction paintGL
void paintGL() overridefunction resizeGL
void resizeGL(
int w,
int h
) overridefunction cleanup
void cleanup()function mousePressEvent
void mousePressEvent(
QMouseEvent * event
) overridefunction mouseMoveEvent
void mouseMoveEvent(
QMouseEvent * event
) overridefunction mouseReleaseEvent
void mouseReleaseEvent(
QMouseEvent * event
) overridefunction mouseDoubleClickEvent
void mouseDoubleClickEvent(
QMouseEvent * event
) overridefunction leaveEvent
void leaveEvent(
QEvent * event
) overrideUpdated on 2026-11-13 at 20:25:40 +0000