VRUT::IOVrmlModule Class Reference

FHS import/export module class. More...

#include <iovrml.h>

Inheritance diagram for VRUT::IOVrmlModule:

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

List of all members.

Public Member Functions

 IOVrmlModule (const MODULE_ID &_id, const wxString &_name, EventHandler *msgSink)
 Class constructor.
virtual ~IOVrmlModule ()
 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 - SceneIOModule overload.

Protected Member Functions

virtual void processEvent (wxCommandEvent &evt)
 Process render event - Module overload.

Protected Attributes

bool teselate
 teselate primitives during import?
bool hFlag
 save also hierarchy?
bool extraCams
 create extra cameras?
Parameter::ParameterIdentificator teselateParamID
 teselate param identificator
Parameter::ParameterIdentificator hierarchyFlagParamID
 save hierarchy
Parameter::ParameterIdentificator extraCamsParamID
 save extra cameras


Detailed Description

FHS import/export module class.

Definition at line 23 of file iovrml.h.


Constructor & Destructor Documentation

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

Class constructor.

Definition at line 21 of file iovrml.cpp.

00022               : IOModule(_id, _name, 0, msgSink)
00023 {
00024        teselate = true;
00025        REGISTER_PARAM_GUI_CHECKBOX(teselateParamID, wxT("teselate"), wxT("1"), wxT("teselate"));
00026        hFlag = true;
00027        REGISTER_PARAM_GUI_CHECKBOX(hierarchyFlagParamID, wxT("hFlag"), wxT("1"), wxT("Hierarchy flag."));
00028        extraCams = true;
00029        REGISTER_PARAM_GUI_CHECKBOX(extraCamsParamID, wxT("extraCams"), wxT("1"), wxT("Export extra cameras"));
00030 }

IOVrmlModule::~IOVrmlModule (  )  [virtual]

Class destructor.

Definition at line 33 of file iovrml.cpp.

00034 {
00035 }


Member Function Documentation

void IOVrmlModule::processEvent ( wxCommandEvent &  evt  )  [protected, virtual]

Process render event - Module overload.

Reimplemented from VRUT::IOModule.

Definition at line 37 of file iovrml.cpp.

00038 {
00039        IOModule::processEvent(evt);
00040        switch (evt.GetEventType())
00041        {
00042        case Event::EVT_PARAM_SET:
00043               {
00044                      UPDATE_PARAM_FROM_EVENT_BOOL(teselateParamID, teselate, evt);
00045                      UPDATE_PARAM_FROM_EVENT_BOOL(hierarchyFlagParamID, hFlag, evt);
00046                      UPDATE_PARAM_FROM_EVENT_BOOL(extraCamsParamID, extraCams, evt);
00047               }
00048               break;
00049        default:
00050               break;
00051        }
00052 }

wxString IOVrmlModule::GetDesc (  )  const [virtual]

Get module description - Module overload.

Implements VRUT::Module.

Definition at line 54 of file iovrml.cpp.

00055 {
00056        return wxT("Import and export VRML files with scene hierarchy and geometry data");
00057 }

wxString IOVrmlModule::GetSupportedExts (  )  const [virtual]

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

Implements VRUT::IOModule.

Definition at line 60 of file iovrml.cpp.

00061 {
00062        return wxT("WRL");
00063 }

bool IOVrmlModule::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

is gzip file?

Implements VRUT::IOModule.

Definition at line 66 of file iovrml.cpp.

00067 {
00068        wxStopWatch sw;
00069        bool ret = false;
00070        wxInputStream * is = GetInputStream(fname);
00071        if (is)
00072        {
00074            unsigned char buffer[2];
00075            is -> Read(buffer, sizeof(unsigned char)*2);
00076            if ( buffer[0] == 31 && buffer[1] == 139){
00077             wxFileName wxFname(fname);
00078             delete is;
00079             is = new wxFileInputStream(wxFname.GetFullPath());
00080             is = new wxZlibInputStream(is,wxZLIB_GZIP);
00081             VRMLParser vrmlParser2(is, _sceneID, fname, this);
00082                       ret = vrmlParser2.Parse(rootUid, teselate, NULL);
00083                       delete is;
00084         }
00085            else {
00086              is -> Ungetch(buffer,  sizeof(unsigned char)*2);
00087         VRMLParser vrmlParser(is, _sceneID, fname, this);
00088         ret = vrmlParser.Parse(rootUid, teselate, NULL);
00089                   delete is;
00090            }
00091        }
00092        LOG(wxString::Format(wxT("<VRMLParser>Scene parsed in %.3f secs, ID %i"), 0.001f * sw.Time(), _sceneID));
00093        wxCommandEvent ev = Event::GET_EVT_IO_SCENE_IMPORT_DONE(_sceneID);
00094        PostToKernel(ev);
00095        return ret;
00096 }

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

Export scene to file - SceneIOModule overload.

Implements VRUT::IOModule.

Definition at line 99 of file iovrml.cpp.

00100 {
00101 //     if(hFlag == 1) return false;
00102        LOG(wxT("<IOVrmlModule>Inside IOVrmlModule::ExportScene"));
00103        wxOutputStream * sceneStream = new wxFileOutputStream(fname);
00104        if (sceneStream && sceneStream->IsOk())
00105        {
00106               wxBufferedOutputStream *sceneStream2=new wxBufferedOutputStream(*sceneStream);
00107               VRMLWriter vrmlWriter(sceneStream2, scene, fname);
00108               vrmlWriter.Write(hFlag, extraCams);
00109               sceneStream2->Sync();
00110               SAFE_DELETE(sceneStream2);
00111               return true;
00112        }
00113        SAFE_DELETE(sceneStream);
00114        return false;
00115 }


Member Data Documentation

bool VRUT::IOVrmlModule::teselate [protected]

teselate primitives during import?

Definition at line 27 of file iovrml.h.

bool VRUT::IOVrmlModule::hFlag [protected]

save also hierarchy?

Definition at line 29 of file iovrml.h.

create extra cameras?

Definition at line 31 of file iovrml.h.

teselate param identificator

Definition at line 33 of file iovrml.h.

save hierarchy

Definition at line 35 of file iovrml.h.

save extra cameras

Definition at line 37 of file iovrml.h.


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

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