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

Block.h

00001 /**************************************************************************\
00002  * 
00003  *  FILE: Block.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_BLOCK_H
00031 #define DIME_BLOCK_H
00032 
00033 #include <dime/Basic.h>
00034 #include <dime/entities/Entity.h>
00035 #include <dime/util/Linear.h>
00036 
00037 class dimeInput;
00038 class dimeMemHandler;
00039 class dimeModel;
00040 class dimeOutput;
00041 
00042 class DIME_DLL_API dimeBlock : public dimeEntity
00043 {
00044   friend class dimeBlocksSection;
00045   friend class dimeEntitiesSection;
00046   friend class dimeInsert;
00047   friend class dimeModel;
00048   
00049 public:
00050   dimeBlock(dimeMemHandler * const memhandler);
00051   virtual ~dimeBlock();
00052 
00053   const dimeVec3f &getBasePoint() const;
00054   void setBasePoint(const dimeVec3f &v);
00055   int getNumEntities() const;
00056   dimeEntity *getEntity(const int idx);
00057   void insertEntity(dimeEntity * const entity, const int idx = -1);
00058   void removeEntity(const int idx, const bool deleteIt = true);
00059   void fitEntities();
00060 
00061   const char *getName() const;
00062   void setName(const char * const name);
00063  
00064   dimeEntity *copy(dimeModel * const model) const;
00065   virtual bool getRecord(const int groupcode,
00066                          dimeParam &param,
00067                          const int index = 0) const;
00068   virtual const char *getEntityName() const;
00069 
00070   virtual bool read(dimeInput * const in);
00071   virtual bool write(dimeOutput * const out);
00072   virtual int typeId() const;
00073   virtual int countRecords() const;
00074 
00075 protected:  
00076   virtual bool handleRecord(const int groupcode, 
00077                             const dimeParam & param,
00078                             dimeMemHandler * const memhandler);
00079   
00080   virtual void fixReferences(dimeModel * const model);
00081   virtual bool traverse(const dimeState * const state, 
00082                         dimeCallback callback,
00083                         void *userdata);
00084   
00085 private:
00086   int16 flags;
00087   const char *name;
00088   dimeVec3f basePoint;
00089   dimeArray <dimeEntity*> entities;
00090   dimeEntity *endblock;
00091   dimeMemHandler *memHandler;
00092 
00093 }; // class dimeBlock
00094 
00095 inline const dimeVec3f &
00096 dimeBlock::getBasePoint() const 
00097 {
00098   return this->basePoint;
00099 }
00100 
00101 inline void 
00102 dimeBlock::setBasePoint(const dimeVec3f &v)
00103 {
00104   this->basePoint = v;
00105 }
00106 
00107 inline int 
00108 dimeBlock::getNumEntities() const
00109 {
00110   return this->entities.count();
00111 }
00112 
00113 inline dimeEntity *
00114 dimeBlock::getEntity(const int idx)
00115 {
00116   assert(idx >= 0 && idx < this->entities.count());
00117   return this->entities[idx];
00118 }
00119 
00120 inline const char *
00121 dimeBlock::getName() const
00122 {
00123   return this->name;
00124 }
00125 
00126 inline void 
00127 dimeBlock::setName(const char * const name)
00128 {
00129   this->name = name;
00130 }
00131 
00132 #endif // ! DIME_BLOCK_H
00133 

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