iVS3D v2.0.9
Loading...
Searching...
No Matches
maskstack.h
1#pragma once
2
3#include <QObject>
4#include <QVector>
5#include <QString>
6#include <QMap>
7#include <QVariant>
8#include <QRect>
9#include <QSize>
10#include <memory>
11
12#include "resolution.h"
13#include "roi.h"
14
25struct MaskRecord {
29 QString pluginName;
30
35 QMap<QString, QVariant> pluginSettings;
36
37 QString pluginSettingsString;
38
44
50
54 int id;
55
60 QString getDisplayName() const {
61 return QString("[%1] %2 (%3x%4)")
62 .arg(id)
63 .arg(pluginName)
64 .arg(workingResolution.toString());
65 }
66};
67
88class MaskStack : public QObject {
89 Q_OBJECT
90
91public:
96 explicit MaskStack(QObject* parent = nullptr);
97
104 void addRecord(const MaskRecord& record);
105
113 bool removeRecord(int index);
114
122 bool removeRecordById(int id);
123
129 void clear();
130
135 int size() const;
136
141 bool isEmpty() const;
142
148 const MaskRecord* getRecord(int index) const;
149
154 QVector<MaskRecord> getAllRecords() const;
155
161 const MaskRecord* getRecordById(int id) const;
162
163signals:
168 void sig_recordAdded(const MaskRecord& record);
169
174 void sig_recordRemoved(const MaskRecord& record);
175
180
186
187private:
188 QVector<MaskRecord> m_records; // All mask records in order
189 int m_nextId = 0; // Counter for unique record IDs
190};
Manages a stack of mask generation records for later export.
Definition maskstack.h:88
const MaskRecord * getRecord(int index) const
Get a record by index.
Definition maskstack.cpp:67
bool isEmpty() const
Check if the stack is empty.
Definition maskstack.cpp:62
int size() const
Get the number of records in the stack.
Definition maskstack.cpp:57
void sig_stackChanged()
Emitted whenever the stack contents change (after add, remove, or clear operations)
void addRecord(const MaskRecord &record)
Add a new mask record to the stack.
Definition maskstack.cpp:8
const MaskRecord * getRecordById(int id) const
Get a record by its ID.
Definition maskstack.cpp:80
bool removeRecordById(int id)
Remove a record by its ID.
Definition maskstack.cpp:35
void sig_recordAdded(const MaskRecord &record)
Emitted when a new record is added to the stack.
bool removeRecord(int index)
Remove a record at the given index.
Definition maskstack.cpp:20
QVector< MaskRecord > getAllRecords() const
Get all records in the stack.
Definition maskstack.cpp:75
void clear()
Clear all records from the stack.
Definition maskstack.cpp:45
void sig_stackCleared()
Emitted when the entire stack is cleared.
void sig_recordRemoved(const MaskRecord &record)
Emitted when a record is removed from the stack.
The ROI class manages a region of interest represented as a rectangle in the [0,1]x[0,...
Definition roi.h:21
The Resolution class encapsulates an image resolution (width and height). It provides functionality f...
Definition resolution.h:17
Contains all information needed to generate a mask at export time.
Definition maskstack.h:25
int id
Unique identifier for this record (index in stack)
Definition maskstack.h:54
ROI roi
Region of Interest (ROI) at the time the mask was configured The images will be cropped to this ROI a...
Definition maskstack.h:49
QMap< QString, QVariant > pluginSettings
Settings from the plugin that were active when mask was added Serializable QMap that can be passed to...
Definition maskstack.h:35
Resolution workingResolution
Working resolution at the time the mask was configured The images will be resized to this resolution ...
Definition maskstack.h:43
QString pluginName
Name of the IMask plugin used for this mask.
Definition maskstack.h:29
QString getDisplayName() const
Human-readable description for UI display.
Definition maskstack.h:60