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

ReferenceModel.cpp

Go to the documentation of this file.
00001 #include "ReferenceModel.h"
00002 
00003 using namespace model;
00004 
00005 ReferenceModel::ReferenceModel() {
00006         m_skeleton = new Skeleton();
00007 }
00008 
00026 ReferenceModel::ReferenceModel(Skeleton* skeleton) {
00027         m_skeleton = skeleton;
00028 }
00047 ReferenceModel::ReferenceModel(const ReferenceModel& other) {
00048         m_skeleton = other.m_skeleton;
00049         m_vertexs = other.m_vertexs;
00050         m_faces = other.m_faces;
00051         m_landmarks = other.m_landmarks;
00052         m_contours = other.m_contours;
00053         m_annotations = other.m_annotations;
00054 }  
00055 
00077 ReferenceModel& ReferenceModel::operator=(const ReferenceModel& other)
00078 {
00079     // if same object
00080     if ( this == &other )
00081         return *this;
00082         
00083         m_skeleton = other.m_skeleton;
00084         m_vertexs = other.m_vertexs;
00085         m_faces = other.m_faces;
00086         m_landmarks = other.m_landmarks;
00087         m_contours = other.m_contours;
00088         m_annotations = other.m_annotations;
00089 
00090     return *this;
00091 }  
00092 
00111 Skeleton* ReferenceModel::getSkeleton() {
00112         return m_skeleton;
00113 }
00114 
00133 void ReferenceModel::setSkeleton(Skeleton* skeleton) {
00134         m_skeleton = skeleton;
00135 }
00136 
00158 bool ReferenceModel::save(char* filename) {
00159         ofstream saveFile(filename);
00160         bool res = save(&saveFile);
00161         saveFile.close();
00162         return res;
00163 }
00164 
00186 bool ReferenceModel::save(ofstream* saveFile) {
00187         bool res = Model::save(saveFile);
00188         if(res) {
00189                 if(saveFile->is_open()) {
00190                         *saveFile << "Skeleton\n";
00191                         //m_skeleton->getBones();
00192                         return true;
00193                 } else {
00194                         return false;
00195                 }
00196         } else {
00197                 return false;
00198         }
00199 }
00200 
00222 bool ReferenceModel::load(char* filename) {
00223         ifstream loadFile(filename);
00224         bool res = load(&loadFile);
00225         loadFile.close();
00226         return res;
00227 }
00228 
00250 bool ReferenceModel::load(ifstream* loadFile) {
00251         bool res = Model::load(loadFile);
00252         if(res) {
00253                 string line;
00254                 vector<string> tokens;
00255                 vector<string> coords;
00256                 
00257                 if(loadFile->is_open()) {
00258                         getline(*loadFile,line);//Skeleton
00259                         getline(*loadFile,line);//Data
00260                         return true;
00261                 } else {
00262                         return false;
00263                 }
00264         } else {
00265                 return false;
00266         }
00267 }
00268 

Generated on Tue Apr 17 09:39:12 2007 for PCG Library by  doxygen 1.3.9.1