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:
53 
61 
64 
66 
67 public:
68  RImageEntity(RDocument* document, const RImageData& data);
69  RImageEntity(const RImageEntity& other);
70  virtual ~RImageEntity();
71 
72  static void init();
73 
74  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
76  }
77 
78  virtual RImageEntity* clone() const;
79 
80  virtual RS::EntityType getType() const {
81  return RS::EntityImage;
82  }
83 
84  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
85  RTransaction* transaction=NULL);
86  QPair<QVariant, RPropertyAttributes> getProperty(
87  RPropertyTypeId& propertyTypeId,
88  bool humanReadable = false, bool noAttributes = false);
89 
90  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
91 
92  virtual RImageData& getData() {
93  return data;
94  }
95 
96  virtual const RImageData& getData() const {
97  return data;
98  }
99 
100  QString getFileName() const {
101  return data.getFileName();
102  }
103 
104  void setFileName(const QString& fn) {
105  data.setFileName(fn);
106  }
107 
109  return data.getInsertionPoint();
110  }
111 
112  void setInsertionPoint(const RVector& ip) {
113  data.setInsertionPoint(ip);
114  }
115 
116  RVector getUVector() const {
117  return data.getUVector();
118  }
119 
120  RVector getVVector() const {
121  return data.getVVector();
122  }
123 
124  int getBrightness() const {
125  return data.getBrightness();
126  }
127 
128  int getContrast() const {
129  return data.getContrast();
130  }
131 
132  int getFade() const {
133  return data.getFade();
134  }
135 
136  void setWidth(double w, bool keepRatio=false) {
137  data.setWidth(w, keepRatio);
138  }
139 
140  void setHeight(double h, bool keepRatio=false) {
141  data.setHeight(h, keepRatio);
142  }
143 
144  void setAngle(double a) {
145  data.setAngle(a);
146  }
147 
148  double getWidth() const {
149  return data.getWidth();
150  }
151 
152  double getHeight() const {
153  return data.getHeight();
154  }
155 
156  int getPixelWidth() const {
157  return data.getPixelWidth();
158  }
159 
160  int getPixelHeight() const {
161  return data.getPixelHeight();
162  }
163 
164 protected:
165  virtual void print(QDebug dbg) const;
166 
167 protected:
169 };
170 
172 Q_DECLARE_METATYPE(QSharedPointer<RImageEntity>)
173 Q_DECLARE_METATYPE(QSharedPointer<RImageEntity>*)
174 
175 #endif
static RPropertyTypeId PropertyType
Definition: RImageEntity.h:44
RImageData data
Definition: RImageEntity.h:168
static RPropertyTypeId PropertyScaleFactorX
Definition: RImageEntity.h:58
double getWidth() const
Definition: RImageEntity.h:148
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:80
int getFade() const
Definition: RImageEntity.h:132
static RPropertyTypeId PropertyFade
Definition: RImageEntity.h:65
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
void setHeight(double h, bool keepRatio=false)
Definition: RImageEntity.h:140
QString getFileName() const
Definition: RImageEntity.h:100
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RImageData.h:41
static RPropertyTypeId PropertyHeight
Definition: RImageEntity.h:63
void setAngle(double a)
Definition: RImageEntity.h:144
Image.
Definition: RS.h:117
static RPropertyTypeId PropertyBlock
Definition: RImageEntity.h:45
virtual const RImageData & getData() const
Definition: RImageEntity.h:96
static RPropertyTypeId PropertyAngle
Definition: RImageEntity.h:60
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
int getBrightness() const
Definition: RImageEntity.h:124
static RPropertyTypeId PropertyWidth
Definition: RImageEntity.h:62
static RPropertyTypeId PropertyDrawOrder
Definition: RImageEntity.h:52
virtual RImageData & getData()
Definition: RImageEntity.h:92
void setFileName(const QString &fn)
Definition: RImageEntity.h:104
static RPropertyTypeId PropertyLineweight
Definition: RImageEntity.h:49
void setInsertionPoint(const RVector &ip)
Definition: RImageEntity.h:112
RVector getVVector() const
Definition: RImageEntity.h:120
Transaction implementation.
Definition: RTransaction.h:74
static RPropertyTypeId PropertyFileName
Definition: RImageEntity.h:54
static RPropertyTypeId PropertyDisplayedColor
Definition: RImageEntity.h:51
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RImageEntity.h:41
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RImageEntity.h:74
int getPixelHeight() const
Definition: RImageEntity.h:160
static RPropertyTypeId PropertyScaleFactorY
Definition: RImageEntity.h:59
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:116
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
Q_DECLARE_METATYPE(RMath *)
static RPropertyTypeId PropertyInsertionPointZ
Definition: RImageEntity.h:57
void setWidth(double w, bool keepRatio=false)
Definition: RImageEntity.h:136
int getPixelWidth() const
Definition: RImageEntity.h:156
RVector getInsertionPoint() const
Definition: RImageEntity.h:108
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: REntity.cpp:228
int getContrast() const
Definition: RImageEntity.h:128
static void init()
Definition: REntity.cpp:82
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:321
Abstract base class for exporters.
Definition: RExporter.h:71
static RPropertyTypeId PropertyLinetype
Definition: RImageEntity.h:47
static RPropertyTypeId PropertyInsertionPointY
Definition: RImageEntity.h:56
double getHeight() const
Definition: RImageEntity.h:152
static RPropertyTypeId PropertyColor
Definition: RImageEntity.h:50
static RPropertyTypeId PropertyHandle
Definition: RImageEntity.h:42
static RPropertyTypeId PropertyInsertionPointX
Definition: RImageEntity.h:55
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:428