1 /****************************************************************************
2 ** $Id: dl_attributes.h 2334 2005-03-27 23:37:52Z andrew $
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
6 ** This file is part of the dxflib project.
8 ** This file may be distributed and/or modified under the terms of the
9 ** GNU General Public License version 2 as published by the Free Software
10 ** Foundation and appearing in the file LICENSE.GPL included in the
11 ** packaging of this file.
13 ** Licensees holding valid dxflib Professional Edition licenses may use
14 ** this file in accordance with the dxflib Commercial License
15 ** Agreement provided with the Software.
17 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 ** See http://www.ribbonsoft.com for further details.
22 ** Contact info@ribbonsoft.com if any conditions of this licensing are
25 **********************************************************************/
27 #ifndef DL_ATTRIBUTES_H
28 #define DL_ATTRIBUTES_H
36 * Storing and passing around attributes. Attributes
37 * are the layer name, color, width and line type.
39 * @author Andrew Mustun
46 * Default constructor.
52 setLineType("BYLAYER");
58 * Constructor for DXF attributes.
60 * @param layer Layer name for this entity or NULL for no layer
61 * (every entity should be on a named layer!).
62 * @param color Color number (0..256). 0 = BYBLOCK, 256 = BYLAYER.
63 * @param width Line thickness. Defaults to zero. -1 = BYLAYER,
64 * -2 = BYBLOCK, -3 = default width
65 * @param lineType Line type name or "BYLAYER" or "BYBLOCK". Defaults
68 DL_Attributes(const string& layer,
70 const string& lineType) {
74 setLineType(lineType);
80 * Sets the layer. If the given pointer points to NULL, the
81 * new layer name will be an empty but valid string.
83 void setLayer(const string& layer) {
92 string getLayer() const {
101 * @see DL_Codes, dxfColors
103 void setColor(int color) {
112 * @see DL_Codes, dxfColors
114 int getColor() const {
123 void setWidth(int width) {
132 int getWidth() const {
139 * Sets the line type. This can be any string and is not
140 * checked to be a valid line type.
142 void setLineType(const string& lineType) {
143 this->lineType = lineType;
151 string getLineType() const {
152 if (lineType.length()==0) {
162 * Copies attributes (deep copies) from another attribute object.
164 DL_Attributes operator = (const DL_Attributes& attrib) {
165 setLayer(attrib.layer);
166 setColor(attrib.color);
167 setWidth(attrib.width);
168 setLineType(attrib.lineType);