GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_bsreptoworld.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  *****************************************************************************/
23 
24 #include "glc_bsreptoworld.h"
25 #include "../sceneGraph/glc_world.h"
26 #include "../glc_fileformatexception.h"
27 
29 {
30 
31 }
32 
34 {
35 
36 }
37 
39 {
41  // Test if the file exist and can be opened
43  if (!file.open(QIODevice::ReadOnly))
44  {
45  QString fileName(file.fileName());
46  QString message(QString("GLC_BSRepToWorld::CreateWorldFromBSRep File ") + fileName + QString(" doesn't exist"));
47  GLC_FileFormatException fileFormatException(message, fileName, GLC_FileFormatException::FileNotFound);
48  throw(fileFormatException);
49  }
50  file.close();
51  GLC_BSRep bsRep(file.fileName());
52  GLC_3DRep rep(bsRep.loadRep());
53  GLC_World* pWorld= new GLC_World();
54  pWorld->rootOccurence()->addChild(new GLC_StructOccurence(new GLC_3DRep(rep)));
55  return pWorld;
56 }

©2005-2013 Laurent Ribon