iVS3D v2.0.9
Loading...
Searching...
No Matches
visualization.h
1#pragma once
2#include <QColor>
3#include <QFont>
4#include <QPointF>
5#include <QRectF>
6#include <tl/expected.hpp>
7#include <variant>
8
9#include "ierror.h"
10#include "opencv2/core.hpp"
11
26namespace VIS {
27
33struct RectStyle {
34 QColor strokeColor = Qt::green; // Default color: Green
35 int strokeWidth = 2; // Default thickness in screen space pixels
36 QColor fillColor = Qt::transparent; // Default fill color: Transparent
37};
38
48 QRectF rectangle; // Rectangle coordinates in [0,1] normalized space
49 RectStyle style; // Style for rendering the rectangle
50};
51
58struct TextStyle {
59 QColor textColor = Qt::white; // Default text color: White
60 int fontSize = 12; // Default font size in points
61 QFont font = QFont(); // Default font: System default
62 qreal padding = 3.0; // Default padding in pixels
63 QColor backgroundColor = Qt::black; // Default background color: Black
64};
65
71enum class TextAnchor {
72 TopLeft,
73 TopCenter,
74 TopRight,
75 CenterLeft,
76 Center,
77 CenterRight,
78 BottomLeft,
79 BottomCenter,
80 BottomRight
81};
82
92 QString text; // Text content to display
93 QPointF position; // Position in [0,1] normalized space
94 TextAnchor anchor = TextAnchor::BottomLeft; // Default anchor position
95 TextStyle style; // Style for rendering the text
96};
97
104 float opacity = 1.0f; // Default opacity: fully opaque
105 QRectF position = QRectF(0, 0, 1, 1); // Default position: covers the entire image
106};
107
117 cv::Mat image; // Image to overlay
118 ImageStyle style; // Style for rendering the image
119};
120
126using OverlayItem = std::variant<RectOverlay, TextOverlay, ImageOverlay>;
127
136enum class ViewportType {
137 FullImage, // show the entire image
138 RegionOfInterest // show only the region of interest
139};
140
151struct ViewStyle {
152 QColor backgroundColor =
153 Qt::transparent; // transparent shows the original image
154 ViewportType viewport =
155 ViewportType::FullImage; // whether to show only the region of interest
156 // or the full image
157 QPointF relativeSize = QPointF(
158 1.0, 1.0); // scale factor relative to viewport size (width, height)
159 bool showTitle = true; // if true, show the title of the view
160};
161
190struct View {
191 QString title; // Title of the view
192 ViewStyle style; // Style for the view
193 std::vector<OverlayItem> overlays; // List of overlay items to render
194};
195
218 std::vector<View> views; // Views to visualize
219};
220
227using VisualizationResult = tl::expected<Visualization, PLUG::Error>;
228
229} // namespace VIS
Visualization data model namespace for plugin preview rendering.
Represents an image overlay to be rendered on an image. The given image will be drawn over the base i...
Definition visualization.h:116
Style settings for rendering images.
Definition visualization.h:103
Represents a rectangle overlay to be rendered on an image. The rectangle is defined in the normalized...
Definition visualization.h:47
Style settings for rendering rectangles.
Definition visualization.h:33
Represents a text overlay to be rendered on an image. The position is defined in the normalized [0,...
Definition visualization.h:91
Style settings for rendering text. All settings are in screen space pixels and remain constant regard...
Definition visualization.h:58
Represents one render target inside a plugin-generated visualization.
Definition visualization.h:190
Style settings for a view.
Definition visualization.h:151
Preview visualization container returned by PLUG::IPreview plugins.
Definition visualization.h:217