QCAD
Open Source 2D CAD
RPattern.h
Go to the documentation of this file.
1 
20 #ifndef RPATTERN_H
21 #define RPATTERN_H
22 
23 #include "core_global.h"
24 
25 #include <QChar>
26 #include <QMap>
27 #include <QPainterPath>
28 #include <QString>
29 #include <QSharedPointer>
30 
31 #include "RBox.h"
32 #include "RShape.h"
33 #include "RPatternLine.h"
34 
35 
44 public:
45  static QList<QPair<QString, RPattern*> > loadAllFrom(const QString& fileName);
46 
47  RPattern();
48  RPattern(const QString& name, const QString& description);
49  ~RPattern();
50 
51  bool isValid() const {
52  return !fileName.isEmpty();
53  }
54 
55  void clear() {
56  fileName.clear();
57  name.clear();
58  description.clear();
59  patternLines.clear();
60  }
61 
63  QString getFileName() const {
64  return fileName;
65  }
66 
68  const QString getName() const {
69  return name;
70  }
71 
75  bool isLoaded() const {
76  return true;
77  }
78 
79  void load() const { }
80 
81  QList<RPatternLine> getPatternLines() const {
82  return patternLines;
83  }
84 
85  void addPatternLine(const RPatternLine& patternLine) {
86  patternLines.append(patternLine);
87  }
88 
89  void scale(double f);
90  void rotate(double a);
91 
92 private:
94  QString fileName;
95 
97  QString name;
98 
100  QString description;
101 
103  QList<RPatternLine> patternLines;
104 };
105 
106 QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RPattern& p);
107 
110 
111 #endif
void clear()
Definition: RPattern.h:55
#define QCADCORE_EXPORT
Definition: core_global.h:10
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPattern.h:43
QString fileName
Pattern file name.
Definition: RPattern.h:94
void load() const
Definition: RPattern.h:79
void addPatternLine(const RPatternLine &patternLine)
Definition: RPattern.h:85
Q_DECLARE_METATYPE(RMath *)
QList< RPatternLine > getPatternLines() const
Definition: RPattern.h:81
QList< RPatternLine > patternLines
List of pattern line definitions.
Definition: RPattern.h:103
bool isValid() const
Definition: RPattern.h:51
const QString getName() const
Definition: RPattern.h:68
bool isLoaded() const
Definition: RPattern.h:75
QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RPattern &p)
Stream operator for QDebug.
Definition: RPattern.cpp:153
QString name
Pattern name.
Definition: RPattern.h:97
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPatternLine.h:37
QString getFileName() const
Definition: RPattern.h:63
QString description
Pattern description.
Definition: RPattern.h:100