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:
54 
59 
64 
68 
71 
73 
74 public:
75  RImageEntity(RDocument* document, const RImageData& data);
76  RImageEntity(const RImageEntity& other);
77  virtual ~RImageEntity();
78 
79  static void init();
80 
81  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
83  }
84 
85  virtual RImageEntity* clone() const;
86 
87  virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
88  RTransaction* transaction=NULL);
89  virtual QPair<QVariant, RPropertyAttributes> getProperty(
90  RPropertyTypeId& propertyTypeId,
91  bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
92 
93  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
94 
95  virtual RImageData& getData() {
96  return data;
97  }
98 
99  virtual const RImageData& getData() const {
100  return data;
101  }
102 
103  QString getFileName() const {
104  return data.getFileName();
105  }
106 
107  void setFileName(const QString& fn) {
108  data.setFileName(fn);
109  }
110 
112  return data.getInsertionPoint();
113  }
114 
115  void setInsertionPoint(const RVector& ip) {
116  data.setInsertionPoint(ip);
117  }
118 
119  RVector getUVector() const {
120  return data.getUVector();
121  }
122 
123  RVector getVVector() const {
124  return data.getVVector();
125  }
126 
127  int getBrightness() const {
128  return data.getBrightness();
129  }
130 
131  int getContrast() const {
132  return data.getContrast();
133  }
134 
135  int getFade() const {
136  return data.getFade();
137  }
138 
139  void setWidth(double w, bool keepRatio=false) {
140  data.setWidth(w, keepRatio);
141  }
142 
143  void setHeight(double h, bool keepRatio=false) {
144  data.setHeight(h, keepRatio);
145  }
146 
147  void setAngle(double a) {
148  data.setAngle(a);
149  }
150 
151  double getWidth() const {
152  return data.getWidth();
153  }
154 
155  double getHeight() const {
156  return data.getHeight();
157  }
158 
159  int getPixelWidth() const {
160  return data.getPixelWidth();
161  }
162 
163  int getPixelHeight() const {
164  return data.getPixelHeight();
165  }
166 
167 protected:
168  virtual void print(QDebug dbg) const;
169 
170 protected:
172 };
173 
175 Q_DECLARE_METATYPE(QSharedPointer<RImageEntity>)
176 Q_DECLARE_METATYPE(QSharedPointer<RImageEntity>*)
177 
178 #endif
RImageEntity::PropertyFileName
static RPropertyTypeId PropertyFileName
Definition: RImageEntity.h:55
REntity.h
RImageEntity::getFade
int getFade() const
Definition: RImageEntity.h:135
RImageEntity::PropertyColor
static RPropertyTypeId PropertyColor
Definition: RImageEntity.h:51
RImageEntity::PropertyBlock
static RPropertyTypeId PropertyBlock
Definition: RImageEntity.h:46
RImageEntity::setWidth
void setWidth(double w, bool keepRatio=false)
Definition: RImageEntity.h:139
RImageEntity::PropertyAngle
static RPropertyTypeId PropertyAngle
Definition: RImageEntity.h:67
RImageEntity::getBrightness
int getBrightness() const
Definition: RImageEntity.h:127
RImageEntity::PropertyScaleFactorY
static RPropertyTypeId PropertyScaleFactorY
Definition: RImageEntity.h:66
RImageEntity::PropertyWorkingSet
static RPropertyTypeId PropertyWorkingSet
Definition: RImageEntity.h:44
RImageEntity::PropertyUY
static RPropertyTypeId PropertyUY
Definition: RImageEntity.h:61
RImageEntity::PropertyFade
static RPropertyTypeId PropertyFade
Definition: RImageEntity.h:72
RImageEntity::PropertyLayer
static RPropertyTypeId PropertyLayer
Definition: RImageEntity.h:47
RVector
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RImageEntity::PropertyInsertionPointY
static RPropertyTypeId PropertyInsertionPointY
Definition: RImageEntity.h:57
RImageEntity::PropertyType
static RPropertyTypeId PropertyType
Definition: RImageEntity.h:45
RImageData
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RImageData.h:41
RImageEntity::data
RImageData data
Definition: RImageEntity.h:171
RImageEntity::PropertyDrawOrder
static RPropertyTypeId PropertyDrawOrder
Definition: RImageEntity.h:53
RImageEntity::getPixelWidth
int getPixelWidth() const
Definition: RImageEntity.h:159
RImageEntity::PropertyInsertionPointZ
static RPropertyTypeId PropertyInsertionPointZ
Definition: RImageEntity.h:58
RImageEntity::PropertyLineweight
static RPropertyTypeId PropertyLineweight
Definition: RImageEntity.h:50
RImageEntity::setFileName
void setFileName(const QString &fn)
Definition: RImageEntity.h:107
RImageEntity::getHeight
double getHeight() const
Definition: RImageEntity.h:155
QCADENTITY_EXPORT
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
REntity::exportEntity
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
RImageEntity::setHeight
void setHeight(double h, bool keepRatio=false)
Definition: RImageEntity.h:143
RImageEntity::setAngle
void setAngle(double a)
Definition: RImageEntity.h:147
REntity
Base class for all entity classes.
Definition: REntity.h:65
RImageEntity::getVVector
RVector getVVector() const
Definition: RImageEntity.h:123
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(RMath *)
RImageEntity::PropertyScaleFactorX
static RPropertyTypeId PropertyScaleFactorX
Definition: RImageEntity.h:65
RImageEntity::getData
virtual RImageData & getData()
Definition: RImageEntity.h:95
RImageEntity::getPixelHeight
int getPixelHeight() const
Definition: RImageEntity.h:163
REntity::init
static void init()
Definition: REntity.cpp:88
REntity::print
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:455
RPropertyTypeId
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RPropertyTypeId.h:59
RImageEntity::setInsertionPoint
void setInsertionPoint(const RVector &ip)
Definition: RImageEntity.h:115
RImageEntity::PropertyCustom
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RImageEntity.h:41
RExporter
Abstract base class for exporters.
Definition: RExporter.h:72
REntity::setProperty
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:323
RDocument
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition: RDocument.h:72
RImageEntity::getData
virtual const RImageData & getData() const
Definition: RImageEntity.h:99
RImageEntity::PropertyInsertionPointX
static RPropertyTypeId PropertyInsertionPointX
Definition: RImageEntity.h:56
RImageEntity::getStaticPropertyTypeIds
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RImageEntity.h:81
RImageEntity::PropertyLinetype
static RPropertyTypeId PropertyLinetype
Definition: RImageEntity.h:48
RImageEntity::PropertyUX
static RPropertyTypeId PropertyUX
Definition: RImageEntity.h:60
RImageEntity::PropertyVY
static RPropertyTypeId PropertyVY
Definition: RImageEntity.h:63
RImageEntity::PropertyProtected
static RPropertyTypeId PropertyProtected
Definition: RImageEntity.h:43
RImageEntity::getInsertionPoint
RVector getInsertionPoint() const
Definition: RImageEntity.h:111
RImageEntity::getFileName
QString getFileName() const
Definition: RImageEntity.h:103
REntity::clone
virtual REntity * clone() const =0
REntity::getProperty
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition: REntity.cpp:230
RImageEntity::getContrast
int getContrast() const
Definition: RImageEntity.h:131
RImageEntity::PropertyDisplayedColor
static RPropertyTypeId PropertyDisplayedColor
Definition: RImageEntity.h:52
RTransaction
Transaction implementation.
Definition: RTransaction.h:74
RPropertyTypeId::getPropertyTypeIds
static QSet< RPropertyTypeId > getPropertyTypeIds(const std::type_info &classInfo, RPropertyAttributes::Option=RPropertyAttributes::NoOptions)
Gets all property type IDs that where registered for the given class.
Definition: RPropertyTypeId.cpp:273
RImageEntity::PropertyHeight
static RPropertyTypeId PropertyHeight
Definition: RImageEntity.h:70
RImageEntity::PropertyVX
static RPropertyTypeId PropertyVX
Definition: RImageEntity.h:62
RImageEntity::getUVector
RVector getUVector() const
Definition: RImageEntity.h:119
RImageEntity::PropertyLinetypeScale
static RPropertyTypeId PropertyLinetypeScale
Definition: RImageEntity.h:49
RImageEntity::getWidth
double getWidth() const
Definition: RImageEntity.h:151
entity_global.h
RImageEntity
Point entity.
Definition: RImageEntity.h:38
RImageEntity::PropertyWidth
static RPropertyTypeId PropertyWidth
Definition: RImageEntity.h:69
RImageData.h
RImageEntity::PropertyHandle
static RPropertyTypeId PropertyHandle
Definition: RImageEntity.h:42