/*
 * $Id: ioobj.h,v 1.12 2008-06-06 20:02:36 kybav1 Exp $
 *
 * Description  : Module for OBJ import/export.
 * Author       : Antonin Misek <antonin.misek@skoda-auto.cz>
 *
 * Purpose      :
 *     Long description of what the file is for.
 */

#ifndef __IOOBJ__H__
#define __IOOBJ__H__

#include "iomodule.h"


namespace VRUT
{
	///STL import/export module class
	class IOObj : public IOModule
	{
	protected:
		/// optimize geometries during import
		bool optimize;
		///\c optimize param identifier
		Parameter::ParameterIdentifier optimizeParamID;

		class IOObjImportJob : public ThreadPoolJob
		{
			wxString fname;
			SCENE_ID sceneID;
			NODE_ID rootID;
			IOModule *module;
			bool optimize;
		public:
			IOObjImportJob(const wxString &fname, const SCENE_ID sceneID, const NODE_ID &rootID, IOModule *module, bool optimize)
				: ThreadPoolJob(), fname(fname), sceneID(sceneID), rootID(rootID), module(module), optimize(optimize) {}
			virtual ~IOObjImportJob() {}
			virtual void Run();
		};
		///Process event - \c SceneIOModule overload
		virtual void processEvent(Event * evt);
	public:
		///Class constructor
		IOObj(const MODULE_ID & _id, const wxString & _name, Kernel * _kernel);
		///Class destructor
		virtual ~IOObj();

		///Get module description - \c Module overload
		virtual wxString GetDesc() const;
		///Get string with file extensions supported by module - \c IOModule overload
		virtual wxString GetSupportedExts() const;
		///Import scene from file - \c SceneIOModule overload
		///\param[in] fname Path to scene files (archive)
		///\param[in] _sceneID ID of scene to be filled with data
		///\param[in] rootID ID of node where to start filling
		///\return \c True if successful
		virtual bool ImportScene(const wxString & fname, SCENE_ID _sceneID, const NODE_ID &rootID);
		///Export scene to file
		virtual bool ExportScene(smart_pointer_v2<Scene> &scene, const NODE_ID rootID, const wxString &fname);
	};
}

#endif
