QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
dl_attributes.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2001-2013 RibbonSoft, GmbH. All rights reserved.
3**
4** This file is part of the dxflib project.
5**
6** This file is free software; you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation; either version 2 of the License, or
9** (at your option) any later version.
10**
11** Licensees holding valid dxflib Professional Edition licenses may use
12** this file in accordance with the dxflib Commercial License
13** Agreement provided with the Software.
14**
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17**
18** See http://www.ribbonsoft.com for further details.
19**
20** Contact [email protected] if any conditions of this licensing are
21** not clear to you.
22**
23**********************************************************************/
24
25#ifndef DL_ATTRIBUTES_H
26#define DL_ATTRIBUTES_H
27
28#include "dl_global.h"
29
30#include <string>
31#include <vector>
32
33#include "dl_codes.h"
34
42
43public:
44
49 layer(""),
50 color(0),
51 color24(-1),
52 width(0),
53 linetype("BYLAYER"),
54 linetypeScale(1.0),
55 handle(-1),
56 inPaperSpace(false) {
57 }
58
70 DL_Attributes(const std::string& layer,
71 int color, int width,
72 const std::string& linetype,
73 double linetypeScale) :
74 layer(layer),
75 color(color),
76 color24(-1),
77 width(width),
78 linetype(linetype),
79 linetypeScale(linetypeScale),
80 handle(-1),
81 inPaperSpace(false) {
82
83 }
84
97 DL_Attributes(const std::string& layer,
98 int color, int color24, int width,
99 const std::string& linetype,
100 int handle=-1) :
101 layer(layer),
102 color(color),
103 color24(color24),
104 width(width),
105 linetype(linetype),
106 linetypeScale(1.0),
107 handle(handle),
108 inPaperSpace(false) {
109 }
110
115 void setLayer(const std::string& layer) {
116 this->layer = layer;
117 }
118
122 std::string getLayer() const {
123 return layer;
124 }
125
131 void setColor(int color) {
132 this->color = color;
133 }
134
140 void setColor24(int color) {
141 this->color24 = color;
142 }
143
149 int getColor() const {
150 return color;
151 }
152
158 int getColor24() const {
159 return color24;
160 }
161
165 void setWidth(int width) {
166 this->width = width;
167 }
168
172 int getWidth() const {
173 return width;
174 }
175
180 void setLinetype(const std::string& linetype) {
181 this->linetype = linetype;
182 }
183
187 void setLinetypeScale(double linetypeScale) {
188 this->linetypeScale = linetypeScale;
189 }
190
191 double getLinetypeScale() const {
192 return linetypeScale;
193 }
194
198 std::string getLinetype() const {
199 if (linetype.length()==0) {
200 return "BYLAYER";
201 } else {
202 return linetype;
203 }
204 }
205
206 void setHandle(int h) {
207 handle = h;
208 }
209
210 int getHandle() const {
211 return handle;
212 }
213
214 void setInPaperSpace(bool on) {
215 inPaperSpace = on;
216 }
217
218 bool isInPaperSpace() const {
219 return inPaperSpace;
220 }
221
222private:
223 std::string layer;
224 int color;
226 int width;
227 std::string linetype;
230
231 // DXF code 67 (true: entity in paper space, false: entity in model space (default):
233};
234
235#endif
236
237// EOF
Storing and passing around attributes.
Definition dl_attributes.h:41
std::string layer
Definition dl_attributes.h:223
void setColor24(int color)
Sets the 24bit color.
Definition dl_attributes.h:140
void setLayer(const std::string &layer)
Sets the layer.
Definition dl_attributes.h:115
std::string getLinetype() const
Definition dl_attributes.h:198
DL_Attributes(const std::string &layer, int color, int color24, int width, const std::string &linetype, int handle=-1)
Constructor for DXF attributes.
Definition dl_attributes.h:97
int color24
Definition dl_attributes.h:225
DL_Attributes()
Default constructor.
Definition dl_attributes.h:48
void setLinetype(const std::string &linetype)
Sets the line type.
Definition dl_attributes.h:180
bool isInPaperSpace() const
Definition dl_attributes.h:218
double linetypeScale
Definition dl_attributes.h:228
int getColor() const
Definition dl_attributes.h:149
std::string linetype
Definition dl_attributes.h:227
int getWidth() const
Definition dl_attributes.h:172
void setInPaperSpace(bool on)
Definition dl_attributes.h:214
std::string getLayer() const
Definition dl_attributes.h:122
int handle
Definition dl_attributes.h:229
DL_Attributes(const std::string &layer, int color, int width, const std::string &linetype, double linetypeScale)
Constructor for DXF attributes.
Definition dl_attributes.h:70
void setLinetypeScale(double linetypeScale)
Sets the entity specific line type scale.
Definition dl_attributes.h:187
void setHandle(int h)
Definition dl_attributes.h:206
int width
Definition dl_attributes.h:226
int getHandle() const
Definition dl_attributes.h:210
void setWidth(int width)
Sets the width.
Definition dl_attributes.h:165
bool inPaperSpace
Definition dl_attributes.h:232
int getColor24() const
Definition dl_attributes.h:158
int color
Definition dl_attributes.h:224
double getLinetypeScale() const
Definition dl_attributes.h:191
void setColor(int color)
Sets the color.
Definition dl_attributes.h:131
#define DXFLIB_EXPORT
Definition dl_global.h:12
#define false
Definition opennurbs_system.h:252