#include <iomodule.h>

Public Member Functions | |
| IOModule (const MODULE_ID &_id, const wxString &_name, unsigned _type, EventHandler *msgSink) | |
| Class constructor. | |
| virtual | ~IOModule () |
| Class destructor. | |
| virtual wxString | GetSupportedExts () const =0 |
| Get string with file extensions supported by module. | |
| virtual bool | ImportScene (const wxString &fname, SCENE_ID _sceneID, const wxString &rootUid)=0 |
| virtual bool | ExportScene (const wxString &fname, const Scene *scene)=0 |
| Export scene to file. | |
Static Public Member Functions | |
| static wxInputStream * | GetInputStream (const wxString &fname) |
| Get input stream for given filename (gives ownership). | |
Protected Member Functions | |
| virtual void | processEvent (wxCommandEvent &evt) |
Process render event - Module overload. | |
Definition at line 23 of file iomodule.h.
| VRUT::IOModule::IOModule | ( | const MODULE_ID & | _id, | |
| const wxString & | _name, | |||
| unsigned | _type, | |||
| EventHandler * | msgSink | |||
| ) | [inline] |
Class constructor.
Definition at line 59 of file iomodule.h.
00060 : SceneModule(_id, _name, (_type | MODULE_TYPE_IO ), msgSink) 00061 { 00062 REGISTER_LISTENER(Event::EVT_IO_SCENE_IMPORT_DO); 00063 wxCommandEvent evt = Event::GET_EVT_PARAM_GUIUNREGISTER(Parameter::ParameterIdentificator(_name, wxT("*"), _id)); 00064 PostToKernel(evt); 00065 }
| virtual VRUT::IOModule::~IOModule | ( | ) | [inline, virtual] |
| virtual void VRUT::IOModule::processEvent | ( | wxCommandEvent & | evt | ) | [inline, protected, virtual] |
Process render event - Module overload.
Reimplemented from VRUT::SceneModule.
Reimplemented in VRUT::IORdfModule, VRUT::IOStlModule, VRUT::_io, and VRUT::IOVrmlModule.
Definition at line 27 of file iomodule.h.
00028 { 00029 SceneModule::processEvent(evt); 00030 switch (evt.GetEventType()) 00031 { 00032 case Event::EVT_IO_SCENE_IMPORT_DO: 00033 { 00034 SCENE_ID _sceneID = SCENE_ID(evt.GetId()); 00035 Scene * scene = GetSceneMgr()->GetScene(_sceneID); 00036 if (scene) 00037 { 00038 const SceneNode * root = scene->GetNode(NODE_ID(evt.GetInt())); 00039 if (root) 00040 { 00041 wxCommandEvent evCache = Event::GET_EVT_RENDER_CACHE_START(_sceneID); 00042 PostToKernel(evCache); 00043 ImportScene(evt.GetString(), _sceneID, root->GetUid()); 00044 } 00045 else 00046 LOGERROR(wxT("<IOModule>Invalid root node to start import")); 00047 } 00048 else 00049 LOGERROR(wxT("<IOModule>Invalid scene defined to start import")); 00050 } 00051 break; 00052 default: 00053 break; 00054 } 00055 }
| virtual wxString VRUT::IOModule::GetSupportedExts | ( | ) | const [pure virtual] |
Get string with file extensions supported by module.
Implemented in VRUT::IOFhsModule, VRUT::IOImageModule, VRUT::IOObjModule, VRUT::IORdfModule, VRUT::IOStlModule, VRUT::_io, VRUT::IOVrmlModule, and VRUT::IOScriptingModule.
| static wxInputStream* VRUT::IOModule::GetInputStream | ( | const wxString & | fname | ) | [inline, static] |
Get input stream for given filename (gives ownership).
Is bzip2 or gzip archive?
Is tar or zip archive?
Definition at line 72 of file iomodule.h.
00073 { 00074 wxFileName wxFname(fname); 00075 if (!wxFname.FileExists()) 00076 { 00077 LOGERROR(wxT("<IOModule>File '") + fname + wxT("' not found")); 00078 return (wxInputStream *)NULL; 00079 } 00080 00081 wxInputStream * sceneStream = new wxFileInputStream(wxFname.GetFullPath()); 00082 00084 const wxFilterClassFactory * ffactory = wxFilterClassFactory::Find(wxFname.GetFullName(), wxSTREAM_FILEEXT); 00085 if (ffactory) 00086 { 00087 sceneStream = ffactory->NewStream(sceneStream); 00088 wxFname.SetFullName(ffactory->PopExtension(wxFname.GetFullName())); 00089 } 00090 00092 const wxArchiveClassFactory * afactory = wxArchiveClassFactory::Find(wxFname.GetFullName(), wxSTREAM_FILEEXT); 00093 if (afactory) 00094 { 00095 sceneStream = afactory->NewStream(sceneStream); 00096 if (sceneStream) 00097 { 00098 wxArchiveEntry * entry(((wxArchiveInputStream *)sceneStream)->GetNextEntry()); 00099 if (entry) 00100 { 00101 wxFname = wxFileName(entry->GetInternalName()); 00102 ((wxArchiveInputStream *)sceneStream)->CloseEntry(); 00103 delete entry; 00104 } 00105 } 00106 } 00107 00108 if (!sceneStream || !sceneStream->IsOk()) 00109 { 00110 LOGERROR(wxT("<IOModule>File '") + fname + wxT("' cannot be read")); 00111 SAFE_DELETE(sceneStream); 00112 return (wxInputStream *)NULL; 00113 } 00114 00115 return sceneStream; 00116 }
| virtual bool VRUT::IOModule::ImportScene | ( | const wxString & | fname, | |
| SCENE_ID | _sceneID, | |||
| const wxString & | rootUid | |||
| ) | [pure virtual] |
Import scene from file
| [in] | fname | Path to scene files (archive) |
| [in] | _sceneID | ID of scene to be filled with data |
| [in] | rootUid | Uid of node where to start filling |
True if successful Implemented in VRUT::IOFhsModule, VRUT::IOImageModule, VRUT::IOObjModule, VRUT::IORdfModule, VRUT::IOStlModule, VRUT::_io, VRUT::IOVrmlModule, and VRUT::IOScriptingModule.
| virtual bool VRUT::IOModule::ExportScene | ( | const wxString & | fname, | |
| const Scene * | scene | |||
| ) | [pure virtual] |
Export scene to file.
Implemented in VRUT::IOFhsModule, VRUT::IOImageModule, VRUT::IOObjModule, VRUT::IORdfModule, VRUT::IOStlModule, VRUT::_io, VRUT::IOVrmlModule, and VRUT::IOScriptingModule.
1.5.5