QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
RLayerState.h
Go to the documentation of this file.
1
20#ifndef RLAYERSTATE_H
21#define RLAYERSTATE_H
22
23#include "core_global.h"
24
25#include "RLayer.h"
26#include "RObject.h"
27
28class RDocument;
29
38public:
43
45
46public:
48
49 RLayerState(RDocument* document, const QString& name);
50
51 virtual ~RLayerState();
52
53 static void init();
54
57 }
58
59 virtual RS::EntityType getType() const {
61 }
62
63 virtual QSharedPointer<RObject> clone() const {
64 return QSharedPointer<RObject>(new RLayerState(*this));
65 }
66
67 QSharedPointer<RLayerState> cloneToLayerState() const {
68 return QSharedPointer<RLayerState>(new RLayerState(*this));
69 }
70
71 virtual bool mustAlwaysClone() const {
72 return true;
73 }
74
75 virtual QPair<QVariant, RPropertyAttributes> getProperty(
76 RPropertyTypeId& propertyTypeId,
77 bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
78 virtual bool setProperty(RPropertyTypeId propertyTypeId,
79 const QVariant& value, RTransaction* transaction=NULL);
80
81 QString getName() const {
82 return name;
83 }
84
85 void setName(const QString& n) {
86 name = n.trimmed();
87 }
88
89 QString getDescription() const {
90 return description;
91 }
92
93 void setDescription(const QString& d) {
94 description = d;
95 }
96
97 QString getCurrentLayerName() const {
98 return currentLayer;
99 }
100
101 void setCurrentLayerName(const QString& l) {
102 currentLayer = l;
103 }
104
105 void addLayer(QSharedPointer<RLayer> layer);
106
107 QList<QSharedPointer<RLayer> > getLayers() const;
108
109 QStringList getLayerNames() const;
110 QSharedPointer<RLayer> getLayer(const QString& layerName) const;
111
112private:
113 QString name;
114 QString description;
116 QList<QSharedPointer<RLayer> > layers;
117};
118
119QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RLayerState& l);
120
121Q_DECLARE_METATYPE(QSharedPointer<RLayerState>)
122Q_DECLARE_METATYPE(QSharedPointer<RLayerState>*)
125
126#endif
QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RLayerState &l)
Stream operator for QDebug.
Definition RLayerState.cpp:105
Q_DECLARE_METATYPE(RMath *)
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition RDocument.h:78
Represents a layer state (state of list of layers) in a drawing.
Definition RLayerState.h:37
QString getName() const
Definition RLayerState.h:81
virtual RS::EntityType getType() const
Definition RLayerState.h:59
static RS::EntityType getRtti()
Definition RLayerState.h:55
QString getCurrentLayerName() const
Definition RLayerState.h:97
static RPropertyTypeId PropertyName
Definition RLayerState.h:44
virtual QSharedPointer< RObject > clone() const
Definition RLayerState.h:63
static RPropertyTypeId PropertyHandle
Definition RLayerState.h:41
void setName(const QString &n)
Definition RLayerState.h:85
QList< QSharedPointer< RLayer > > layers
Definition RLayerState.h:116
QString currentLayer
Definition RLayerState.h:115
QString description
Definition RLayerState.h:114
QString name
Definition RLayerState.h:113
static RPropertyTypeId PropertyType
Definition RLayerState.h:40
void setCurrentLayerName(const QString &l)
Definition RLayerState.h:101
QString getDescription() const
Definition RLayerState.h:89
static RPropertyTypeId PropertyCustom
Copyright (c) 2019 by Andrew Mustun.
Definition RLayerState.h:39
QSharedPointer< RLayerState > cloneToLayerState() const
Definition RLayerState.h:67
static RPropertyTypeId PropertyProtected
Definition RLayerState.h:42
virtual bool mustAlwaysClone() const
Definition RLayerState.h:71
void setDescription(const QString &d)
Definition RLayerState.h:93
Abstract base class for all objects.
Definition RObject.h:64
static void init()
Definition RObject.cpp:68
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition RObject.cpp:180
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition RObject.cpp:136
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPropertyTypeId.h:54
EntityType
Entity types used for property handling / filtering.
Definition RS.h:227
@ ObjectLayerState
Definition RS.h:235
Transaction implementation.
Definition RTransaction.h:73
#define QCADCORE_EXPORT
Definition core_global.h:10
void addLayer(void name, void colorName, void linetypeName, void lineWeight)
Adds a layer to the drawing.
Definition simple_create.js:138
#define NULL
Definition opennurbs_system.h:256