QCAD
Open Source 2D CAD
RImageEntity.h
Go to the documentation of this file.
1 
20 #ifndef RIMAGEENTITY_H
21 #define RIMAGEENTITY_H
22 
23 #include "entity_global.h"
24 
25 #include "REntity.h"
26 #include "RImageData.h"
27 
28 class RDocument;
29 class RExporter;
30 
39 
40 public:
52 
60 
63 
64 public:
65  RImageEntity(RDocument* document, const RImageData& data,
66  RObject::Id objectId = RObject::INVALID_ID);
67  RImageEntity(const RImageEntity& other);
68  virtual ~RImageEntity();
69 
70  static void init();
71 
72  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
74  }
75 
76  virtual RImageEntity* clone() const;
77 
78  virtual RS::EntityType getType() const {
79  return RS::EntityImage;
80  }
81 
82  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
83  RTransaction* transaction=NULL);
84  QPair<QVariant, RPropertyAttributes> getProperty(
85  RPropertyTypeId& propertyTypeId,
86  bool humanReadable = false, bool noAttributes = false);
87 
88  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
89 
90  virtual RImageData& getData() {
91  return data;
92  }
93 
94  virtual const RImageData& getData() const {
95  return data;
96  }
97 
98  QString getFileName() const {
99  return data.getFileName();
100  }
101 
102  void setFileName(const QString& fn) {
103  data.setFileName(fn);
104  }
105 
107  return data.getInsertionPoint();
108  }
109 
110  void setInsertionPoint(const RVector& ip) {
111  data.setInsertionPoint(ip);
112  }
113 
114  RVector getUVector() const {
115  return data.getUVector();
116  }
117 
118  RVector getVVector() const {
119  return data.getVVector();
120  }
121 
122  int getBrightness() const {
123  return data.getBrightness();
124  }
125 
126  int getContrast() const {
127  return data.getContrast();
128  }
129 
130  int getFade() const {
131  return data.getFade();
132  }
133 
134  void setWidth(double w, bool keepRatio=false) {
135  data.setWidth(w, keepRatio);
136  }
137 
138  void setHeight(double h, bool keepRatio=false) {
139  data.setHeight(h, keepRatio);
140  }
141 
142  void setAngle(double a) {
143  data.setAngle(a);
144  }
145 
146  double getWidth() const {
147  return data.getWidth();
148  }
149 
150  double getHeight() const {
151  return data.getHeight();
152  }
153 
154  int getPixelWidth() const {
155  return data.getPixelWidth();
156  }
157 
158  int getPixelHeight() const {
159  return data.getPixelHeight();
160  }
161 
162 protected:
163  virtual void print(QDebug dbg) const;
164 
165 protected:
167 };
168 
170 Q_DECLARE_METATYPE(QSharedPointer<RImageEntity>)
171 Q_DECLARE_METATYPE(QSharedPointer<RImageEntity>*)
172 
173 #endif
static RPropertyTypeId PropertyType
Definition: RImageEntity.h:44
RImageData data
Definition: RImageEntity.h:166
static RPropertyTypeId PropertyScaleFactorX
Definition: RImageEntity.h:57
double getWidth() const
Definition: RImageEntity.h:146
static RPropertyTypeId PropertyProtected
Definition: RImageEntity.h:43
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
Point entity.
Definition: RImageEntity.h:38
virtual RS::EntityType getType() const
Definition: RImageEntity.h:78
int getFade() const
Definition: RImageEntity.h:130
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:75
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
void setHeight(double h, bool keepRatio=false)
Definition: RImageEntity.h:138
QString getFileName() const
Definition: RImageEntity.h:98
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RImageData.h:41
static RPropertyTypeId PropertyHeight
Definition: RImageEntity.h:62
void setAngle(double a)
Definition: RImageEntity.h:142
Image.
Definition: RS.h:104
static RPropertyTypeId PropertyBlock
Definition: RImageEntity.h:45
virtual const RImageData & getData() const
Definition: RImageEntity.h:94
static RPropertyTypeId PropertyAngle
Definition: RImageEntity.h:59
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPropertyTypeId.h:57
int getBrightness() const
Definition: RImageEntity.h:122
static RPropertyTypeId PropertyWidth
Definition: RImageEntity.h:61
static RPropertyTypeId PropertyDrawOrder
Definition: RImageEntity.h:51
virtual RImageData & getData()
Definition: RImageEntity.h:90
void setFileName(const QString &fn)
Definition: RImageEntity.h:102
static RPropertyTypeId PropertyLineweight
Definition: RImageEntity.h:49
int Id
Definition: RObject.h:53
void setInsertionPoint(const RVector &ip)
Definition: RImageEntity.h:110
RVector getVVector() const
Definition: RImageEntity.h:118
Transaction implementation.
Definition: RTransaction.h:70
static RPropertyTypeId PropertyFileName
Definition: RImageEntity.h:53
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RImageEntity.h:41
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RImageEntity.h:72
int getPixelHeight() const
Definition: RImageEntity.h:158
static const Id INVALID_ID
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RObject.h:54
static RPropertyTypeId PropertyScaleFactorY
Definition: RImageEntity.h:58
virtual REntity * clone() const =0
static QSet< RPropertyTypeId > getPropertyTypeIds(const std::type_info &classInfo)
Gets all property type IDs that where registered for the given class.
Definition: RPropertyTypeId.cpp:229
Base class for all entity classes.
Definition: REntity.h:64
RVector getUVector() const
Definition: RImageEntity.h:114
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:63
Q_DECLARE_METATYPE(RMath *)
static RPropertyTypeId PropertyInsertionPointZ
Definition: RImageEntity.h:56
void setWidth(double w, bool keepRatio=false)
Definition: RImageEntity.h:134
int getPixelWidth() const
Definition: RImageEntity.h:154
RVector getInsertionPoint() const
Definition: RImageEntity.h:106
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: REntity.cpp:193
int getContrast() const
Definition: RImageEntity.h:126
static void init()
Definition: REntity.cpp:71
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:277
Abstract base class for exporters.
Definition: RExporter.h:63
static RPropertyTypeId PropertyLinetype
Definition: RImageEntity.h:47
static RPropertyTypeId PropertyInsertionPointY
Definition: RImageEntity.h:55
double getHeight() const
Definition: RImageEntity.h:150
static RPropertyTypeId PropertyColor
Definition: RImageEntity.h:50
static RPropertyTypeId PropertyHandle
Definition: RImageEntity.h:42
static RPropertyTypeId PropertyInsertionPointX
Definition: RImageEntity.h:54
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
static RPropertyTypeId PropertyLayer
Definition: RImageEntity.h:46
static RPropertyTypeId PropertyLinetypeScale
Definition: RImageEntity.h:48
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:385