QCAD
Open Source 2D CAD
RLinetype.h
Go to the documentation of this file.
1 
20 #ifndef RLINETYPE_H
21 #define RLINETYPE_H
22 
23 #include "core_global.h"
24 
25 #include <QColor>
26 #include <QCoreApplication>
27 #include <QIcon>
28 #include <QMetaType>
29 #include <QString>
30 
31 #include "RLinetypePattern.h"
32 #include "RObject.h"
33 #include "RPropertyTypeId.h"
34 #include "RVector.h"
35 
36 class RDocument;
37 class RTransaction;
38 
39 
40 
51 
52  //Q_DECLARE_TR_FUNCTIONS(RLinetype);
53 
54 public:
59 
60 public:
61  RLinetype(RDocument* document=NULL);
62  RLinetype(RDocument* document, const RLinetypePattern& pattern);
63 
64  virtual ~RLinetype();
65 
66  static void init();
67 
68  virtual RS::EntityType getType() const {
69  return RS::ObjectLinetype;
70  }
71 
72  virtual RLinetype* clone() const {
73  return new RLinetype(*this);
74  }
75 
76  QString getName() const {
77  return pattern.getName();
78  }
79 
80  void setName(const QString& n) {
81  pattern.setName(n);
82  }
83 
84  bool isMetric() const {
85  return pattern.isMetric();
86  }
87 
88  void setMetric(bool on) {
89  pattern.setMetric(on);
90  }
91 
92  QString getDescription() const {
93  return pattern.getDescription();
94  }
95 
96  void setDescription(const QString& d) {
97  pattern.setDescription(d);
98  }
99 
100  QString getLabel() const {
101  return pattern.getLabel();
102  }
103 
104  QString getPatternString() const {
105  return pattern.getPatternString();
106  }
107 
108  void setPatternString(const QString& s) {
109  pattern.setPatternString(s);
110  }
111 
112  bool isValid() const;
113 
114  virtual QPair<QVariant, RPropertyAttributes> getProperty(
115  RPropertyTypeId& propertyTypeId,
116  bool humanReadable = false, bool noAttributes = false);
117  virtual bool setProperty(RPropertyTypeId propertyTypeId,
118  const QVariant& value, RTransaction* transaction=NULL);
119 
120  virtual bool isSelectedForPropertyEditing();
121 
122  RLinetypePattern getPattern() const;
123  void setPattern(const RLinetypePattern& p);
124 
125  bool operator==(const RLinetype & linetype) const;
126  bool operator!=(const RLinetype & linetype) const;
127  bool operator<(const RLinetype & linetype) const;
128 
129  virtual void print(QDebug dbg) const;
130 
131 private:
133 };
134 
137 Q_DECLARE_METATYPE(QSharedPointer<RLinetype>)
138 Q_DECLARE_METATYPE(QSharedPointer<RLinetype>*)
139 typedef QPair<QString, RLinetype> _RPairStringRLinetype;
140 Q_DECLARE_METATYPE(_RPairStringRLinetype)
141 Q_DECLARE_METATYPE(QList< _RPairStringRLinetype >)
142 
143 #endif
void setName(const QString &n)
Definition: RLinetype.h:80
QString getPatternString() const
Definition: RLinetype.h:104
Definition: RS.h:82
void setDescription(const QString &d)
Definition: RLinetype.h:96
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: RObject.cpp:129
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
Abstract base class for all objects.
Definition: RObject.h:52
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
#define QCADCORE_EXPORT
Definition: core_global.h:10
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: RObject.cpp:94
QString getName() const
Definition: RLinetype.h:76
Transaction implementation.
Definition: RTransaction.h:74
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RLinetypePattern.h:45
virtual RLinetype * clone() const
Definition: RLinetype.h:72
static RPropertyTypeId PropertyName
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RLinetype.h:55
QPair< QString, RLinetype > _RPairStringRLinetype
Definition: RLinetype.h:139
void setMetric(bool on)
Definition: RLinetype.h:88
virtual RS::EntityType getType() const
Definition: RLinetype.h:68
RLinetypePattern pattern
Definition: RLinetype.h:132
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
Q_DECLARE_METATYPE(RMath *)
bool operator<(const RPainterPath &p1, const RPainterPath &p2)
This operator allows us to sort painter paths based on z-level.
Definition: RPainterPath.cpp:609
static RPropertyTypeId PropertyPatternString
Definition: RLinetype.h:58
static RPropertyTypeId PropertyDescription
Definition: RLinetype.h:56
void setPatternString(const QString &s)
Definition: RLinetype.h:108
QString getDescription() const
Definition: RLinetype.h:92
Represents a linetype in a drawing.
Definition: RLinetype.h:50
static void init()
Definition: RObject.cpp:61
static RPropertyTypeId PropertyMetric
Definition: RLinetype.h:57
virtual bool isSelectedForPropertyEditing()=0
QString getLabel() const
Definition: RLinetype.h:100
bool isMetric() const
Definition: RLinetype.h:84
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: RObject.cpp:562