VRUT::IOObjModule Class Reference

STL import/export module class. More...

#include <ioobj.h>

Inheritance diagram for VRUT::IOObjModule:

VRUT::IOModule VRUT::SceneModule VRUT::Module

List of all members.

Public Member Functions

 IOObjModule (const MODULE_ID &_id, const wxString &_name, EventHandler *msgSink)
 Process event - SceneIOModule overload.
virtual ~IOObjModule ()
 Class destructor.
virtual wxString GetDesc () const
 Get module description - Module overload.
virtual wxString GetSupportedExts () const
 Get string with file extensions supported by module - IOModule overload.
virtual bool ImportScene (const wxString &fname, SCENE_ID _sceneID, const wxString &rootUid)
virtual bool ExportScene (const wxString &fname, const Scene *scene)
 Export scene to file.


Detailed Description

STL import/export module class.

Definition at line 24 of file ioobj.h.


Constructor & Destructor Documentation

IOObjModule::IOObjModule ( const MODULE_ID _id,
const wxString &  _name,
EventHandler msgSink 
)

Process event - SceneIOModule overload.

Class constructor

Definition at line 20 of file ioobj.cpp.

00021               : IOModule(_id, _name, 0, msgSink)
00022 {
00023 }

IOObjModule::~IOObjModule (  )  [virtual]

Class destructor.

Definition at line 26 of file ioobj.cpp.

00027 {
00028 }


Member Function Documentation

wxString IOObjModule::GetDesc (  )  const [virtual]

Get module description - Module overload.

Implements VRUT::Module.

Definition at line 31 of file ioobj.cpp.

00032 {
00033        return wxT("Import and export OBJ files");
00034 }

wxString IOObjModule::GetSupportedExts (  )  const [virtual]

Get string with file extensions supported by module - IOModule overload.

Implements VRUT::IOModule.

Definition at line 37 of file ioobj.cpp.

00038 {
00039        return wxT("OBJ");
00040 }

bool IOObjModule::ImportScene ( const wxString &  fname,
SCENE_ID  _sceneID,
const wxString &  rootUid 
) [virtual]

Import scene from file - SceneIOModule overload

Parameters:
[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
Returns:
True if successful

Implements VRUT::IOModule.

Definition at line 56 of file ioobj.cpp.

00057 {
00058        wxStopWatch sw;
00059        bool ret = false;
00060        wxInputStream * is = GetInputStream(fname);
00061        if (is)
00062        {
00063               OBJParser objParser(is, _sceneID, fname, this);
00064               ret = objParser.Parse(rootUid);
00065               delete is;
00066        }
00067        LOG(wxString::Format(wxT("<IOObjModule>Scene parsed in %.3f secs, ID %i"), 0.001f * sw.Time(), _sceneID));
00068        wxCommandEvent ev = Event::GET_EVT_IO_SCENE_IMPORT_DONE(_sceneID);
00069        PostToKernel(ev);
00070        return ret;
00071 }

bool IOObjModule::ExportScene ( const wxString &  fname,
const Scene scene 
) [virtual]

Export scene to file.

Implements VRUT::IOModule.

Definition at line 74 of file ioobj.cpp.

00075 {
00076        wxOutputStream * sceneStream = new wxFileOutputStream(fname);
00077        if (sceneStream && sceneStream->IsOk())
00078        {
00079               wxBufferedOutputStream *sceneStream2=new wxBufferedOutputStream(*sceneStream);
00080               OBJWriter objWriter(sceneStream2, scene);
00081               objWriter.Write();
00082               sceneStream2->Sync();
00083               SAFE_DELETE(sceneStream);
00084               return true;
00085        }
00086        SAFE_DELETE(sceneStream);
00087        return false;
00088 }


The documentation for this class was generated from the following files:

Generated on Tue Mar 10 14:41:40 2009 for VRUT by  doxygen 1.5.5