]> Shamusworld >> Repos - architektonas/blob - dxflib/src/dl_extrusion.h
Fixed problem with MDI activation.
[architektonas] / dxflib / src / dl_extrusion.h
1 /****************************************************************************
2 ** $Id: dl_extrusion.h 273 2005-02-28 18:14:39Z andrew $
3 **
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
5 **
6 ** This file is part of the dxflib project.
7 **
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.
12 **
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.
16 **
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.
19 **
20 ** See http://www.ribbonsoft.com for further details.
21 **
22 ** Contact info@ribbonsoft.com if any conditions of this licensing are
23 ** not clear to you.
24 **
25 **********************************************************************/
26
27 #ifndef DL_EXTRUSION_H
28 #define DL_EXTRUSION_H
29
30 #include <math.h>
31
32
33 /**
34  * Storing and passing around attributes. Attributes
35  * are the layer name, color, width and line type.
36  *
37  * @author Andrew Mustun
38  */
39 class DL_Extrusion {
40
41 public:
42
43     /**
44      * Default constructor.
45      */
46     DL_Extrusion() {
47                 direction = new double[3];
48         setDirection(0.0, 0.0, 1.0);
49         setElevation(0.0);
50     }
51
52
53     /**
54      * Destructor.
55      */
56         ~DL_Extrusion() {
57                 delete direction ;
58     }
59
60
61     /**
62      * Constructor for DXF extrusion.
63      *
64      * @param direction Vector of axis along which the entity shall be extruded
65          *                  this is also the Z axis of the Entity coordinate system
66      * @param elevation Distance of the entities XY plane from the origin of the
67          *                  world coordinate system
68      */
69     DL_Extrusion(double dx, double dy, double dz, double elevation) {
70                 direction = new double[3];
71                 setDirection(dx, dy, dz);
72         setElevation(elevation);
73     }
74
75
76
77     /**
78      * Sets the direction vector. 
79      */
80     void setDirection(double dx, double dy, double dz) {
81                 direction[0]=dx;
82         direction[1]=dy;
83         direction[2]=dz;
84     }
85
86
87
88     /**
89      * @return direction vector.
90      */
91     double* getDirection() const {
92         return direction;
93     }
94
95
96
97     /**
98      * @return direction vector.
99      */
100     void getDirection(double dir[]) const {
101         dir[0]=direction[0];
102         dir[1]=direction[1];
103         dir[2]=direction[2];
104     }
105
106
107
108     /**
109      * Sets the elevation.
110      */
111     void setElevation(double elevation) {
112         this->elevation = elevation;
113     }
114
115
116
117     /**
118      * @return Elevation.
119      */
120     double getElevation() const {
121         return elevation;
122     }
123
124
125
126     /**
127      * Copies extrusion (deep copies) from another extrusion object.
128      */
129     DL_Extrusion operator = (const DL_Extrusion& extru) {
130         setDirection(extru.direction[0], extru.direction[1], extru.direction[2]);
131         setElevation(extru.elevation);
132
133         return *this;
134     }
135
136
137
138 private:
139         double *direction;
140         double elevation;
141 };
142
143 #endif
144
145 // EOF