QCAD
Open Source 2D CAD
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 
43 public:
44 
48  DL_Attributes() :
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 
222 private:
223  std::string layer;
224  int color;
225  int color24;
226  int width;
227  std::string linetype;
228  double linetypeScale;
229  int handle;
230 
231  // DXF code 67 (true: entity in paper space, false: entity in model space (default):
232  bool inPaperSpace;
233 };
234 
235 #endif
236 
237 // EOF
dl_global.h
DL_Attributes::DL_Attributes
DL_Attributes()
Default constructor.
Definition: dl_attributes.h:70
DL_Attributes
Storing and passing around attributes.
Definition: dl_attributes.h:41
DXFLIB_EXPORT
#define DXFLIB_EXPORT
Definition: dl_global.h:12
dl_codes.h