QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RGraphicsSceneQt.h
Go to the documentation of this file.
1 #ifndef RGRAPHICSSCENEQT_H
2 #define RGRAPHICSSCENEQT_H
3 
4 #include <QPen>
5 #include <QList>
6 #include <QMultiMap>
7 
8 #include "RArc.h"
9 #include "RCircle.h"
10 #include "RDocumentInterface.h"
11 #include "REllipse.h"
12 #include "RGraphicsScene.h"
13 #include "RImageData.h"
14 #include "RLine.h"
15 #include "RPainterPath.h"
16 #include "RPoint.h"
17 #include "RPolyline.h"
18 
19 class RGraphicsViewImage;
20 
33 public:
35  virtual ~RGraphicsSceneQt();
36 
38 
39  virtual void clearPreview();
40 
41  bool beginPath();
42  void endPath();
43 
44  virtual void unexportEntity(REntity::Id entityId);
45 
46  virtual void exportPoint(const RPoint& point);
47  virtual void exportLine(const RLine& line, double offset = RNANDOUBLE);
48  virtual void exportArc(const RArc& arc, double offset = RNANDOUBLE);
49  virtual void exportEllipse(const REllipse& ellipse, double offset = RNANDOUBLE);
50  virtual void exportPolyline(const RPolyline& polyline, double offset = RNANDOUBLE);
51  virtual void exportSpline(const RSpline& spline, double offset = RNANDOUBLE);
52 
53  virtual void exportArcSegment(const RArc& arc);
54  virtual void exportLineSegment(const RLine& line);
55  virtual void exportTriangle(const RTriangle& triangle);
56  virtual void exportRectangle(const RVector& p1, const RVector& p2);
57 
58  virtual void exportPainterPathSource(const RPainterPathSource& pathSource);
59  virtual void exportPainterPaths(const QList<RPainterPath>& paths);
60  virtual void exportImage(const RImageData& image);
61 
62  virtual double getPatternFactor();
63 
64  virtual void highlightEntity(REntity& entity);
65 
66  void deletePainterPaths();
67  QList<RPainterPath> getPainterPaths(REntity::Id entityId);
68  QList<RPainterPath> getPreviewPainterPaths();
69  bool hasImageFor(REntity::Id entityId);
71 
72  void addPath(REntity::Id entityId, const RPainterPath& path, bool draft);
73 
74  void addToPreview(const QList<RPainterPath>& painterPaths);
75  void addToPreview(const RPainterPath& painterPath);
76 
77  virtual void startEntity(bool topLevelEntity);
78 
79 
80  virtual void dump() {
81  qDebug() << *this;
82  }
83 
87  friend QDebug operator<<(QDebug dbg, RGraphicsSceneQt& gs);
88 
89 private:
91  QMap<REntity::Id, QList<RPainterPath> > painterPaths;
92 
94  QMap<REntity::Id, QList<RPainterPath> > painterPathsDraft;
95 
96  QMap<REntity::Id, RImageData> images;
97 
98  QList<RPainterPath> previewPainterPaths;
99 
100  // cached pattern factor:
101  //double patternFactor;
102 };
103 
105 
106 #endif