QCAD
Open Source 2D CAD
RS.h
Go to the documentation of this file.
1 
20 #ifndef RS_H
21 #define RS_H
22 
23 #include "core_global.h"
24 
25 #include <QPair>
26 #include <QString>
27 #include <QStringList>
28 #include <QVariant>
29 
30 class RVector;
32 
36 #if defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
37 # define ROS_WINDOWS
38 # define ROS_WIN32
39 # define ROS_WIN64
40 #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
41 # define ROS_WINDOWS
42 # define ROS_WIN32
43 #else
44 # define ROS_POSIX
45 #endif
46 
59 public:
60 
64  enum MessageType {
69  Command
70  };
71 
76  enum EntityType {
87 
121  EntityUser
124  };
125 
135  RenderThreeD
136  };
137 
142  enum Side {
143  NoSide = 0,
144  LeftHand = 1,
145  RightHand = 2,
146  BothSides = 3
147  };
148 
152  enum Ending {
155  EndingNone
156  };
157 
161  enum VAlign {
165  VAlignBottom
166  };
167 
171  enum HAlign {
177  HAlignFit
178  };
179 
184  LeftToRight = 1,
185  TopToBottom = 3,
186  ByStyle = 5
187  };
188 
193  AtLeast = 1,
194  Exact = 2
195  };
196 
200  enum From {
201  FromStart = 0x1,
202  FromEnd = 0x2,
203  FromAny = FromStart|FromEnd,
204  AlongPolyline = 0x4
205  };
206 
211  Top = 0x00000001,
212  Bottom = 0x00000002,
213  Left = 0x00000004,
214  LeftBack = 0x00000008,
215  Right = 0x00000010,
216  RightBack = 0x00000020,
217 
218  Isometric = 0x00010000,
219  IsometricTrue = 0x00020000,
220  Planometric = 0x00040000,
221  Dimetric = 0x00080000,
222 
223  Cabinet = 0x00100000,
224  Cabinet30 = 0x00200000,
225  Cavalier = 0x00400000,
226 
227  User1 = 0x01000000,
228  User2 = 0x02000000,
229  User3 = 0x04000000,
230  User4 = 0x08000000,
231 
232  // backwards compatibility:
233  IsoTop = Top | Isometric,
234  IsoBottom = Bottom | Isometric,
235  IsoLeft = Left | Isometric,
236  IsoLeftBack = LeftBack | Isometric,
237  IsoRight = Right | Isometric,
238  IsoRightBack = RightBack | Isometric
239  };
240 
244  enum Measurement {
245  UnknownMeasurement = -1,
246  Imperial = 0,
247  Metric = 1,
248  };
249 
253  enum Unit {
254  None = 0,
255  Inch = 1,
256  Foot = 2,
257  Mile = 3,
258  Millimeter = 4,
259  Centimeter = 5,
260  Meter = 6,
261  Kilometer = 7,
262  Microinch = 8,
263  Mil = 9,
264  Yard = 10,
265  Angstrom = 11,
266  Nanometer = 12,
267  Micron = 13,
268  Decimeter = 14,
269  Decameter = 15,
270  Hectometer = 16,
271  Gigameter = 17,
272  Astro = 18,
273  Lightyear = 19,
274  Parsec = 20,
275  //Plu = 21 /**< PLU: Plotter units used in HP/GL. 40plu = 1mm. not supported by open design*/
276  MaxUnit = Parsec
277  };
278 
282  enum AngleFormat {
284  DegreesDecimal = 0,
286  DegreesMinutesSeconds = 1,
288  Gradians = 2,
290  Radians = 3,
292  Surveyors = 4
293  };
294 
300  Scientific = 1,
302  Decimal = 2,
304  Engineering = 3,
306  ArchitecturalStacked = 4,
308  FractionalStacked = 5,
310  Architectural = 6,
312  Fractional = 7,
314  WindowsDesktop = 8
315  };
316 
320  enum AngleUnit {
321  Deg,
322  Rad,
323  Gra
324  };
325 
441  /* Point display mode */
443  /* Point display size */
500  MaxKnownVariable = WORLDVIEW,
501  INVALID = -1
502  };
503 
508  Xor
509  };
510 
511  enum FillType {
515  Negative
516  };
517 
518  enum Orientation {
519  UnknownOrientation = -1,
520  Any = 0,
521  CW = 1,
522  CCW = 2
523  };
524 
525  enum JoinType {
528  JoinMiter
529  };
530 
531  enum EndType {
537  EndOpenSingle
538  };
539 
540 public:
541  static bool compare(const QVariant& v1, const QVariant& v2);
542  static bool compare(const QPair<QVariant, RPropertyAttributes>& p1,
543  const QPair<QVariant, RPropertyAttributes>& p2);
544  static int getCpuCores();
545  static QString getBuildCpuArchitecture();
546 
547  static QString getHostId();
548  static QString getSystemId();
549  static QString getWindowManagerId();
550 
551  static QStringList getDirectoryList(const QString& subDirectory);
552  static QStringList getFileList(const QString& subDirectory,
553  const QString& fileExtension);
554  static QStringList getFontList();
555  static QStringList getPatternList(bool metric);
556  static QStringList getLinetypeList(bool metric);
557 
558  template<class T>
559  static bool mapContainsCaseInsensitive(const QMap<QString, T>& map, const QString& key) {
560  return QStringList(map.keys()).contains(key, Qt::CaseInsensitive);
561  }
562 
563  template<class T>
564  static T mapValueCaseInsensitive(const QMap<QString, T>& map, const QString& key) {
565  QMapIterator<QString, T> it(map);
566  while (it.hasNext()) {
567  it.next();
568  if (QString::compare(it.key(), key, Qt::CaseInsensitive)==0) {
569  return it.value();
570  }
571  }
572 
573  return T();
574  }
575 
576  static const double PointTolerance;
577  static const double AngleTolerance;
578 };
579 
581 Q_DECLARE_METATYPE(RS::AngleFormat)
582 Q_DECLARE_METATYPE(RS::AngleFormat*)
583 Q_DECLARE_METATYPE(RS::AngleUnit)
584 Q_DECLARE_METATYPE(RS::EntityType)
585 Q_DECLARE_METATYPE(RS::EntityType*)
586 Q_DECLARE_METATYPE(RS::From)
587 Q_DECLARE_METATYPE(RS::From*)
588 Q_DECLARE_METATYPE(RS::HAlign)
589 Q_DECLARE_METATYPE(RS::HAlign*)
590 Q_DECLARE_METATYPE(RS::IsoProjectionType)
591 Q_DECLARE_METATYPE(RS::IsoProjectionType*)
592 Q_DECLARE_METATYPE(RS::KnownVariable)
593 Q_DECLARE_METATYPE(RS::KnownVariable*)
594 Q_DECLARE_METATYPE(RS::LinearFormat)
595 Q_DECLARE_METATYPE(RS::LinearFormat*)
596 Q_DECLARE_METATYPE(RS::MessageType)
597 Q_DECLARE_METATYPE(RS::ProjectionRenderingHint)
598 Q_DECLARE_METATYPE(RS::Side)
599 Q_DECLARE_METATYPE(RS::Ending)
600 Q_DECLARE_METATYPE(RS::Ending*)
601 Q_DECLARE_METATYPE(RS::TextDrawingDirection)
602 Q_DECLARE_METATYPE(RS::TextDrawingDirection*)
603 Q_DECLARE_METATYPE(RS::TextLineSpacingStyle)
604 Q_DECLARE_METATYPE(RS::TextLineSpacingStyle*)
605 Q_DECLARE_METATYPE(RS::Unit)
606 Q_DECLARE_METATYPE(RS::Measurement)
607 Q_DECLARE_METATYPE(RS::Measurement*)
608 Q_DECLARE_METATYPE(RS::VAlign)
609 Q_DECLARE_METATYPE(RS::VAlign*)
610 Q_DECLARE_METATYPE(RS::BooleanOperation)
611 Q_DECLARE_METATYPE(RS::FillType)
612 Q_DECLARE_METATYPE(RS::Orientation)
613 Q_DECLARE_METATYPE(RS::JoinType)
614 Q_DECLARE_METATYPE(RS::EndType)
615 Q_DECLARE_METATYPE(QList<RS::EntityType>)
616 
617 #endif
Definition: RS.h:436
Definition: RS.h:83
static const double AngleTolerance
Definition: RS.h:577
Circle.
Definition: RS.h:100
Ending
Entity ending.
Definition: RS.h:152
Definition: RS.h:468
FillType
Definition: RS.h:511
Definition: RS.h:506
Definition: RS.h:427
Distance between dimension text and dimension lines, negative for box.
Definition: RS.h:378
Definition: RS.h:333
Definition: RS.h:336
Definition: RS.h:455
Controls display of leading / trailing zeros for linear dimensions.
Definition: RS.h:418
Definition: RS.h:421
Definition: RS.h:459
Definition: RS.h:496
Start point.
Definition: RS.h:153
Definition: RS.h:340
Definition: RS.h:82
Unknown entity.
Definition: RS.h:89
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
Definition: RS.h:343
Definition: RS.h:350
Formatting of linear dimensions.
Definition: RS.h:385
Text.
Definition: RS.h:105
Definition: RS.h:423
Definition: RS.h:330
Definition: RS.h:471
TextLineSpacingStyle
Line spacing style for texts.
Definition: RS.h:192
Definition: RS.h:434
Definition: RS.h:364
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
Definition: RS.h:335
Definition: RS.h:493
Face.
Definition: RS.h:107
VAlign
Vertical alignments.
Definition: RS.h:161
Definition: RS.h:412
Definition: RS.h:393
Definition: RS.h:339
Image.
Definition: RS.h:117
Definition: RS.h:80
Middle (?)
Definition: RS.h:176
Definition: RS.h:499
Definition: RS.h:489
Radians.
Definition: RS.h:322
static T mapValueCaseInsensitive(const QMap< QString, T > &map, const QString &key)
Definition: RS.h:564
Definition: RS.h:473
Definition: RS.h:65
Any text based entity (text, attribute def, attribute)
Definition: RS.h:104
#define QCADCORE_EXPORT
Definition: core_global.h:10
Definition: RS.h:81
Definition: RS.h:406
Any Dimension.
Definition: RS.h:108
EndType
Definition: RS.h:531
Definition: RS.h:513
Arc.
Definition: RS.h:99
Spline.
Definition: RS.h:119
Definition: RS.h:448
Ordinate Dimension.
Definition: RS.h:115
Definition: RS.h:457
Definition: RS.h:442
Definition: RS.h:497
Definition: RS.h:446
Decimal places in angular dimensions.
Definition: RS.h:345
Definition: RS.h:481
Definition: RS.h:334
Point.
Definition: RS.h:94
Definition: RS.h:77
Definition: RS.h:477
Definition: RS.h:84
Right.
Definition: RS.h:174
AngleFormat
Angle format for printing angles.
Definition: RS.h:282
Definition: RS.h:382
Definition: RS.h:424
Block attribute.
Definition: RS.h:90
Definition: RS.h:337
Definition: RS.h:349
Viewport.
Definition: RS.h:120
Definition: RS.h:461
Measurement
Enum of supported measurement systems.
Definition: RS.h:244
Unknown object.
Definition: RS.h:78
Definition: RS.h:488
Definition: RS.h:371
Definition: RS.h:431
Base line.
Definition: RS.h:164
Definition: RS.h:86
Linear aligned Dimension.
Definition: RS.h:110
End point.
Definition: RS.h:154
Definition: RS.h:391
Block attribute definition.
Definition: RS.h:91
Definition: RS.h:133
Definition: RS.h:411
Angular Dimension.
Definition: RS.h:114
Definition: RS.h:447
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:131
Definition: RS.h:376
Definition: RS.h:386
Definition: RS.h:452
BooleanOperation
Definition: RS.h:504
Definition: RS.h:492
Definition: RS.h:68
Definition: RS.h:479
Decimal separator in dimensions.
Definition: RS.h:373
Ellipse.
Definition: RS.h:101
Definition: RS.h:347
Hatch.
Definition: RS.h:116
Side
Side used for side of a point relativ to an entity (right hand or left hand side) ...
Definition: RS.h:142
Definition: RS.h:456
Aligned.
Definition: RS.h:175
Definition: RS.h:484
Definition: RS.h:356
Definition: RS.h:460
Definition: RS.h:388
Definition: RS.h:495
Top.
Definition: RS.h:162
3d Face
Definition: RS.h:103
Definition: RS.h:420
Line.
Definition: RS.h:95
Definition: RS.h:463
Definition: RS.h:449
Definition: RS.h:454
Definition: RS.h:507
Definition: RS.h:437
Definition: RS.h:451
Definition: RS.h:389
Centered.
Definition: RS.h:173
Solid.
Definition: RS.h:102
Definition: RS.h:395
static const double PointTolerance
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RS.h:576
Definition: RS.h:394
Definition: RS.h:400
Definition: RS.h:462
Definition: RS.h:416
Definition: RS.h:494
Definition: RS.h:465
Definition: RS.h:428
Definition: RS.h:392
Definition: RS.h:383
Definition: RS.h:435
Definition: RS.h:474
Q_DECLARE_METATYPE(RMath *)
Definition: RS.h:445
Definition: RS.h:367
Definition: RS.h:331
Definition: RS.h:66
Definition: RS.h:453
Definition: RS.h:346
Definition: RS.h:401
Definition: RS.h:415
Definition: RS.h:458
Definition: RS.h:514
Definition: RS.h:464
Definition: RS.h:533
Definition: RS.h:387
IsoProjectionType
Projection type for isometric projections.
Definition: RS.h:210
Polyline.
Definition: RS.h:98
Left.
Definition: RS.h:172
LinearFormat
Format for length values.
Definition: RS.h:298
Definition: RS.h:475
Definition: RS.h:485
Definition: RS.h:490
Definition: RS.h:408
Definition: RS.h:483
Trace.
Definition: RS.h:106
Definition: RS.h:370
Definition: RS.h:419
Definition: RS.h:374
KnownVariable
Well established document variables.
Definition: RS.h:329
Definition: RS.h:450
Definition: RS.h:85
Definition: RS.h:482
Definition: RS.h:361
Definition: RS.h:438
Definition: RS.h:472
Definition: RS.h:535
Definition: RS.h:67
Definition: RS.h:422
Definition: RS.h:480
Definition: RS.h:396
Definition: RS.h:405
Definition: RS.h:526
Ray.
Definition: RS.h:97
Definition: RS.h:366
Block reference.
Definition: RS.h:92
Definition: RS.h:132
Definition: RS.h:425
Definition: RS.h:534
Definition: RS.h:478
Definition: RS.h:351
Vertical position of dimension label.
Definition: RS.h:380
Formatting of angular dimensions.
Definition: RS.h:358
Definition: RS.h:363
All entities (for filters)
Definition: RS.h:88
Definition: RS.h:342
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RPropertyAttributes.h:47
Definition: RS.h:505
Definition: RS.h:440
Definition: RS.h:362
Definition: RS.h:487
Controls display of leading / trailing zeros for angular dimensions.
Definition: RS.h:360
Any linear dimension.
Definition: RS.h:109
Definition: RS.h:404
JoinType
Definition: RS.h:525
Radial Dimension.
Definition: RS.h:112
XLine.
Definition: RS.h:96
Definition: RS.h:469
From
End used to specify from which end of a shape to measure a distance.
Definition: RS.h:200
Definition: RS.h:341
Definition: RS.h:512
Definition: RS.h:439
Degrees.
Definition: RS.h:321
Vertical position of dimension label.
Definition: RS.h:398
Dimension text size.
Definition: RS.h:414
Definition: RS.h:444
Definition: RS.h:375
Definition: RS.h:467
Orientation
Definition: RS.h:518
Unit
Enum of supported units (values correspond to DXF spec).
Definition: RS.h:253
Definition: RS.h:466
Definition: RS.h:429
Definition: RS.h:532
Diametric Dimension.
Definition: RS.h:113
static bool mapContainsCaseInsensitive(const QMap< QString, T > &map, const QString &key)
Definition: RS.h:559
Definition: RS.h:399
Definition: RS.h:426
Definition: RS.h:355
Block reference with attributes.
Definition: RS.h:93
HAlign
Horizontal alignments.
Definition: RS.h:171
TextDrawingDirection
Text drawing direction.
Definition: RS.h:183
Definition: RS.h:491
Definition: RS.h:433
Definition: RS.h:348
Definition: RS.h:353
Definition: RS.h:134
Archtick size or 0 for arrows.
Definition: RS.h:410
Definition: RS.h:498
Definition: RS.h:352
Definition: RS.h:536
Definition: RS.h:476
Definition: RS.h:402
Definition: RS.h:338
Decimal places in linear dimensions.
Definition: RS.h:369
Definition: RS.h:381
Definition: RS.h:390
Definition: RS.h:470
Definition: RS.h:407
Definition: RS.h:354
MessageType
Message type for debugging and displaying user messages.
Definition: RS.h:64
Definition: RS.h:486
AngleUnit
Angle Units.
Definition: RS.h:320
Class namespace for various global enums.
Definition: RS.h:58
Definition: RS.h:527
Leader.
Definition: RS.h:118
Definition: RS.h:403
Definition: RS.h:430
Definition: RS.h:432
Definition: RS.h:365
Middle.
Definition: RS.h:163
Linear rotated Dimension.
Definition: RS.h:111
Definition: RS.h:332