QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RLinetypePattern.h
Go to the documentation of this file.
1 
20 #ifndef RLINETYPEPATTERN_H
21 #define RLINETYPEPATTERN_H
22 
23 #include "core_global.h"
24 
25 #include <stdarg.h>
26 #include <math.h>
27 
28 #include <QCoreApplication>
29 #include <QMetaType>
30 #include <QString>
31 #include <QPair>
32 #include <QList>
33 #include <QVector>
34 #include <QMap>
35 
36 
45  Q_DECLARE_TR_FUNCTIONS(RLinetypePattern);
46 
47 public:
51  RLinetypePattern(bool metric, const QString& name, const QString& description, int num...);
52 
53  RLinetypePattern(bool metric, const QString& name, const QString& description, const QList<double>& dashes);
54 
55  void set(const QList<double>& dashes);
56 
57  static QList<QPair<QString, RLinetypePattern*> > loadAllFrom(bool metric, const QString& fileName);
58 
60  RLinetypePattern(bool metric, const QString& name, const QString& description);
61  RLinetypePattern(const RLinetypePattern& other);
63 
64  bool isValid() const;
65  int getNumDashes() const;
66  QString getName() const;
67  void setName(const QString& n);
68  QString getDescription() const;
69  void setDescription(const QString& d);
70 
71  QString getLabel() const;
72  bool isMetric() const {
73  return metric;
74  }
75 
76  QList<double> getPattern() const;
77  double getPatternLength() const;
78  double getDashLengthAt(int i) const;
79  double getLargestGap() const;
80  bool hasDashAt(double pos) const;
81  double getDelta(double pos) const;
82  bool isSymmetrical(int i) const;
83  void scale(double factor);
84 
85  QVector<qreal> getScreenBasedLinetype();
86 
87  RLinetypePattern& operator=(const RLinetypePattern& other);
88  bool operator==(const RLinetypePattern& other) const;
89 
90  bool isLoaded() { return true; }
91  void load() {}
92 
93  //static QString fixName(const QString& n);
94  static void initNameMap();
95 
96 public:
97  bool metric;
98  QString name;
99  QString description;
100  QList<double> pattern;
101 
102  // internal info about segments at which the pattern is symmetrical:
103  bool* symmetrical;
104 
105  static QMap<QString, QString> nameMap;
106 };
107 
108 QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RLinetypePattern& p);
109 
114 Q_DECLARE_METATYPE(_RMapQStringRLinetypePattern*)
115 Q_DECLARE_METATYPE(_RMapQStringRLinetypePattern)
116 
117 #endif