SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
legendclasseditcommands.h
Go to the documentation of this file.
1
25#ifndef OPENSWMMVIS_MAP_LEGEND_CLASS_EDIT_COMMANDS_H
26#define OPENSWMMVIS_MAP_LEGEND_CLASS_EDIT_COMMANDS_H
27
28#include <QColor>
29#include <QPointer>
30#include <QString>
31#include <QUndoCommand>
32
34
35namespace openswmmvis::map {
36
51class SetRendererClassColorCommand : public QUndoCommand
52{
53public:
55 QString classKey,
56 QColor newColor,
57 QUndoCommand *parent = nullptr);
58
59 void undo() override;
60 void redo() override;
61
62 int id() const override { return 0x4C4C4543; /* "LCEC" — legend class-edit colour */ }
63 bool mergeWith(const QUndoCommand *other) override;
64
65private:
66 void applyColor(const QColor &c);
67
68 QPointer<OpenSWMMVisLayer> m_layer;
69 QString m_classKey;
70 QColor m_oldColor; // invalid = "no override before"
71 QColor m_newColor;
72 bool m_firstRedo = true;
73};
74
88class SetRendererClassSizeCommand : public QUndoCommand
89{
90public:
92 QString classKey,
93 qreal newSize,
94 QUndoCommand *parent = nullptr);
95
96 void undo() override;
97 void redo() override;
98
99 int id() const override { return 0x4C434553; /* "LCES" — legend class-edit size */ }
100 bool mergeWith(const QUndoCommand *other) override;
101
102private:
103 void applySize(qreal s);
104
105 QPointer<OpenSWMMVisLayer> m_layer;
106 QString m_classKey;
107 qreal m_oldSize = -1.0;
108 qreal m_newSize = -1.0;
109};
110
111} // namespace openswmmvis::map
112
113#endif // OPENSWMMVIS_MAP_LEGEND_CLASS_EDIT_COMMANDS_H
Abstract base class for all layers displayed in the MapCanvas.
Definition openswmmvislayer.h:116
Records a per-class colour change on a layer's IFeatureRenderer.
Definition legendclasseditcommands.h:52
void redo() override
Definition legendclasseditcommands.cpp:113
int id() const override
Definition legendclasseditcommands.h:62
void undo() override
Definition legendclasseditcommands.cpp:121
bool mergeWith(const QUndoCommand *other) override
Definition legendclasseditcommands.cpp:126
Records a per-class size (or line width) change on a layer's IFeatureRenderer. Mirrors SetRendererCla...
Definition legendclasseditcommands.h:89
int id() const override
Definition legendclasseditcommands.h:99
void undo() override
Definition legendclasseditcommands.cpp:164
bool mergeWith(const QUndoCommand *other) override
Definition legendclasseditcommands.cpp:166
void redo() override
Definition legendclasseditcommands.cpp:163
double s
Scene px per model length unit.
Definition inletdrawingview.cpp:82
Definition featurecommands.h:44
QVector< int > parent
union-find
Definition pslgminsize.cpp:176