QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 info@ribbonsoft.com 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 
49  layer(""),
50  color(0),
51  color24(-1),
52  width(0),
53  linetype("BYLAYER"),
54  linetypeScale(1.0),
55  handle(-1) {
56  }
57 
69  DL_Attributes(const std::string& layer,
70  int color, int width,
71  const std::string& linetype,
72  double linetypeScale) :
73  layer(layer),
74  color(color),
75  color24(-1),
76  width(width),
77  linetype(linetype),
78  linetypeScale(linetypeScale),
79  handle(-1) {
80 
81  }
82 
95  DL_Attributes(const std::string& layer,
96  int color, int color24, int width,
97  const std::string& linetype,
98  int handle=-1) :
99  layer(layer),
100  color(color),
101  color24(color24),
102  width(width),
103  linetype(linetype),
104  linetypeScale(1.0),
105  handle(handle) {
106  }
107 
112  void setLayer(const std::string& layer) {
113  this->layer = layer;
114  }
115 
119  std::string getLayer() const {
120  return layer;
121  }
122 
128  void setColor(int color) {
129  this->color = color;
130  }
131 
137  void setColor24(int color) {
138  this->color24 = color;
139  }
140 
146  int getColor() const {
147  return color;
148  }
149 
155  int getColor24() const {
156  return color24;
157  }
158 
162  void setWidth(int width) {
163  this->width = width;
164  }
165 
169  int getWidth() const {
170  return width;
171  }
172 
177  void setLinetype(const std::string& linetype) {
178  this->linetype = linetype;
179  }
180 
184  void setLinetypeScale(double linetypeScale) {
185  this->linetypeScale = linetypeScale;
186  }
187 
188  double getLinetypeScale() const {
189  return linetypeScale;
190  }
191 
192 // void setDashes(const std::vector<double>& dashes) {
193 // this->dashes = dashes;
194 // }
195 
199  std::string getLinetype() const {
200  if (linetype.length()==0) {
201  return "BYLAYER";
202  } else {
203  return linetype;
204  }
205  }
206 
207  void setHandle(int h) {
208  handle = h;
209  }
210 
211  int getHandle() const {
212  return handle;
213  }
214 
215 private:
216  std::string layer;
217  int color;
218  int color24;
219  int width;
220  std::string linetype;
222 // std::vector<double> dashes;
223  int handle;
224 };
225 
226 #endif
227 
228 // EOF