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  bool hasDots() const;
56 
57  void clear() {
58  fileName.clear();
59  name.clear();
60  description.clear();
61  patternLines.clear();
62  }
63 
65  QString getFileName() const {
66  return fileName;
67  }
68 
70  const QString getName() const {
71  return name;
72  }
73 
77  bool isLoaded() const {
78  return true;
79  }
80 
81  void load() const { }
82 
83  QList<RPatternLine> getPatternLines() const {
84  return patternLines;
85  }
86 
87  void addPatternLine(const RPatternLine& patternLine) {
88  patternLines.append(patternLine);
89  }
90 
91  void scale(double f);
92  void rotate(double a);
93 
94 private:
96  QString fileName;
97 
99  QString name;
100 
102  QString description;
103 
105  QList<RPatternLine> patternLines;
106 };
107 
108 QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RPattern& p);
109 
112 
113 #endif
void clear()
Definition: RPattern.h:57
#define QCADCORE_EXPORT
Definition: core_global.h:10
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RPattern.h:43
QString fileName
Pattern file name.
Definition: RPattern.h:96
void load() const
Definition: RPattern.h:81
void addPatternLine(const RPatternLine &patternLine)
Definition: RPattern.h:87
Q_DECLARE_METATYPE(RMath *)
void rotate(void e, void angle, void center)
Rotates the given entity or shape by the given angle around the given center.
Definition: simple_modify.js:78
QList< RPatternLine > getPatternLines() const
Definition: RPattern.h:83
QList< RPatternLine > patternLines
List of pattern line definitions.
Definition: RPattern.h:105
bool isValid() const
Definition: RPattern.h:51
void scale(void e, void factor, void focusPoint)
Scales the given entity or shape by the given factor with the given focus point.
Definition: simple_modify.js:64
const QString getName() const
Definition: RPattern.h:70
bool isLoaded() const
Definition: RPattern.h:77
QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RPattern &p)
Stream operator for QDebug.
Definition: RPattern.cpp:163
QString name
Pattern name.
Definition: RPattern.h:99
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RPatternLine.h:37
QString getFileName() const
Definition: RPattern.h:65
QString description
Pattern description.
Definition: RPattern.h:102