cgma
GSaveOpen.cpp
Go to the documentation of this file.
00001 #include "GSaveOpen.hpp"
00002 #include "RefEntity.hpp"
00003 #include "Body.hpp"
00004 #include "RefVolume.hpp"
00005 #include "RefFace.hpp"
00006 #include "RefEdge.hpp"
00007 #include "RefVertex.hpp"
00008 #include "RefEntityFactory.hpp"
00009 
00010 // Initialize Globals
00011 int GSaveOpen::performingUndo = 0;
00012 int GSaveOpen::gsoSetsIds = 0;
00013 int GSaveOpen::gsoIncBodyId = 0;
00014 int GSaveOpen::gsoIncRefVolumeId = 0;
00015 int GSaveOpen::gsoIncRefFaceId = 0;
00016 int GSaveOpen::gsoIncRefEdgeId = 0;
00017 int GSaveOpen::gsoIncRefVertexId = 0;
00018 int GSaveOpen::gsoErrorCount = 0;
00019 DLIList<int> GSaveOpen::gsoErrorIdList;
00020 
00021 GSaveOpen::GSaveOpen()
00022 {
00023   RefEntityFactory *ref = RefEntityFactory::instance();
00024   
00025   if( performingUndo == 1 )
00026   {
00027     gsoSetsIds = 0;
00028     gsoIncBodyId = 0;
00029     gsoIncRefVolumeId = 0; 
00030     gsoIncRefFaceId = 0; 
00031     gsoIncRefEdgeId = 0; 
00032     gsoIncRefVertexId = 0;
00033   }  
00034   else
00035   {
00036     gsoSetsIds = 1;
00037     gsoIncBodyId = ref->current_body_id();
00038     gsoIncRefVolumeId = ref->current_volume_id();
00039     gsoIncRefFaceId = ref->current_face_id();
00040     gsoIncRefEdgeId = ref->current_edge_id();
00041     gsoIncRefVertexId = ref->current_vertex_id();
00042   }
00043   gsoErrorCount = 0;
00044 }
00045 
00046 GSaveOpen::~GSaveOpen() 
00047 {
00048   // Reset globals
00049   gsoSetsIds = 0;
00050   gsoIncBodyId = 0;
00051   gsoIncRefVolumeId = 0;
00052   gsoIncRefFaceId = 0;
00053   gsoIncRefEdgeId = 0;
00054   gsoIncRefVertexId = 0;
00055   gsoErrorCount = 0;
00056   gsoErrorIdList.clean_out();
00057 }
00058 
00059 int 
00060 GSaveOpen::get_id_inc( RefEntity *entity )
00061 {
00062   const std::type_info* my_type = &entity->entity_type_info();
00063 
00064   if( *my_type == typeid(Body) )
00065     return gsoIncBodyId;
00066   else if( *my_type == typeid(RefVolume) )
00067     return gsoIncRefVolumeId;
00068   else if( *my_type == typeid(RefFace) )
00069     return gsoIncRefFaceId;
00070   else if( *my_type == typeid(RefEdge) )
00071     return gsoIncRefEdgeId;
00072   else if( *my_type == typeid(RefVertex) )
00073     return gsoIncRefVertexId;
00074 
00075   return -1; // This function doesn't understand the type
00076 }
00077 
00078 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines