forked from qcad/qcad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRImageEntity.h
175 lines (137 loc) · 4.35 KB
/
RImageEntity.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/**
* Copyright (c) 2011-2016 by Andrew Mustun. All rights reserved.
*
* This file is part of the QCAD project.
*
* QCAD is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QCAD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QCAD.
*/
#ifndef RIMAGEENTITY_H
#define RIMAGEENTITY_H
#include "entity_global.h"
#include "REntity.h"
#include "RImageData.h"
class RDocument;
class RExporter;
/**
* Point entity.
*
* \scriptable
* \sharedPointerSupport
* \ingroup entity
*/
class QCADENTITY_EXPORT RImageEntity: public REntity {
public:
static RPropertyTypeId PropertyCustom;
static RPropertyTypeId PropertyHandle;
static RPropertyTypeId PropertyProtected;
static RPropertyTypeId PropertyType;
static RPropertyTypeId PropertyBlock;
static RPropertyTypeId PropertyLayer;
static RPropertyTypeId PropertyLinetype;
static RPropertyTypeId PropertyLinetypeScale;
static RPropertyTypeId PropertyLineweight;
static RPropertyTypeId PropertyColor;
static RPropertyTypeId PropertyDisplayedColor;
static RPropertyTypeId PropertyDrawOrder;
static RPropertyTypeId PropertyFileName;
static RPropertyTypeId PropertyInsertionPointX;
static RPropertyTypeId PropertyInsertionPointY;
static RPropertyTypeId PropertyInsertionPointZ;
static RPropertyTypeId PropertyScaleFactorX;
static RPropertyTypeId PropertyScaleFactorY;
static RPropertyTypeId PropertyAngle;
static RPropertyTypeId PropertyWidth;
static RPropertyTypeId PropertyHeight;
static RPropertyTypeId PropertyFade;
public:
RImageEntity(RDocument* document, const RImageData& data);
RImageEntity(const RImageEntity& other);
virtual ~RImageEntity();
static void init();
static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
return RPropertyTypeId::getPropertyTypeIds(typeid(RImageEntity));
}
virtual RImageEntity* clone() const;
virtual RS::EntityType getType() const {
return RS::EntityImage;
}
bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
RTransaction* transaction=NULL);
QPair<QVariant, RPropertyAttributes> getProperty(
RPropertyTypeId& propertyTypeId,
bool humanReadable = false, bool noAttributes = false);
virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
virtual RImageData& getData() {
return data;
}
virtual const RImageData& getData() const {
return data;
}
QString getFileName() const {
return data.getFileName();
}
void setFileName(const QString& fn) {
data.setFileName(fn);
}
RVector getInsertionPoint() const {
return data.getInsertionPoint();
}
void setInsertionPoint(const RVector& ip) {
data.setInsertionPoint(ip);
}
RVector getUVector() const {
return data.getUVector();
}
RVector getVVector() const {
return data.getVVector();
}
int getBrightness() const {
return data.getBrightness();
}
int getContrast() const {
return data.getContrast();
}
int getFade() const {
return data.getFade();
}
void setWidth(double w, bool keepRatio=false) {
data.setWidth(w, keepRatio);
}
void setHeight(double h, bool keepRatio=false) {
data.setHeight(h, keepRatio);
}
void setAngle(double a) {
data.setAngle(a);
}
double getWidth() const {
return data.getWidth();
}
double getHeight() const {
return data.getHeight();
}
int getPixelWidth() const {
return data.getPixelWidth();
}
int getPixelHeight() const {
return data.getPixelHeight();
}
protected:
virtual void print(QDebug dbg) const;
protected:
RImageData data;
};
Q_DECLARE_METATYPE(RImageEntity*)
Q_DECLARE_METATYPE(QSharedPointer<RImageEntity>)
Q_DECLARE_METATYPE(QSharedPointer<RImageEntity>*)
#endif