OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
file_loader.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GUI_FILE_LOADER_HH
20 #define OST_GUI_FILE_LOADER_HH
21 #include <vector>
22 
23 
24 #include <ost/gfx/gfx_object.hh>
25 
26 #include <ost/gui/module_config.hh>
27 
28 #include <ost/io/io_exception.hh>
33 
34 #include <QString>
35 #include <QList>
36 #include <QMap>
37 namespace ost { namespace gui {
38 
40 private:
41 
42  enum ErrorType { DEFAULT = 0,
43  IO_LOADING,
44  GFX_ADD,
45  GFX_MULTIPLE_ADD,
46  INFO
47  };
48 
49  FileLoader();
50  static gfx::GfxObjP TryLoadEntity(const QString& filename, io::EntityIOHandlerP handler=io::EntityIOHandlerP(), const QString& selection=QString());
51  static gfx::GfxObjP TryLoadSurface(const QString& filename, io::SurfaceIOHandlerPtr handler=io::SurfaceIOHandlerPtr());
52  static gfx::GfxObjP TryLoadAlignment(const QString& filename, io::SequenceIOHandlerPtr handler=io::SequenceIOHandlerPtr());
53  static gfx::GfxObjP TryLoadMap(const QString& filename, io::MapIOHandlerPtr handler=io::MapIOHandlerPtr());
54  static void RunScript(const QString& filename);
55  static void LoadPDB(const QString& filename, const QString& selection=QString());
56  static void AddToScene(const QString& filename, gfx::GfxObjP obj);
57  static void HandleError(const Error& e, ErrorType type, const QString& filename, gfx::GfxObjP obj=gfx::GfxObjP());
58  static gfx::GfxObjP NoHandlerFound(const QString& filename);
59  virtual ~FileLoader();
60  static QList<img::ImageHandle> loaded_images_;
61 
62 public:
63  static void LoadObject(const QString& filename, const QString& selection=QString());
64  static std::vector<String> GetSiteLoaderIdents();
65 };
66 
67 } }
68 
69 #endif /* OST_GUI_FILE_LOADER_HH */
boost::shared_ptr< SequenceIOHandler > SequenceIOHandlerPtr
boost::shared_ptr< GfxObj > GfxObjP
boost::shared_ptr< EntityIOHandler > EntityIOHandlerP
#define DLLEXPORT_OST_GUI
boost::shared_ptr< MapIOHandler > MapIOHandlerPtr
boost::shared_ptr< SurfaceIOHandler > SurfaceIOHandlerPtr
def LoadPDB
Definition: __init__.py:87