Coin Logo http://www.sim.no
http://www.coin3d.org

Polyline.h

00001 /**************************************************************************\
00002  * 
00003  *  FILE: Polyline.h
00004  *
00005  *  This source file is part of DIME.
00006  *  Copyright (C) 1998-1999 by Systems In Motion.  All rights reserved.
00007  *
00008  *  This library is free software; you can redistribute it and/or modify it
00009  *  under the terms of the GNU General Public License, version 2, as
00010  *  published by the Free Software Foundation.
00011  *
00012  *  This library is distributed in the hope that it will be useful, but
00013  *  WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  *  General Public License (the accompanying file named COPYING) for more
00016  *  details.
00017  *
00018  **************************************************************************
00019  *
00020  *  If you need DIME for a non-GPL project, contact Systems In Motion
00021  *  to acquire a Professional Edition License:
00022  *
00023  *  Systems In Motion                                   http://www.sim.no/
00024  *  Prof. Brochs gate 6                                       sales@sim.no
00025  *  N-7030 Trondheim                                   Voice: +47 22114160
00026  *  NORWAY                                               Fax: +47 67172912
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 &param,
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 &param,
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   
00152   int32 coordCnt;  // real # of coordinate vertices
00153   int32 indexCnt;  // real # of index vertices
00154   int32 frameCnt; 
00155   
00156   dimeVertex **coordVertices;
00157   dimeVertex **indexVertices;
00158   dimeVertex **frameVertices;
00159   dimeEntity *seqend;
00160   dimeVec3f elevation;
00161 }; // class dimePolyline
00162 
00163 inline int16 
00164 dimePolyline::getFlags() const
00165 {
00166   return this->flags;
00167 }
00168 
00169 inline void 
00170 dimePolyline::setFlags(const int16 flags)
00171 {
00172   this->flags = flags;
00173 }
00174 
00175 inline const dimeVec3f &
00176 dimePolyline::getElevation() const
00177 {
00178   return elevation;
00179 }
00180 
00181 inline void 
00182 dimePolyline::setElevation(const dimeVec3f &e)
00183 {
00184   this->elevation = e;
00185 }
00186 
00187 inline int16 
00188 dimePolyline::getPolymeshCountN() const
00189 {
00190   return this->countN;
00191 }
00192 
00193 inline int16 
00194 dimePolyline::getPolymeshCountM() const
00195 {
00196   return this->countM;
00197 }
00198 
00199 inline int16 
00200 dimePolyline::getSmoothSurfaceMdensity() const
00201 {
00202   return this->smoothCountM;
00203 }
00204 
00205 inline int16 
00206 dimePolyline::getSmoothSurfaceNdensity() const
00207 {
00208   return this->smoothCountN;
00209 }
00210 
00211 inline int 
00212 dimePolyline::getNumCoordVertices() const
00213 {
00214   return this->coordCnt;
00215 }
00216 
00217 inline int 
00218 dimePolyline::getNumIndexVertices() const
00219 {
00220   return this->indexCnt;
00221 }
00222 
00223 inline int
00224 dimePolyline::getNumSplineFrameControlPoints() const
00225 {
00226   return this->frameCnt;
00227 }
00228 
00229 inline dimeVertex *
00230 dimePolyline::getCoordVertex(const int index)
00231 {
00232   return this->coordVertices[index];
00233 }
00234 
00235 inline dimeVertex *
00236 dimePolyline::getIndexVertex(const int index)
00237 {
00238   return this->indexVertices[index];
00239 }
00240 
00241 inline dimeVertex *
00242 dimePolyline::getSplineFrameControlPoint(const int index)
00243 {
00244   return this->frameVertices[index];
00245 }
00246 
00247 inline int16 
00248 dimePolyline::getSurfaceType() const
00249 {
00250   return this->surfaceType;
00251 }
00252 
00253 inline void 
00254 dimePolyline::setSurfaceType(const int16 type)
00255 {
00256   this->surfaceType = type;
00257 }
00258 
00259 
00260 #endif // ! DIME_POLYLINE_H
00261 

Copyright © 1998-2005 by Systems in Motion AS. All rights reserved.

Generated on Tue Dec 2 23:27:14 2008 for DIME by Doxygen. 1.4.7