Polyline.h
1 /**************************************************************************\
2  *
3  * FILE: Polyline.h
4  *
5  * This source file is part of DIME.
6  * Copyright (C) 1998-1999 by Systems In Motion. All rights reserved.
7  *
8  * This library is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License, version 2, as
10  * published by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License (the accompanying file named COPYING) for more
16  * details.
17  *
18  **************************************************************************
19  *
20  * If you need DIME for a non-GPL project, contact Systems In Motion
21  * to acquire a Professional Edition License:
22  *
23  * Systems In Motion http://www.sim.no/
24  * Prof. Brochs gate 6 sales@sim.no
25  * N-7030 Trondheim Voice: +47 22114160
26  * NORWAY Fax: +47 67172912
27  *
28 \**************************************************************************/
29 
30 #ifndef DIME_POLYLINE_H
31 #define DIME_POLYLINE_H
32 
33 #include <dime/Basic.h>
34 #include <dime/entities/ExtrusionEntity.h>
35 #include <dime/util/Array.h>
36 #include <dime/util/Linear.h>
37 
38 
39 class dimeVertex;
40 
41 class DIME_DLL_API dimePolyline : public dimeExtrusionEntity
42 {
43 public:
44  dimePolyline();
45  virtual ~dimePolyline();
46 
47  enum Type {
48  POLYLINE,
49  POLYFACE_MESH,
50  POLYGON_MESH
51  };
52 
53  enum Flags {
54  CLOSED = 0x01,
55  POLYMESH_CLOSED_M = 0x01,
56  CURVE_FIT = 0x02,
57  SPLINE_FIT = 0x04,
58  IS_POLYLINE_3D = 0x08,
59  IS_POLYMESH_3D = 0x10,
60  POLYMESH_CLOSED_N = 0x20,
61  IS_POLYFACE_MESH = 0x40,
62  CONTINOUS_PATTERN = 0x80
63  };
64 
65  enum SurfaceType {
66  NONE = 0,
67  QUADRIC_BSPLINE = 5,
68  CUBIC_BSPLINE = 6,
69  BEZIER = 8
70  };
71 
72  int16 getFlags() const;
73  void setFlags(const int16 flags);
74 
75  int getType() const;
76 
77  const dimeVec3f &getElevation() const;
78  void setElevation(const dimeVec3f &e);
79 
80  int16 getPolymeshCountN() const;
81  int16 getPolymeshCountM() const;
82  int16 getSmoothSurfaceMdensity() const;
83  int16 getSmoothSurfaceNdensity() const;
84 
85  int getNumCoordVertices() const;
86  int getNumIndexVertices() const;
87  int getNumSplineFrameControlPoints() const;
88 
89  int16 getSurfaceType() const;
90  void setSurfaceType(const int16 type);
91 
92  dimeVertex *getCoordVertex(const int index);
93  dimeVertex *getIndexVertex(const int index);
94  dimeVertex *getSplineFrameControlPoint(const int index);
95 
96  void setCoordVertices(dimeVertex **vertices, const int num,
97  dimeMemHandler * const memhandler = NULL);
98  void setIndexVertices(dimeVertex **vertices, const int num,
99  dimeMemHandler * const memhandler = NULL);
100  void setSplineFrameControlPoints(dimeVertex **vertices, const int num,
101  dimeMemHandler * const memhandler = NULL);
102 
103  virtual dimeEntity *copy(dimeModel *const model) const;
104  virtual bool getRecord(const int groupcode,
105  dimeParam &param,
106  const int index = 0) const;
107 
108  virtual void setLayer(const dimeLayer * const layer);
109  virtual const char *getEntityName() const;
110 
111  virtual bool read(dimeInput * const in);
112  virtual bool write(dimeOutput * const out);
113  virtual int typeId() const;
114  virtual int countRecords() const;
115 
116  virtual GeometryType extractGeometry(dimeArray <dimeVec3f> &verts,
117  dimeArray <int> &indices,
118  dimeVec3f &extrusionDir,
119  dxfdouble &thickness);
120 
121  void clearSurfaceData();
122 
123 protected:
124  virtual bool handleRecord(const int groupcode,
125  const dimeParam &param,
126  dimeMemHandler * const memhandler);
127  virtual bool traverse(const dimeState * const state,
128  dimeCallback callback,
129  void *userdata);
130 
131 private:
132 
133  int numCoordVertices() const;
134  int numIndexVertices() const;
135 
136  int16 flags;
137 
138 #ifdef DIME_FIXBIG
139  int32 countM;
140  int32 countN;
141  int32 smoothCountM;
142  int32 smoothCountN;
143 #else
144  int16 countM;
145  int16 countN;
146  int16 smoothCountM;
147  int16 smoothCountN;
148 #endif
149 
150  int16 surfaceType;
151 #ifdef DIME_FIXBIG
152  int32 coordCnt; // real # of coordinate vertices
153  int32 indexCnt; // real # of index vertices
154  int32 frameCnt;
155 #else
156  int16 coordCnt; // real # of coordinate vertices
157  int16 indexCnt; // real # of index vertices
158  int16 frameCnt;
159 #endif
160  dimeVertex **coordVertices;
161  dimeVertex **indexVertices;
162  dimeVertex **frameVertices;
163  dimeEntity *seqend;
164  dimeVec3f elevation;
165 }; // class dimePolyline
166 
167 inline int16
168 dimePolyline::getFlags() const
169 {
170  return this->flags;
171 }
172 
173 inline void
174 dimePolyline::setFlags(const int16 flags)
175 {
176  this->flags = flags;
177 }
178 
179 inline const dimeVec3f &
180 dimePolyline::getElevation() const
181 {
182  return elevation;
183 }
184 
185 inline void
186 dimePolyline::setElevation(const dimeVec3f &e)
187 {
188  this->elevation = e;
189 }
190 
191 inline int16
192 dimePolyline::getPolymeshCountN() const
193 {
194  return this->countN;
195 }
196 
197 inline int16
198 dimePolyline::getPolymeshCountM() const
199 {
200  return this->countM;
201 }
202 
203 inline int16
204 dimePolyline::getSmoothSurfaceMdensity() const
205 {
206  return this->smoothCountM;
207 }
208 
209 inline int16
210 dimePolyline::getSmoothSurfaceNdensity() const
211 {
212  return this->smoothCountN;
213 }
214 
215 inline int
216 dimePolyline::getNumCoordVertices() const
217 {
218  return this->coordCnt;
219 }
220 
221 inline int
222 dimePolyline::getNumIndexVertices() const
223 {
224  return this->indexCnt;
225 }
226 
227 inline int
228 dimePolyline::getNumSplineFrameControlPoints() const
229 {
230  return this->frameCnt;
231 }
232 
233 inline dimeVertex *
234 dimePolyline::getCoordVertex(const int index)
235 {
236  return this->coordVertices[index];
237 }
238 
239 inline dimeVertex *
240 dimePolyline::getIndexVertex(const int index)
241 {
242  return this->indexVertices[index];
243 }
244 
245 inline dimeVertex *
246 dimePolyline::getSplineFrameControlPoint(const int index)
247 {
248  return this->frameVertices[index];
249 }
250 
251 inline int16
252 dimePolyline::getSurfaceType() const
253 {
254  return this->surfaceType;
255 }
256 
257 inline void
258 dimePolyline::setSurfaceType(const int16 type)
259 {
260  this->surfaceType = type;
261 }
262 
263 
264 #endif // ! DIME_POLYLINE_H
265 

Copyright © 1998-1999, Systems In Motion <sales@sim.no>. All rights reserved.
System documentation was generated using doxygen.