/*ROMTEAM WorldEditor*/
/*//////////////////////////////////////////////////////////////////////////////////////*/
/* File        : Shape3D.h: interface for the Shape3D class.*/
/* Author      : Ionut Grozea & Cristi Petrescu*/
/* Date        : 97.11*/
/* Description :*/
/*//////////////////////////////////////////////////////////////////////////////////////*/
 
 
/* (c) Ubi Studios 1997*/
/* See Ionut & Cristi for any comment or question*/
 
#ifndef __SHAPE3D_HPP__
#define __SHAPE3D_HPP__
 
/****************************************/
#ifndef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#endif
/****************************************/
 
/****************************************/
/* classes*/
/****************************************/
class Geometry3D_Interface;
 
/*ROMTEAM WorldEditor (Cristian Stegaru 01/98)*/
#define STR_LENGTH		200
#define NB_LENGTH		10
/*ENDROMTEAM WorldEditor (Cristian Stegaru)*/
 
class CPA_EXPORT Shape3D : public Geometry3D  
{
/* data*/
protected:
/* activate/inactivate user interactions*/
	BOOL					m_bModifiable;
/* for the mouse interaction (resizing)*/
	BOOL					m_bActiveMode;
	MTH3D_tdstVector			m_stGlobalSelectedPoint;      /* The 3D coordinates of the point of the object pointed by the mouse in the global repere*/
    MTH3D_tdstVector			m_stLocalSelectedPoint;       /* The 3D coordinates of the same point in the local repere*/
/* the super object for real positioning*/
/* we need that because we ought to know where is our object placed in space*/
	CPA_SuperObject			*m_pSuperObject;
   
/* engine handle*/
	ACP_tdxHandleOfElement	m_hElement;
/* keyboard*/
	static BOOL				m_bSizeKeyPressed;
/* the Geometric DLL*/
	static Geometry3D_Interface *m_pGeometry3DDLL;
	
/* members*/
public:
 
/*ROMTEAM WorldEditor (Cristian Stegaru 01/98)*/
	virtual void mfn_vSave (CString csEPOFile, CString csEPOName, int iIdx);
	virtual void mfn_vLoad (CString csEPOFile, CString csEPOName);
	void EndCreate();
/*ENDROMTEAM WorldEditor (Cristian Stegaru)*/
 
/* inits, for data like keyb configuration*/
	static void SetGeometry3DDLL (Geometry3D_Interface *pGeometry3DDLL) {m_pGeometry3DDLL = pGeometry3DDLL;};
/* mouse interface*/
	virtual	BOOL _OnLButtonUp (UINT nFlags, tdstMousePos * p_stPos);
	virtual	BOOL _OnLButtonDown (UINT nFlags, tdstMousePos * p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo * p_stObject);
	virtual	BOOL _OnMouseMove (UINT nFlags, tdstMousePos * p_stPos, MTH3D_tdstVector * pDeplacement);
	virtual BOOL _OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo);
/* keyboard interface*/
	static BOOL _OnKeyUp (UINT nChar , UINT nRepCnt = 0, UINT nFlags = 0);
	static BOOL _OnKeyDown(UINT nChar, UINT nRepCnt = 0, UINT nFlags = 0);
/* constructors/destructor*/
	Shape3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements, const CString _csName = "", tdeSaveStatus _eStatus = E_ss_NoSave);
	Shape3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements, CPA_BaseObject *_p_oOwnerFile, const CString _csName = "", char *_p_cRefPath = NULL, tdeSaveStatus _eStatus = E_ss_Responsible);
	Shape3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName = "", char *_p_cRefPath = NULL, tdeSaveStatus _eStatus = E_ss_Modify);
/* access the Engine handle*/
	ACP_tdxHandleOfElement GetEngineHandle () {return m_hElement;};
/* set the SuperObject*/
	void SetSuperObject (CPA_SuperObject *pSuperObject) {m_pSuperObject = pSuperObject;};
/* essential data*/
	virtual MTH3D_tdstVector GetCenter  () { MTH3D_tdstVector jj; return jj; };                    /* return the 3D coordinates of the center of the sphere*/
    virtual void           SetCenter  (MTH3D_tdstVector *) {};    /* set the 3D coordinates of the center of the sphere*/
	virtual CPA_Modif *GetUndoData(){ return NULL; }
 
 
	~Shape3D();
protected:
	void ConvertPointGlobalToLocal (MTH3D_tdstVector * pDest , POS_tdstCompletePosition * pAbsoluteMatrix , MTH3D_tdstVector * pSource);
	void ConvertPointLocalToGlobal (MTH3D_tdstVector * pDest , POS_tdstCompletePosition * pAbsoluteMatrix , MTH3D_tdstVector * pSource);
	void ConvertVectorGlobalToLocal (MTH3D_tdstVector * pDest , POS_tdstCompletePosition * pAbsoluteMatrix , MTH3D_tdstVector * pSource);
	void ConvertVectorLocalToGlobal (MTH3D_tdstVector * pDest , POS_tdstCompletePosition * pAbsoluteMatrix , MTH3D_tdstVector * pSource);
 
private:
	void CommonShape3D (void);
};
 
#endif /* __SHAPE3D_HPP__*/
