00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_GUI_FILE_LOADER_HH
00020 #define OST_GUI_FILE_LOADER_HH
00021 #include <vector>
00022
00023
00024 #include <ost/gfx/gfx_object.hh>
00025
00026 #include <ost/gui/module_config.hh>
00027
00028 #include <ost/io/io_exception.hh>
00029 #include <ost/io/mol/entity_io_handler.hh>
00030 #include <ost/io/seq/sequence_io_handler.hh>
00031 #include <ost/io/mol/surface_io_handler.hh>
00032 #if OST_IMG_ENABLED
00033 # include <ost/io/img/map_io_handler.hh>
00034 #endif
00035
00036 #include <QString>
00037 #include <QList>
00038 #include <QMap>
00039 namespace ost { namespace gui {
00040
00041 class DLLEXPORT_OST_GUI FileLoader {
00042 private:
00043
00044 enum ErrorType { DEFAULT = 0,
00045 IO_LOADING,
00046 GFX_ADD,
00047 GFX_MULTIPLE_ADD,
00048 INFO
00049 };
00050
00051 FileLoader();
00052 static gfx::GfxObjP TryLoadEntity(const QString& filename, io::EntityIOHandlerP handler=io::EntityIOHandlerP(), const QString& selection=QString());
00053 static gfx::GfxObjP TryLoadSurface(const QString& filename, io::SurfaceIOHandlerPtr handler=io::SurfaceIOHandlerPtr());
00054 static gfx::GfxObjP TryLoadAlignment(const QString& filename, io::SequenceIOHandlerPtr handler=io::SequenceIOHandlerPtr());
00055 #if OST_IMG_ENABLED
00056 static gfx::GfxObjP TryLoadMap(const QString& filename, io::MapIOHandlerPtr handler=io::MapIOHandlerPtr());
00057 #endif
00058 static void RunScript(const QString& filename);
00059 static void LoadPDB(const QString& filename, const QString& selection=QString());
00060 static void AddToScene(const QString& filename, gfx::GfxObjP obj);
00061 static void HandleError(const Error& e, ErrorType type, const QString& filename, gfx::GfxObjP obj=gfx::GfxObjP());
00062 static gfx::GfxObjP NoHandlerFound(const QString& filename);
00063 virtual ~FileLoader();
00064
00065
00066 #if OST_IMG_ENABLED
00067 static QList<img::ImageHandle> loaded_images_;
00068 #endif
00069
00070 public:
00071 static void LoadObject(const QString& filename, const QString& selection=QString());
00072 static std::vector<String> GetSiteLoaderIdents();
00073 };
00074
00075 } }
00076
00077 #endif