QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RGraphicsSceneQt.h
Go to the documentation of this file.
1 
20 #ifndef RGRAPHICSSCENEQT_H
21 #define RGRAPHICSSCENEQT_H
22 
23 #include "gui_global.h"
24 
25 #include <QPen>
26 #include <QList>
27 #include <QMultiMap>
28 
29 #include "RArc.h"
30 #include "RCircle.h"
31 #include "RDocumentInterface.h"
32 #include "REllipse.h"
33 #include "RGraphicsScene.h"
34 #include "RImageData.h"
35 #include "RLine.h"
36 #include "RPainterPath.h"
37 #include "RPainterPathSource.h"
38 #include "RPoint.h"
39 #include "RPolyline.h"
40 
41 class RGraphicsViewImage;
42 
55 public:
56  RGraphicsSceneQt(RDocumentInterface& documentInterface);
57  virtual ~RGraphicsSceneQt();
58 
59  RGraphicsViewImage* getGraphicsView();
60 
61  virtual void clear();
62 
63  virtual void updateSelectionStatus(QSet<REntity::Id>& affectedEntities, bool updateViews);
64 
65  virtual void clearPreview();
66 
67  bool beginPath();
68  void endPath();
69 
70  virtual void unexportEntity(REntity::Id entityId);
71 
72  virtual void exportPoint(const RPoint& point);
73  virtual void exportLine(const RLine& line, double offset = RNANDOUBLE);
74  virtual void exportArc(const RArc& arc, double offset = RNANDOUBLE);
75  virtual void exportEllipse(const REllipse& ellipse, double offset = RNANDOUBLE);
76  virtual void exportPolyline(const RPolyline& polyline, double offset = RNANDOUBLE);
77  void exportPolylineFill(const RPolyline& polyline);
78  virtual void exportSpline(const RSpline& spline, double offset = RNANDOUBLE);
79 
80  virtual void exportArcSegment(const RArc& arc);
81  virtual void exportLineSegment(const RLine& line);
82  virtual void exportTriangle(const RTriangle& triangle);
83  virtual void exportRectangle(const RVector& p1, const RVector& p2);
84 
85  virtual void exportPainterPathSource(const RPainterPathSource& pathSource);
86  virtual void exportPainterPaths(const QList<RPainterPath>& paths);
87  virtual void exportImage(const RImageData& image);
88 
89  virtual double getPatternFactor();
90 
91  virtual void highlightEntity(REntity& entity);
92 
93  void deletePainterPaths();
94  QList<RPainterPath> getPainterPaths(REntity::Id entityId);
95  QList<RPainterPath> getPreviewPainterPaths();
96  bool hasImageFor(REntity::Id entityId);
97  RImageData getImage(REntity::Id entityId);
98 
99  void addPath(REntity::Id entityId, const RPainterPath& path, bool draft);
100 
101  void addToPreview(const QList<RPainterPath>& painterPaths);
102  void addToPreview(const RPainterPath& painterPath);
103 
104  virtual void startEntity(bool topLevelEntity);
105 
106 
107  virtual void dump() {
108  qDebug() << *this;
109  }
110 
114  friend QDebug operator<<(QDebug dbg, RGraphicsSceneQt& gs);
115 
116 private:
118  QMap<REntity::Id, QList<RPainterPath> > painterPaths;
119 
120  QMap<REntity::Id, RImageData> images;
121 
122  QList<RPainterPath> previewPainterPaths;
123 };
124 
126 
127 #endif