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_MODEL_H
00031 #define DIME_MODEL_H
00032
00033 #include <dime/Basic.h>
00034 #include <dime/util/Array.h>
00035 #include <dime/util/Linear.h>
00036 #include <dime/Base.h>
00037 #include <dime/Layer.h>
00038 #include <stdlib.h>
00039
00040 class dimeInput;
00041 class dimeOutput;
00042 class dimeDict;
00043 class dimeMemHandler;
00044 class dimeSection;
00045 class dimeEntitiesSection;
00046 class dimeBlocksSection;
00047 class dimeBlock;
00048 class dimeEntity;
00049 class dimeRecord;
00050
00051 class dimeModel
00052 {
00053 public:
00054 dimeModel(const bool usememhandler = true);
00055 ~dimeModel();
00056
00057 dimeModel *copy() const;
00058
00059 bool init();
00060 bool read(dimeInput * const in);
00061 bool write(dimeOutput * const out);
00062
00063 int countRecords() const;
00064
00065 bool traverseEntities(dimeCallback callback,
00066 void *userdata = NULL,
00067 bool traverseBlocksSection = false,
00068 bool explodeInserts = true,
00069 bool traversePolylineVertices = false);
00070
00071 const char *addReference(const char * const name, void *id);
00072 void *findReference(const char * const name) const;
00073 const char *findRefStringPtr(const char * const name) const;
00074 void removeReference(const char * const name);
00075 class dimeMemHandler *getMemHandler();
00076
00077 int getNumLayers() const;
00078 const class dimeLayer *getLayer(const int idx) const;
00079 const class dimeLayer *getLayer(const char * const layername) const;
00080 const class dimeLayer *addLayer(const char * const layername,
00081 const int16 colnum == 7,
00082 const int16 flags = 0);
00083
00084 const char * getDxfVersion() const;
00085
00086 static const char *getVersionString();
00087 static void getVersion(int &major, int &minor);
00088 const char *addBlock(const char * const blockname, dimeBlock * const block);
00089 class dimeBlock *findBlock(const char * const blockname);
00090
00091 class dimeSection *findSection(const char * const sectionname);
00092 const class dimeSection *findSection(const char * const sectionname) const;
00093
00094 int getNumSections() const;
00095 class dimeSection *getSection(const int idx);
00096 void insertSection(dimeSection * const section, const int idx = -1);
00097 void removeSection(const int idx);
00098
00099 void registerHandle(const int handle);
00100 void registerHandle(const char * const handle);
00101 int getUniqueHandle();
00102 const char *getUniqueHandle(char *buf, const int bufsize);
00103 void addEntity(dimeEntity *entity);
00104
00105 private:
00106 class dimeDict *refDict;
00107 class dimeDict *layerDict;
00108 class dimeMemHandler *memoryHandler;
00109 dimeArray <class dimeSection*> sections;
00110 dimeArray <class dimeLayer*> layers;
00111 dimeArray <dimeRecord*> headerComments;
00112
00113 int largestHandle;
00114 bool usememhandler;
00115 };
00116
00117 #endif // ! DIME_MODEL_H
00118