16 #include "Device/Mask/Ellipse.h"
17 #include "Device/Mask/InfinitePlane.h"
18 #include "Device/Mask/Line.h"
19 #include "Device/Mask/Polygon.h"
20 #include "Device/Mask/Rectangle.h"
29 const QString T_MASKS =
"Mask Tag";
40 QVector<MaskItem*> result;
42 if (
auto* mask =
dynamic_cast<MaskItem*
>(child))
60 return firstChildOfType<RegionOfInterestItem>();
145 return std::make_unique<Rectangle>(xlow, ylow, xup, yup);
193 Serialize::rwSessionItem<double>(s,
"xlow",
getItem(
P_XLOW));
194 Serialize::rwSessionItem<double>(s,
"ylow",
getItem(
P_YLOW));
195 Serialize::rwSessionItem<double>(s,
"xup",
getItem(
P_XUP));
196 Serialize::rwSessionItem<double>(s,
"yup",
getItem(
P_YUP));
210 dynamic_cast<Rectangle*
>(shape.get())->setInverted(
true);
257 const QString T_POINTS =
"Point tag";
265 std::vector<double> x, y;
266 for (
auto*
item : this->childrenOfType<PolygonPointItem>()) {
267 x.push_back(scale *
item->posX());
268 y.push_back(scale *
item->posY());
270 return std::make_unique<Polygon>(x, y);
286 return childrenOfType<PolygonPointItem>();
292 pointItem->setPosX(x);
293 pointItem->setPosY(y);
305 QVector<PolygonPointItem*> pts;
307 for (
const auto* point : pts)
308 addPoint(point->posX(), point->posY());
327 return std::make_unique<VerticalLine>(scale
360 return std::make_unique<HorizontalLine>(scale
403 return std::make_unique<Ellipse>(xcenter, ycenter, xradius, yradius,
angle);
479 return std::make_unique<InfinitePlane>();
511 for (
auto mask : maskContainer->
maskItems())
523 QVector<MaskItem*> items;
528 Serialize::rwCatalogized<MaskItemCatalog>(s,
"maskItems", items);
Defines class DoubleDescriptor.
Defines class MaskItemCatalog.
Defines MaskItems classes.
Defines class SessionModel.
@ other
The unit has no enum value defined in here (e.g. when defined as an explicit string)
Describes properties of a double value which are necessary to allow GUI representation,...
static constexpr auto P_XCENTER
std::unique_ptr< IShape2D > createShape(double scale) const override
static constexpr auto P_XRADIUS
void setAngle(double angle)
DoubleDescriptor yRadius() const
DoubleDescriptor xRadius() const
static constexpr auto P_YCENTER
static constexpr auto P_ANGLE
void setYRadius(double y_radius)
DoubleDescriptor xCenter() const
void serialize(Streamer &s) override
DoubleDescriptor angle() const
void setYCenter(double y_center)
void setXCenter(double x_center)
void setXRadius(double x_radius)
DoubleDescriptor yCenter() const
static constexpr auto M_TYPE
static constexpr auto P_YRADIUS
void setPosY(double pos_y)
static constexpr auto M_TYPE
void serialize(Streamer &s) override
static constexpr auto P_POSY
std::unique_ptr< IShape2D > createShape(double scale) const override
DoubleDescriptor posY() const
void serialize(Streamer &s) override
std::unique_ptr< IShape2D > createShape(double scale) const override
static constexpr auto M_TYPE
Container holding various masks as children.
void clear()
Remove all masks.
QVector< MaskItem * > maskItems() const
RegionOfInterestItem * regionOfInterestItem() const
Can be nullptr.
void addMask(MaskItem *maskItem)
void insertMask(int row, MaskItem *maskItem)
Insert mask at given row.
A base class for all mask items.
static bool isIsVisiblePropertyName(const QString &name)
MaskItem(const QString &name)
static bool isMaskValuePropertyName(const QString &name)
static constexpr auto P_IS_VISIBLE
void setMaskValue(bool mask_value)
void setMaskName(const QString &name)
void setIsVisibleValue(bool visible)
static constexpr auto P_MASK_VALUE
bool isVisibleValue() const
SessionItem * maskValueItem() const
MaskContainerItem * m_maskContainer
void clear()
Removes all maskItems.
void copy(const MaskContainerItem *maskContainer)
Copy the mask items stored in the given maskContainer.
void insertMask(int index, MaskItem *maskItem)
Takes ownership of maskItem.
void serialize(Streamer &s)
QVector< MaskItem * > maskItems() const
static constexpr auto P_ISCLOSED
void setIsClosed(bool closed)
void addPoint(double x, double y)
static constexpr auto M_TYPE
QVector< PolygonPointItem * > points() const
std::unique_ptr< IShape2D > createShape(double scale) const override
void serialize(Streamer &s) override
void serialize(Streamer &s)
void setPosY(double pos_y)
static constexpr auto P_POSY
void setPosX(double pos_x)
static constexpr auto P_POSX
static constexpr auto M_TYPE
void serialize(Streamer &s) override
DoubleDescriptor xLow() const
static constexpr auto P_XUP
DoubleDescriptor yUp() const
static constexpr auto P_YUP
void setXLow(double x_low)
std::unique_ptr< IShape2D > createShape(double scale) const override
DoubleDescriptor yLow() const
DoubleDescriptor xUp() const
void setYLow(double y_low)
static constexpr auto P_YLOW
static constexpr auto P_XLOW
static constexpr auto M_TYPE
static constexpr auto M_TYPE
std::unique_ptr< IShape2D > createShape(double scale) const override
Base class for a GUI data item.
QString itemName() const
Get item name, return display name if no name is set.
void setItemName(const QString &name)
Set item name, add property if necessary.
SessionItem * addProperty(const QString &name, const QVariant &variant)
Add new property item and register new tag. name is the tag name and the display name....
bool registerTag(const QString &name, int min=0, int max=-1, QStringList modelTypes={})
Add new tag to this item with given name, min, max and types. max = -1 -> unlimited,...
int numberOfChildren() const
Returns total number of children.
void insertChild(int row, SessionItem *item, const QString &tag="")
Insert item into given tag into given row.
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
void setItemValue(const QString &tag, const QVariant &variant) const
Directly set value of item under given tag.
void setDefaultTag(const QString &tag)
Set default tag.
SessionModel * model() const
Returns model of this item.
T * item(const QString &tag) const
QVector< SessionItem * > children() const
Returns vector of all children.
QString modelType() const
Get model type.
void setEnabled(bool enabled)
Flags accessors.
QModelIndex index() const
Returns model index of this item.
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.
SessionItem & setLimits(const RealLimits &value)
Base class for a GUI data collection. A collection is e.g. all real data (RealDataModel)....
QModelIndex index(int row, int column, const QModelIndex &parent) const override
bool removeRows(int row, int count, const QModelIndex &parent) override
T * copyItem(const T *item_to_copy, SessionItem *new_parent=nullptr, const QString &tag="")
Supports serialization to or deserialization from QXmlStream.
QXmlStreamReader * xmlReader()
Returns stream reader or nullptr.
void assertVersion(unsigned expectedVersion) const
As reader, throws DeserializationException unless the expected version is read. As writer,...
static constexpr auto M_TYPE
void serialize(Streamer &s) override
std::unique_ptr< IShape2D > createShape(double scale) const override
void setPosX(double pos_x)
static constexpr auto P_POSX
DoubleDescriptor posX() const
QString const & name(EShape k)
void rwVector(Streamer &s, const QString &tag, QVector< T > &vec, Args... argsForConstructor)
Serializes a list of items of known and fixed type. Passes optional arguments to the constructor.