Media_Window
Media_Window
#include <Media_Window.hpp>
Inherits from QGraphicsScene
Public Slots
| Name | |
|---|---|
| void | LoadFrame(TimePosition const & time_position) |
Public Signals
| Name | |
|---|---|
| void | leftClick(qreal , qreal ) |
| void | rightClick(qreal , qreal ) |
| void | leftClickMedia(qreal , qreal ) |
| void | rightClickMedia(qreal , qreal ) |
| void | leftRelease() |
| void | rightRelease() |
| void | leftReleaseDrawing() |
| void | rightReleaseDrawing() |
| void | canvasUpdated(QImage const & canvasImage) |
| void | mouseMove(qreal x, qreal y) |
| void | leftClickCanvas(CanvasCoordinates const & coords) |
| void | rightClickCanvas(CanvasCoordinates const & coords) |
| void | leftClickMediaCoords(MediaCoordinates const & coords) |
| void | rightClickMediaCoords(MediaCoordinates const & coords) |
| void | mouseMoveCanvas(CanvasCoordinates const & coords) |
| void | mouseMoveMediaCoords(MediaCoordinates const & coords) |
| void | leftClickMediaWithEvent(qreal x_media, qreal y_media, Qt::KeyboardModifiers modifiers) |
| void | groupSelectionInteracted() Emitted when the user selects or changes group-based entity selection on the canvas. |
Public Functions
| Name | |
|---|---|
| Media_Window(std::shared_ptr< DataManager > data_manager, QObject * parent =[nullptr]) | |
| ~Media_Window() override | |
| void | addMediaDataToScene(std::string const & media_key) |
| void | removeMediaDataFromScene(std::string const & media_key) |
| void | addLineDataToScene(std::string const & line_key) |
| void | removeLineDataFromScene(std::string const & line_key) |
| void | addMaskDataToScene(std::string const & mask_key) |
| void | removeMaskDataFromScene(std::string const & mask_key) |
| void | addPointDataToScene(std::string const & point_key) |
| void | removePointDataFromScene(std::string const & point_key) |
| void | addDigitalIntervalSeries(std::string const & key) |
| void | removeDigitalIntervalSeries(std::string const & key) |
| void | addTensorDataToScene(std::string const & tensor_key) |
| void | removeTensorDataFromScene(std::string const & tensor_key) |
| void | setTextWidget(MediaText_Widget * text_widget) |
| void | setParentWidget(QWidget * parent_widget) |
| void | setGroupManager(GroupManager * group_manager) Set the GroupManager for group-aware plotting. |
| void | setKeymapManager(KeymapSystem::KeymapManager * manager) Set the KeymapManager for configurable keyboard shortcuts. |
| void | setMediaWidgetState(MediaWidgetState * state) Set the MediaWidgetState for state synchronization. |
| void | UpdateCanvas() |
| MediaSceneDiagnostics | getSceneDiagnostics() const Get current scene element counts for developer diagnostics. |
| float | getXAspect() const Get X scaling factor from canvas coordinate system to canvas pixels. |
| float | getYAspect() const |
| void | resolveCanvasCoordinateSystem() Resolve the canvas coordinate system using the priority chain. |
| CanvasCoordinateSystem const & | canvasCoordinateSystem() const Get the current resolved canvas coordinate system. |
| void | setCanvasSize(ImageSize image_size) |
| std::pair< int, int > | getCanvasSize() const |
| void | setDrawingMode(bool drawing_mode) |
| std::vector< uint8_t > | getDrawingMask() |
| void | setShowHoverCircle(bool show) |
| void | setHoverCircleRadius(int radius) |
| void | setHoverCirclePerfLogging(bool enabled) Enable spdlog debug timing for hover-circle and mouse-move performance. |
| bool | hoverCirclePerfLogging() const Whether hover-circle performance logging is enabled. |
| void | setShowTemporaryLine(bool show) |
| void | updateTemporaryLine(std::vector< Point2D< float > > const & points, std::string const & line_key =““) |
| void | clearTemporaryLine() |
| void | clearAllSelections() |
| bool | hasSelections() const |
| std::unordered_set< EntityId > | getSelectedEntities() const |
| void | selectEntity(EntityId entity_id, std::string const & data_key, std::string const & data_type) |
| void | setUnifiedSelectionEnabled(bool enabled) Enable unified cross-type selection using closest-hit ranking. |
| bool | isUnifiedSelectionEnabled() const Whether unified cross-type selection is active. |
| std::string const & | selectedDataKey() const Get the data key of the current canvas selection. |
| std::string const & | selectedDataType() const Get the data type of the current canvas selection. |
| std::optional< MediaSelectionHit > | findBestEntityAtPosition(QPointF const & scene_pos, SelectToolPrefs const & prefs) const Find the globally closest selectable entity at a scene position. |
| std::optional< LineDisplayOptions * > | getLineConfig(std::string const & line_key) const Get mutable line display options for a key. |
| std::optional< MaskDisplayOptions * > | getMaskConfig(std::string const & mask_key) const Get mutable mask display options for a key. |
| std::optional< PointDisplayOptions * > | getPointConfig(std::string const & point_key) const Get mutable point display options for a key. |
| std::optional< DigitalIntervalDisplayOptions * > | getIntervalConfig(std::string const & interval_key) const Get mutable interval display options for a key. |
| std::optional< TensorDisplayOptions * > | getTensorConfig(std::string const & tensor_key) const Get mutable tensor display options for a key. |
| bool | hasPreviewMaskData(std::string const & mask_key) const Check if preview mask data is available for a given key. |
| std::vector< Mask2D > | getPreviewMaskData(std::string const & mask_key) const Get preview mask data for a given key and time. |
| void | setPreviewMaskData(std::string const & mask_key, std::vector< Mask2D > const & preview_data, bool active) Set preview mask data for a given key. |
Protected Functions
| Name | |
|---|---|
| void | mousePressEvent(QGraphicsSceneMouseEvent * event) override |
| void | mouseReleaseEvent(QGraphicsSceneMouseEvent * event) override |
| void | mouseMoveEvent(QGraphicsSceneMouseEvent * event) override |
| void | contextMenuEvent(QGraphicsSceneContextMenuEvent * event) override |
Friends
| Name | |
|---|---|
| class | MediaMask_Widget |
Detailed Description
class Media_Window;The Media_Window class is responsible for plotting images, movies, and shapes on top of them. Shapes may take the form of lines, points, or arbitrary 2d masks. Advancing a frame will result in the video window loading new data.
This is a QGraphicsScene, which internally renders lines, paths, points, and shapes which are added to the scene
Shapes can be added to the specific frame being visualized after it has been rendered and saved or just temporarily (scrolled back it will not be there), or data assets can be loaded which are saved for the duration (loading keypoints to be plotted with each corresponding frame).
Public Slots Documentation
slot LoadFrame
void LoadFrame(
TimePosition const & time_position
)Public Signals Documentation
signal leftClick
void leftClick(
qreal ,
qreal
)signal rightClick
void rightClick(
qreal ,
qreal
)signal leftClickMedia
void leftClickMedia(
qreal ,
qreal
)signal rightClickMedia
void rightClickMedia(
qreal ,
qreal
)signal leftRelease
void leftRelease()signal rightRelease
void rightRelease()signal leftReleaseDrawing
void leftReleaseDrawing()signal rightReleaseDrawing
void rightReleaseDrawing()signal canvasUpdated
void canvasUpdated(
QImage const & canvasImage
)signal mouseMove
void mouseMove(
qreal x,
qreal y
)signal leftClickCanvas
void leftClickCanvas(
CanvasCoordinates const & coords
)signal rightClickCanvas
void rightClickCanvas(
CanvasCoordinates const & coords
)signal leftClickMediaCoords
void leftClickMediaCoords(
MediaCoordinates const & coords
)signal rightClickMediaCoords
void rightClickMediaCoords(
MediaCoordinates const & coords
)signal mouseMoveCanvas
void mouseMoveCanvas(
CanvasCoordinates const & coords
)signal mouseMoveMediaCoords
void mouseMoveMediaCoords(
MediaCoordinates const & coords
)signal leftClickMediaWithEvent
void leftClickMediaWithEvent(
qreal x_media,
qreal y_media,
Qt::KeyboardModifiers modifiers
)signal groupSelectionInteracted
void groupSelectionInteracted()Emitted when the user selects or changes group-based entity selection on the canvas.
Public Functions Documentation
function Media_Window
explicit Media_Window(
std::shared_ptr< DataManager > data_manager,
QObject * parent =nullptr
)function ~Media_Window
~Media_Window() overridefunction addMediaDataToScene
void addMediaDataToScene(
std::string const & media_key
)function removeMediaDataFromScene
void removeMediaDataFromScene(
std::string const & media_key
)function addLineDataToScene
void addLineDataToScene(
std::string const & line_key
)function removeLineDataFromScene
void removeLineDataFromScene(
std::string const & line_key
)function addMaskDataToScene
void addMaskDataToScene(
std::string const & mask_key
)function removeMaskDataFromScene
void removeMaskDataFromScene(
std::string const & mask_key
)function addPointDataToScene
void addPointDataToScene(
std::string const & point_key
)function removePointDataFromScene
void removePointDataFromScene(
std::string const & point_key
)function addDigitalIntervalSeries
void addDigitalIntervalSeries(
std::string const & key
)function removeDigitalIntervalSeries
void removeDigitalIntervalSeries(
std::string const & key
)function addTensorDataToScene
void addTensorDataToScene(
std::string const & tensor_key
)function removeTensorDataFromScene
void removeTensorDataFromScene(
std::string const & tensor_key
)function setTextWidget
void setTextWidget(
MediaText_Widget * text_widget
)function setParentWidget
inline void setParentWidget(
QWidget * parent_widget
)function setGroupManager
void setGroupManager(
GroupManager * group_manager
)Set the GroupManager for group-aware plotting.
Parameters:
- group_manager Pointer to the GroupManager instance
function setKeymapManager
void setKeymapManager(
KeymapSystem::KeymapManager * manager
)Set the KeymapManager for configurable keyboard shortcuts.
Parameters:
- manager Pointer to the KeymapManager instance (can be nullptr)
Creates a KeyActionAdapter that handles Media Viewer keymap actions (tool switching, pen options, and group assignment).
function setMediaWidgetState
void setMediaWidgetState(
MediaWidgetState * state
)Set the MediaWidgetState for state synchronization.
Parameters:
- state Pointer to the MediaWidgetState (owned by Media_Widget)
When set, display options will be synced to the state when they change, and can be restored from the state on workspace load.
function UpdateCanvas
void UpdateCanvas()function getSceneDiagnostics
MediaSceneDiagnostics getSceneDiagnostics() constGet current scene element counts for developer diagnostics.
Return: Snapshot of internal vector sizes and total scene item count
function getXAspect
float getXAspect() constGet X scaling factor from canvas coordinate system to canvas pixels.
Retained for backward compatibility with external callers (e.g., MediaLine_Widget). Internally uses the resolved CanvasCoordinateSystem.
function getYAspect
float getYAspect() constfunction resolveCanvasCoordinateSystem
void resolveCanvasCoordinateSystem()Resolve the canvas coordinate system using the priority chain.
Priority: user override > active media > first data object with ImageSize > default. Updates the coordinate system stored in MediaWidgetState.
function canvasCoordinateSystem
inline CanvasCoordinateSystem const & canvasCoordinateSystem() constGet the current resolved canvas coordinate system.
function setCanvasSize
inline void setCanvasSize(
ImageSize image_size
)function getCanvasSize
inline std::pair< int, int > getCanvasSize() constfunction setDrawingMode
inline void setDrawingMode(
bool drawing_mode
)function getDrawingMask
std::vector< uint8_t > getDrawingMask()function setShowHoverCircle
void setShowHoverCircle(
bool show
)function setHoverCircleRadius
void setHoverCircleRadius(
int radius
)function setHoverCirclePerfLogging
inline void setHoverCirclePerfLogging(
bool enabled
)Enable spdlog debug timing for hover-circle and mouse-move performance.
Parameters:
- enabled When true, emits rate-limited
[HoverCirclePerf]debug lines
function hoverCirclePerfLogging
inline bool hoverCirclePerfLogging() constWhether hover-circle performance logging is enabled.
function setShowTemporaryLine
void setShowTemporaryLine(
bool show
)function updateTemporaryLine
void updateTemporaryLine(
std::vector< Point2D< float > > const & points,
std::string const & line_key =""
)function clearTemporaryLine
void clearTemporaryLine()function clearAllSelections
void clearAllSelections()function hasSelections
bool hasSelections() constfunction getSelectedEntities
std::unordered_set< EntityId > getSelectedEntities() constfunction selectEntity
void selectEntity(
EntityId entity_id,
std::string const & data_key,
std::string const & data_type
)function setUnifiedSelectionEnabled
void setUnifiedSelectionEnabled(
bool enabled
)Enable unified cross-type selection using closest-hit ranking.
Parameters:
- enabled True when the global Select tool is active
function isUnifiedSelectionEnabled
bool isUnifiedSelectionEnabled() constWhether unified cross-type selection is active.
Return: True when unified selection is enabled
function selectedDataKey
inline std::string const & selectedDataKey() constGet the data key of the current canvas selection.
Return: Selected data manager key, or empty when nothing is selected
function selectedDataType
inline std::string const & selectedDataType() constGet the data type of the current canvas selection.
Return: Selected data type string (“line”, “point”, “mask”), or empty
function findBestEntityAtPosition
std::optional< MediaSelectionHit > findBestEntityAtPosition(
QPointF const & scene_pos,
SelectToolPrefs const & prefs
) constFind the globally closest selectable entity at a scene position.
Parameters:
- scene_pos Position in scene coordinates
- prefs Select-tool filter preferences
Return: Closest hit across enabled line, point, and mask keys, if any
function getLineConfig
std::optional< LineDisplayOptions * > getLineConfig(
std::string const & line_key
) constGet mutable line display options for a key.
Parameters:
- line_key The line data key
Return: Pointer to options if found, nullopt otherwise
function getMaskConfig
std::optional< MaskDisplayOptions * > getMaskConfig(
std::string const & mask_key
) constGet mutable mask display options for a key.
Parameters:
- mask_key The mask data key
Return: Pointer to options if found, nullopt otherwise
function getPointConfig
std::optional< PointDisplayOptions * > getPointConfig(
std::string const & point_key
) constGet mutable point display options for a key.
Parameters:
- point_key The point data key
Return: Pointer to options if found, nullopt otherwise
function getIntervalConfig
std::optional< DigitalIntervalDisplayOptions * > getIntervalConfig(
std::string const & interval_key
) constGet mutable interval display options for a key.
Parameters:
- interval_key The interval data key
Return: Pointer to options if found, nullopt otherwise
function getTensorConfig
std::optional< TensorDisplayOptions * > getTensorConfig(
std::string const & tensor_key
) constGet mutable tensor display options for a key.
Parameters:
- tensor_key The tensor data key
Return: Pointer to options if found, nullopt otherwise
function hasPreviewMaskData
bool hasPreviewMaskData(
std::string const & mask_key
) constCheck if preview mask data is available for a given key.
Parameters:
- mask_key The mask key to check
Return: True if preview data exists for this key
function getPreviewMaskData
std::vector< Mask2D > getPreviewMaskData(
std::string const & mask_key
) constGet preview mask data for a given key and time.
Parameters:
- mask_key The mask key
Return: Preview mask data if available, empty vector otherwise
function setPreviewMaskData
void setPreviewMaskData(
std::string const & mask_key,
std::vector< Mask2D > const & preview_data,
bool active
)Set preview mask data for a given key.
Parameters:
- mask_key The mask key
- preview_data The preview mask data
- active Whether preview is active
Protected Functions Documentation
function mousePressEvent
void mousePressEvent(
QGraphicsSceneMouseEvent * event
) overridefunction mouseReleaseEvent
void mouseReleaseEvent(
QGraphicsSceneMouseEvent * event
) overridefunction mouseMoveEvent
void mouseMoveEvent(
QGraphicsSceneMouseEvent * event
) overrideFriends
friend MediaMask_Widget
friend class MediaMask_Widget(
MediaMask_Widget
);Updated on 2026-11-13 at 20:25:40 +0000