-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLayer.h
More file actions
46 lines (35 loc) · 1.09 KB
/
Copy pathLayer.h
File metadata and controls
46 lines (35 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef LAYER_H
#define LAYER_H
#include <QString>
#include <QJsonObject>
#include <vector>
#include <memory>
class Shape;
class Layer
{
public:
explicit Layer(const QString &name = "Layer 1");
~Layer();
QString name() const;
void setName(const QString &name);
bool visible() const;
void setVisible(bool v);
// --- Shape management (ordered, for z-order) ---
const std::vector<std::unique_ptr<Shape>> &shapes() const;
std::vector<std::unique_ptr<Shape>> &shapes();
void addShape(std::unique_ptr<Shape> shape);
std::unique_ptr<Shape> takeShape(const QString &shapeId);
Shape *findShape(const QString &shapeId) const;
// z-order
void moveShapeUp(const QString &shapeId);
void moveShapeDown(const QString &shapeId);
void moveShapeToTop(const QString &shapeId);
void moveShapeToBottom(const QString &shapeId);
QJsonObject toJson() const;
static std::unique_ptr<Layer> fromJson(const QJsonObject &obj);
private:
QString m_name;
bool m_visible = true;
std::vector<std::unique_ptr<Shape>> m_shapes;
};
#endif // LAYER_H