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 #include <QString>
00024 #include <QList>
00025 #include <QMap>
00026
00027 #include <ost/gfx/gfx_object.hh>
00028
00029 #include <ost/gui/module_config.hh>
00030 #include <ost/gui/remote_site_loader.hh>
00031 #include <ost/gui/loader_manager.hh>
00032
00033 #include <ost/io/io_exception.hh>
00034 #include <ost/io/entity_io_handler.hh>
00035 #include <ost/io/sequence_io_handler.hh>
00036 #include <ost/io/surface_io_handler.hh>
00037 #if OST_IMG_ENABLED
00038 #include <ost/io/map_io_handler.hh>
00039 #endif
00040
00041 namespace ost { namespace gui {
00042
00043 class DLLEXPORT_OST_GUI FileLoader {
00044 private:
00045
00046 enum ErrorType { DEFAULT = 0,
00047 IO_LOADING,
00048 GFX_ADD,
00049 GFX_MULTIPLE_ADD,
00050 INFO
00051 };
00052
00053 FileLoader();
00054 static gfx::GfxObjP TryLoadEntity(const QString& filename, io::EntityIOHandlerP handler=io::EntityIOHandlerP(), const QString& selection=QString());
00055 static gfx::GfxObjP TryLoadSurface(const QString& filename, io::SurfaceIOHandlerPtr handler=io::SurfaceIOHandlerPtr());
00056 static gfx::GfxObjP TryLoadAlignment(const QString& filename, io::SequenceIOHandlerPtr handler=io::SequenceIOHandlerPtr());
00057 #if OST_IMG_ENABLED
00058 static gfx::GfxObjP TryLoadMap(const QString& filename, io::MapIOHandlerPtr handler=io::MapIOHandlerPtr());
00059 #endif
00060 static void RunScript(const QString& filename);
00061 static void LoadPDB(const QString& filename, const QString& selection=QString());
00062 static void AddToScene(const QString& filename, gfx::GfxObjP obj);
00063 static void HandleError(Message m, ErrorType type, const QString& filename, gfx::GfxObjP obj=gfx::GfxObjP());
00064 static gfx::GfxObjP NoHandlerFound(const QString& filename);
00065 virtual ~FileLoader();
00066
00067 static LoaderManagerPtr loader_manager_;
00068
00069 #if OST_IMG_ENABLED
00070 static QList<img::ImageHandle> loaded_images_;
00071 #endif
00072
00073 public:
00074 static void LoadObject(const QString& filename, const QString& selection=QString());
00075 static void LoadFrom(const QString& id, const QString& site=QString(), const QString& selection=QString());
00076 static std::vector<String> GetSiteLoaderIdents();
00077 static LoaderManagerPtr GetLoaderManager();
00078 };
00079
00080 } }
00081
00082 #endif