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 
32 #include "dl_codes.h"
33 
41 
42 public:
43 
48  layer(""),
49  color(0),
50  color24(-1),
51  width(0),
52  lineType("BYLAYER"),
53  handle(-1) {
54  }
55 
67  DL_Attributes(const std::string& layer,
68  int color, int width,
69  const std::string& lineType) :
70  layer(layer),
71  color(color),
72  color24(-1),
73  width(width),
74  lineType(lineType),
75  handle(-1) {
76 
77  }
78 
91  DL_Attributes(const std::string& layer,
92  int color, int color24, int width,
93  const std::string& lineType,
94  int handle=-1) :
95  layer(layer),
96  color(color),
97  color24(color24),
98  width(width),
99  lineType(lineType),
100  handle(handle) {
101  }
102 
107  void setLayer(const std::string& layer) {
108  this->layer = layer;
109  }
110 
114  std::string getLayer() const {
115  return layer;
116  }
117 
123  void setColor(int color) {
124  this->color = color;
125  }
126 
132  void setColor24(int color) {
133  this->color24 = color;
134  }
135 
141  int getColor() const {
142  return color;
143  }
144 
150  int getColor24() const {
151  return color24;
152  }
153 
157  void setWidth(int width) {
158  this->width = width;
159  }
160 
164  int getWidth() const {
165  return width;
166  }
167 
172  void setLineType(const std::string& lineType) {
173  this->lineType = lineType;
174  }
175 
179  std::string getLineType() const {
180  if (lineType.length()==0) {
181  return "BYLAYER";
182  } else {
183  return lineType;
184  }
185  }
186 
187  void setHandle(int h) {
188  handle = h;
189  }
190 
191  int getHandle() const {
192  return handle;
193  }
194 
195 private:
196  std::string layer;
197  int color;
198  int color24;
199  int width;
200  std::string lineType;
201  int handle;
202 };
203 
204 #endif
205 
206 // EOF