00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef DIME_POLYLINE_H
00031 #define DIME_POLYLINE_H
00032
00033 #include <dime/Basic.h>
00034 #include <dime/entities/ExtrusionEntity.h>
00035 #include <dime/util/Array.h>
00036 #include <dime/util/Linear.h>
00037
00038
00039 class dimeVertex;
00040
00041 class DIME_DLL_API dimePolyline : public dimeExtrusionEntity
00042 {
00043 public:
00044 dimePolyline();
00045 virtual ~dimePolyline();
00046
00047 enum Type {
00048 POLYLINE,
00049 POLYFACE_MESH,
00050 POLYGON_MESH
00051 };
00052
00053 enum Flags {
00054 CLOSED = 0x01,
00055 POLYMESH_CLOSED_M = 0x01,
00056 CURVE_FIT = 0x02,
00057 SPLINE_FIT = 0x04,
00058 IS_POLYLINE_3D = 0x08,
00059 IS_POLYMESH_3D = 0x10,
00060 POLYMESH_CLOSED_N = 0x20,
00061 IS_POLYFACE_MESH = 0x40,
00062 CONTINOUS_PATTERN = 0x80
00063 };
00064
00065 enum SurfaceType {
00066 NONE = 0,
00067 QUADRIC_BSPLINE = 5,
00068 CUBIC_BSPLINE = 6,
00069 BEZIER = 8
00070 };
00071
00072 int16 getFlags() const;
00073 void setFlags(const int16 flags);
00074
00075 int getType() const;
00076
00077 const dimeVec3f &getElevation() const;
00078 void setElevation(const dimeVec3f &e);
00079
00080 int16 getPolymeshCountN() const;
00081 int16 getPolymeshCountM() const;
00082 int16 getSmoothSurfaceMdensity() const;
00083 int16 getSmoothSurfaceNdensity() const;
00084
00085 int getNumCoordVertices() const;
00086 int getNumIndexVertices() const;
00087 int getNumSplineFrameControlPoints() const;
00088
00089 int16 getSurfaceType() const;
00090 void setSurfaceType(const int16 type);
00091
00092 dimeVertex *getCoordVertex(const int index);
00093 dimeVertex *getIndexVertex(const int index);
00094 dimeVertex *getSplineFrameControlPoint(const int index);
00095
00096 void setCoordVertices(dimeVertex **vertices, const int num,
00097 dimeMemHandler * const memhandler = NULL);
00098 void setIndexVertices(dimeVertex **vertices, const int num,
00099 dimeMemHandler * const memhandler = NULL);
00100 void setSplineFrameControlPoints(dimeVertex **vertices, const int num,
00101 dimeMemHandler * const memhandler = NULL);
00102
00103 virtual dimeEntity *copy(dimeModel *const model) const;
00104 virtual bool getRecord(const int groupcode,
00105 dimeParam ¶m,
00106 const int index = 0) const;
00107
00108 virtual void setLayer(const dimeLayer * const layer);
00109 virtual const char *getEntityName() const;
00110
00111 virtual bool read(dimeInput * const in);
00112 virtual bool write(dimeOutput * const out);
00113 virtual int typeId() const;
00114 virtual int countRecords() const;
00115
00116 virtual GeometryType extractGeometry(dimeArray <dimeVec3f> &verts,
00117 dimeArray <int> &indices,
00118 dimeVec3f &extrusionDir,
00119 dxfdouble &thickness);
00120
00121 void clearSurfaceData();
00122
00123 protected:
00124 virtual bool handleRecord(const int groupcode,
00125 const dimeParam ¶m,
00126 dimeMemHandler * const memhandler);
00127 virtual bool traverse(const dimeState * const state,
00128 dimeCallback callback,
00129 void *userdata);
00130
00131 private:
00132
00133 int numCoordVertices() const;
00134 int numIndexVertices() const;
00135
00136 int16 flags;
00137
00138 #ifdef DIME_FIXBIG
00139 int32 countM;
00140 int32 countN;
00141 int32 smoothCountM;
00142 int32 smoothCountN;
00143 #else
00144 int16 countM;
00145 int16 countN;
00146 int16 smoothCountM;
00147 int16 smoothCountN;
00148 #endif
00149
00150 int16 surfaceType;
00151 #ifdef DIME_FIXBIG
00152 int32 coordCnt;
00153 int32 indexCnt;
00154 int32 frameCnt;
00155 #else
00156 int16 coordCnt;
00157 int16 indexCnt;
00158 int16 frameCnt;
00159 #endif
00160 dimeVertex **coordVertices;
00161 dimeVertex **indexVertices;
00162 dimeVertex **frameVertices;
00163 dimeEntity *seqend;
00164 dimeVec3f elevation;
00165 };
00166
00167 inline int16
00168 dimePolyline::getFlags() const
00169 {
00170 return this->flags;
00171 }
00172
00173 inline void
00174 dimePolyline::setFlags(const int16 flags)
00175 {
00176 this->flags = flags;
00177 }
00178
00179 inline const dimeVec3f &
00180 dimePolyline::getElevation() const
00181 {
00182 return elevation;
00183 }
00184
00185 inline void
00186 dimePolyline::setElevation(const dimeVec3f &e)
00187 {
00188 this->elevation = e;
00189 }
00190
00191 inline int16
00192 dimePolyline::getPolymeshCountN() const
00193 {
00194 return this->countN;
00195 }
00196
00197 inline int16
00198 dimePolyline::getPolymeshCountM() const
00199 {
00200 return this->countM;
00201 }
00202
00203 inline int16
00204 dimePolyline::getSmoothSurfaceMdensity() const
00205 {
00206 return this->smoothCountM;
00207 }
00208
00209 inline int16
00210 dimePolyline::getSmoothSurfaceNdensity() const
00211 {
00212 return this->smoothCountN;
00213 }
00214
00215 inline int
00216 dimePolyline::getNumCoordVertices() const
00217 {
00218 return this->coordCnt;
00219 }
00220
00221 inline int
00222 dimePolyline::getNumIndexVertices() const
00223 {
00224 return this->indexCnt;
00225 }
00226
00227 inline int
00228 dimePolyline::getNumSplineFrameControlPoints() const
00229 {
00230 return this->frameCnt;
00231 }
00232
00233 inline dimeVertex *
00234 dimePolyline::getCoordVertex(const int index)
00235 {
00236 return this->coordVertices[index];
00237 }
00238
00239 inline dimeVertex *
00240 dimePolyline::getIndexVertex(const int index)
00241 {
00242 return this->indexVertices[index];
00243 }
00244
00245 inline dimeVertex *
00246 dimePolyline::getSplineFrameControlPoint(const int index)
00247 {
00248 return this->frameVertices[index];
00249 }
00250
00251 inline int16
00252 dimePolyline::getSurfaceType() const
00253 {
00254 return this->surfaceType;
00255 }
00256
00257 inline void
00258 dimePolyline::setSurfaceType(const int16 type)
00259 {
00260 this->surfaceType = type;
00261 }
00262
00263
00264 #endif // ! DIME_POLYLINE_H
00265