Main Page | Class Hierarchy | Class List | File List | Class Members

Entity.h

00001 /**************************************************************************\ 00002 * 00003 * FILE: Entity.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_ENTITY_H 00031 #define DIME_ENTITY_H 00032 00033 #include <dime/Base.h> 00034 #include <dime/Basic.h> 00035 #include <dime/util/Array.h> 00036 #include <dime/util/Linear.h> 00037 #include <dime/RecordHolder.h> 00038 00039 00040 // misc flag values used in entityFlags. 00041 #define FLAG_DELETED 0x0001 // used by dimeEntity 00042 #define FLAG_TMP_BUFFER_SET 0x0002 // see dimeEntity::read() 00043 #define FLAG_VERTICES_FOLLOW 0x0004 // used by dimePolyline 00044 #define FLAG_TAGGED 0x0008 // used by dimeEntity 00045 #define FLAG_COLOR_NUMBER 0x0010 // signals a color number was read 00046 #define FLAG_SUBCLASS_MARKER 0x0020 // will subclass marker need to be written 00047 #define FLAG_HANDLE 0x0040 // entity has handle in RecordHolder 00048 #define FLAG_ACAD_REACTORS 0x0080 // ACAD reactors in entity 00049 #define FLAG_ACAD_XDICTIONARY 0x0100 // ACAD xdictionary in entity 00050 #define FLAG_PAPERSPACE 0x0200 // entity is in paperspace 00051 #define FLAG_LINETYPE 0x0400 // linetype specified in entity 00052 #define FLAG_FIRST_FREE 0x0800 // use this if you want to define your own flags 00053 00054 class dimeLayer; 00055 00056 class DIME_DLL_API dimeEntity : public dimeRecordHolder 00057 { 00058 friend class dimeEntitiesSection; 00059 friend class dimeModel; 00060 friend class dimePolyline; 00061 friend class dimeBlock; 00062 friend class dimeInsert; 00063 00064 public: 00065 dimeEntity(); 00066 virtual ~dimeEntity(); 00067 00068 int16 getEntityFlags() const; 00069 void setEntityFlags(const int16 flags); 00070 00071 int16 getColorNumber() const; 00072 void setColorNumber(const int16 c); 00073 00074 virtual void setLayer(const dimeLayer * const layer); 00075 virtual const char *getEntityName() const = 0; 00076 00077 const dimeLayer *getLayer() const; 00078 const char *getLayerName() const; 00079 00080 virtual dimeEntity *copy(dimeModel * const model) const = 0; 00081 virtual bool read(dimeInput * const in); 00082 virtual bool write(dimeOutput * const out); 00083 virtual bool isOfType(const int thetypeid) const; 00084 virtual int countRecords() const; 00085 virtual void print() const {} 00086 00087 00088 bool isDeleted() const; 00089 void setDeleted(const bool onOff = true); 00090 00091 bool isTagged() const; 00092 void setTagged(const bool onOff = true); 00093 00094 virtual bool getRecord(const int groupcode, 00095 dimeParam &param, 00096 const int index = 0) const; 00097 00098 enum GeometryType { 00099 NONE, 00100 POLYGONS, 00101 LINES, 00102 POINTS 00103 }; 00104 00105 virtual GeometryType extractGeometry(dimeArray <dimeVec3f> &verts, 00106 dimeArray <int> &indices, 00107 dimeVec3f &extrusionDir, 00108 dxfdouble &thickness); 00109 protected: 00110 00111 bool preWrite(dimeOutput * const file); 00112 00113 virtual bool traverse(const dimeState * const state, 00114 dimeCallback callback, 00115 void *userdata); 00116 00117 virtual void fixReferences(dimeModel * const model); 00118 virtual bool handleRecord(const int groupcode, 00119 const dimeParam &param, 00120 dimeMemHandler * const memhandler); 00121 virtual bool shouldWriteRecord(const int groupcode) const; 00122 00123 public: 00124 static dimeEntity *createEntity(const char * const name, 00125 dimeMemHandler * const memhandler = NULL); 00126 static bool readEntities(dimeInput * const file, 00127 dimeArray <dimeEntity*> &array, 00128 const char * const stopat); 00129 00130 static bool copyEntityArray(const dimeEntity *const*const array, 00131 const int nument, 00132 dimeModel * const model, 00133 dimeArray <dimeEntity*> &destarray); 00134 static dimeEntity **copyEntityArray(const dimeEntity *const*const array, 00135 int &nument, 00136 dimeModel * const model); 00137 00138 static void arbitraryAxis(const dimeVec3f &givenaxis, dimeVec3f &newaxis); 00139 static void generateUCS(const dimeVec3f &givenaxis, dimeMatrix &m); 00140 00141 protected: 00142 bool copyRecords(dimeEntity * const entity, dimeModel * const model) const; 00143 00144 private: 00145 const dimeLayer *layer; 00146 int16 entityFlags; 00147 int16 colorNumber; 00148 }; // class dimeEntity 00149 00150 inline const dimeLayer * 00151 dimeEntity::getLayer() const 00152 { 00153 return this->layer; 00154 } 00155 00156 inline int16 00157 dimeEntity::getColorNumber() const 00158 { 00159 return this->colorNumber; 00160 } 00161 00162 inline void 00163 dimeEntity::setColorNumber(const int16 c) 00164 { 00165 this->colorNumber = c; 00166 } 00167 00168 inline int16 00169 dimeEntity::getEntityFlags() const 00170 { 00171 return this->entityFlags; 00172 } 00173 00174 inline void 00175 dimeEntity::setEntityFlags(const int16 flags) 00176 { 00177 this->entityFlags = flags; 00178 } 00179 00180 00181 00182 #endif // ! DIME_ENTITY_H 00183

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