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