QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RImageData.h
Go to the documentation of this file.
1 #ifndef RIMAGEDATA_H
2 #define RIMAGEDATA_H
3 
4 #include "RBox.h"
5 #include "RDocument.h"
6 #include "REntity.h"
7 #include "RLine.h"
8 #include "RPainterPath.h"
9 #include "RPoint.h"
10 #include "RVector.h"
11 
19 class RImageData: public REntityData {
20 
21  friend class RImageEntity;
22 
23 protected:
25 
26 public:
27  RImageData();
28  RImageData(const RImageData& other);
29  RImageData(const QString& fileName,
30  const RVector& insertionPoint,
31  const RVector& uVector,
32  const RVector& vVector,
33  int brightness,
34  int contrast,
35  int fade);
36  virtual ~RImageData();
37 
38  RImageData& operator=(const RImageData& other);
39 
40  virtual RBox getBoundingBox() const;
41 
42  virtual RVector getPointOnEntity() const;
43  virtual double getDistanceTo(const RVector& point, bool limited = true, double range = 0.0, bool draft = false) const;
44  virtual bool intersectsWith(const RShape& shape) const;
45 
46  virtual QList<RVector> getReferencePoints(
48 
49  virtual bool moveReferencePoint(const RVector& referencePoint,
50  const RVector& targetPoint);
51 
52  virtual bool move(const RVector& offset);
53  virtual bool rotate(double rotation, const RVector& center = RDEFAULT_RVECTOR);
54  virtual bool scale(const RVector& scaleFactors, const RVector& center = RDEFAULT_RVECTOR);
55  virtual bool mirror(const RLine& axis);
56 
57  virtual RShape* castToShape() {
58  return NULL;
59  }
60 
61  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX) const;
62 
63  QString getFileName() const {
64  return fileName;
65  }
67  return insertionPoint;
68  }
69  void setInsertionPoint(const RVector& ip) {
70  insertionPoint = ip;
71  }
72  double getAngle() const {
73  return uVector.getAngle();
74  }
75  void setAngle(double a) {
76  uVector.setAngle(a);
77  vVector.setAngle(a + M_PI/2.0);
78  }
79  RVector getUVector() const {
80  return uVector;
81  }
82  RVector getVVector() const {
83  return vVector;
84  }
85  void setWidth(double w, bool keepRatio=false);
86  void setHeight(double h, bool keepRatio=false);
87  double getWidth() const;
88  double getHeight() const;
89  int getPixelWidth() const;
90  int getPixelHeight() const;
91  //RVector getScaleFactor() const {
92  // return scaleFactor;
93  //}
94  int getBrightness() const {
95  return brightness;
96  }
97  int getContrast() const {
98  return contrast;
99  }
100  int getFade() const {
101  return fade;
102  }
103  QImage getImage() const;
104 
105  void load() const;
106  void reload();
107 
108  QList<RLine> getEdges() const;
109 
110 private:
111  mutable QString fileName;
116  int contrast;
117  int fade;
118  mutable QImage image;
119 };
120 
123 Q_DECLARE_METATYPE(QSharedPointer<RImageData>)
124 
125 #endif