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 #include "RRay.h"
41 #include "RXLine.h"
42 
43 class RGraphicsViewImage;
44 
57 public:
58  RGraphicsSceneQt(RDocumentInterface& documentInterface);
59  virtual ~RGraphicsSceneQt();
60 
61  RGraphicsViewImage* getGraphicsView();
62 
63  virtual void clear();
64 
65  virtual void updateSelectionStatus(QSet<REntity::Id>& affectedEntities, bool updateViews);
66 
67  virtual void clearPreview();
68 
69  bool beginPath();
70  void endPath();
71 
72  virtual void unexportEntity(REntity::Id entityId);
73 
74  virtual void exportPoint(const RPoint& point);
75  virtual void exportLine(const RLine& line, double offset = RNANDOUBLE);
76  virtual void exportArc(const RArc& arc, double offset = RNANDOUBLE);
77  virtual void exportEllipse(const REllipse& ellipse, double offset = RNANDOUBLE);
78  virtual void exportPolyline(const RPolyline& polyline, double offset = RNANDOUBLE);
79  void exportPolylineFill(const RPolyline& polyline);
80  virtual void exportSpline(const RSpline& spline, double offset = RNANDOUBLE);
81 
82  virtual void exportArcSegment(const RArc& arc);
83  virtual void exportLineSegment(const RLine& line, double angle = RNANDOUBLE);
84  virtual void exportXLine(const RXLine& xLine);
85  virtual void exportRay(const RRay& ray);
86  virtual void exportTriangle(const RTriangle& triangle);
87  virtual void exportRectangle(const RVector& p1, const RVector& p2);
88 
89  virtual void exportPainterPathSource(const RPainterPathSource& pathSource);
90  virtual void exportPainterPaths(const QList<RPainterPath>& paths);
91  virtual void exportImage(const RImageData& image);
92 
93  virtual double getPatternFactor();
94 
95  virtual void highlightEntity(REntity& entity);
96 
97  void deletePainterPaths();
98  QList<RPainterPath> getPainterPaths(REntity::Id entityId);
99  QList<RPainterPath> getPreviewPainterPaths();
100  bool hasImageFor(REntity::Id entityId);
101  RImageData getImage(REntity::Id entityId);
102 
103  void addPath(REntity::Id entityId, const RPainterPath& path, bool draft);
104 
105  void addToPreview(const QList<RPainterPath>& painterPaths);
106  void addToPreview(const RPainterPath& painterPath);
107 
108  virtual void startEntity(bool topLevelEntity);
109 
110 
111  virtual void dump() {
112  qDebug() << *this;
113  }
114 
118  friend QDebug operator<<(QDebug dbg, RGraphicsSceneQt& gs);
119 
120 private:
122  QMap<REntity::Id, QList<RPainterPath> > painterPaths;
123 
124  QMap<REntity::Id, RImageData> images;
125 
126  QList<RPainterPath> previewPainterPaths;
127 };
128 
130 
131 #endif