/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : WPObj.hpp
//   
// Definition of the waypoint editors objects   
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from  :	CPA_Object
//					CPA_EdMot<ACP_tdxHandleOfLink>
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 21 jan 1997                        Author: J Thénoz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date:			                      Author: 
// 
//
// 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/

#ifndef __WPOBJECT_HPP__
#define __WPOBJECT_HPP__

//----------------------------------------------------------------------
// Definition of the name of the models
	static CString csStaticModelName = "Static";
	static CString csDynamicModelName = "Dynamic";
	static CString csWaypointModelName = "Waypoint";
//----------------------------------------------------------------------


class DiaWP;
//class Way;
class Waypoint_Interface;

class WayPoint : public CPA_SaveObject, public CPA_EdMot<WP_tdhWayPoint> 
{
protected:
	static DiaWP* ms_poDiaWP;
	static BOOL ms_bRealDraw;
	static BOOL ms_bGlobalDraw;
	static BOOL ms_bNotifyHeader;
	static Waypoint_Interface* ms_poInterface;

	static BOOL ms_bOnScreen;
	static BOOL ms_bDrawJustIsolateWaypoint;
//ROMTEAM Networks (Gabriela Dumitrascu 02/03/98)
//	static CPA_List<WayPoint> ms_oListOfWaypoint;		// list of all the ways
//ENDROMTEAM Networks (Gabriela Dumitrascu)

	CPA_SuperObject* m_poSuperObject;
	BOOL m_bAbsoluteCoordinate;
	CPA_SuperObject* m_poFather;
	BOOL m_bCurrentDraw;
	BOOL m_bRealDraw;
	BOOL m_bAlone;		// this waypoint is created alone ( not in a way )
	BOOL m_bSave;		// this waypoint can be save
	BOOL m_bOnScreen;
	CPA_SuperObject* m_pSymbolicalGraphic;
	CPA_SuperObject* m_pRealGraphic;

	CPA_SuperObject * m_poDynamicFather;

public:
//ROMTEAM Networks (Gabriela Dumitrascu 02/03/98)
	static CPA_List<WayPoint> ms_oListOfWaypoint;		// list of all the ways
//ENDROMTEAM Networks (Gabriela Dumitrascu)
	//--- static 
	static void fn_vInitObject (Waypoint_Interface* poInterface);
	
	static void fn_vCallbackHeader ( SCR_tdst_File_Description *p_stFile,	char *_p_szSectionName, void *_p_vData,SCR_tde_Ntfy_Action	_eAction );
	static void fn_vCallbackSave ( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData,SCR_tde_Ntfy_Action _eAction );
	static void fn_vCallbackEmptySectionWaypointIsolate ( SCR_tdst_File_Description *p_stFile, char *_p_szSectionName, void *_p_vData,SCR_tde_Ntfy_Action	_eAction );
	static void fn_vCallbackEmptySectionWaypointInWay ( SCR_tdst_File_Description *p_stFile, char *_p_szSectionName, void *_p_vData,SCR_tde_Ntfy_Action	_eAction );

	static void fn_vSetDialog ( DiaWP* poDiaWP );
	static DiaWP* fn_pGetDialog ( void ) { return ms_poDiaWP; }
	static BOOL fn_bIsWaypointScreen (void) { return ms_bOnScreen; }
	static void fn_vSetWaypointOnScreen (BOOL bOnScreen) { ms_bOnScreen=bOnScreen; }
	static BOOL fn_bDrawJustIsolateWaypoint ( void ) { return ms_bDrawJustIsolateWaypoint; }
	static void fn_vSetDrawJustIsolateWaypoint ( BOOL bDrawJustIsolateWaypoint ) { ms_bDrawJustIsolateWaypoint=bDrawJustIsolateWaypoint;}

	static void fn_vSetNotifyHeader (BOOL bNotifyHeader) { ms_bNotifyHeader = bNotifyHeader; }
	static void fn_vRefreshWaypoint (void);
	static BOOL fn_bCheckWaypointCoherence (CPA_List<WayPoint> *poWaypointList=NULL);


	WayPoint( CPA_ObjectDLLBase *p_oDLL, BOOL bAlone=TRUE, CString csName="Waypoint1", BOOL bSave=TRUE );
	WayPoint ( CPA_ObjectDLLBase *p_oDLL, WP_tdhWayPoint hEngineWP, CString csName, CString csFileName, CString csSectionName );
	WayPoint( WayPoint& rWayPoint );
	~WayPoint();
	
	WayPoint& operator= (WayPoint& rWP);


	//--- data
	long GetDataType (void);
	void* GetData (void);


	//--- save
	void fn_vUpDateSectorSection	(void);
	void fn_vNotifySave				(void);
	void fn_vNotifyUnSave			(void);
	void fn_vNotifyRestore			(void);
	void fn_vNotifyRename			(void);
	void fn_vUpdateReference		(CPA_SaveObject *pReferencedObject);

	
	void *GetEngineStruct() { return GetStruct(); };
	void fn_vSetRadius (GLI_tdxValue* pxR);
	void fn_vSetCoordinate (BOOL bAbsolute);
	void fn_vSetFather (CPA_SuperObject* poFather);
	void fn_vChangeSystemCoordinate (void);
	GLI_tdxValue fn_xGetRadius (void);
	BOOL fn_bIsAlone (void) { return m_bAlone; }
	void fn_vSetAlone ( BOOL bAlone ) { m_bAlone=bAlone; }
	void fn_vSetSave ( BOOL bSave ) { m_bSave=bSave; }
	void fn_vSetSymbolicalGraphic ( CPA_SuperObject* poSymbolicalGraphic ) { m_pSymbolicalGraphic=poSymbolicalGraphic; }
	void fn_vSetRealGraphic ( CPA_SuperObject* poRealGraphic ) { m_pRealGraphic=poRealGraphic; }
// Shaitan Correction {
	CPA_SuperObject * GetSymbolicalGraphic (void) { return m_pSymbolicalGraphic; }
	CPA_SuperObject * GetRealGraphic (void) { return m_pRealGraphic; }
//End Shaitan Correction }
	BOOL fn_bGetCoordinate (void) { return m_bAbsoluteCoordinate; }
	CPA_SuperObject* fn_pGetFather (void);
	void fn_vSetOnScreen ( BOOL bOnScreen ) { m_bOnScreen = bOnScreen; }
	BOOL fn_bGetOnScreen (void) { return m_bOnScreen; }
	void SetSuperObject ( CPA_SuperObject* poSuperObject) { m_poSuperObject=poSuperObject; }
	CPA_SuperObject* GetSuperObject (void) { return m_poSuperObject; }

	CPA_SuperObject* fn_pGetDynamicFather (void);
	void fn_vSetDynamicFather (CPA_SuperObject* poDynamicFather);

	static Waypoint_Interface* GetInterface (void) { return ms_poInterface; }

	//------------------------------- compute motor object
	void fn_vComputeMotorStructure (void);
	
	//------------------------------- Drawing mode
	// draw 
	void fn_vDraw (BOOL bScreen=TRUE, BOOL bDestroy=TRUE); // draw the wp
	void fn_vDrawNewRadius (void);		// modify the draw of the radius if necessary
	// local drawing
	BOOL fn_bIsRealDraw (void) { return m_bRealDraw; }
	void fn_vSetRealDraw (BOOL bDrawMode) { m_bRealDraw=bDrawMode; }
	// global variables of drawing
	// mode of global drawing
	static BOOL fn_bIsGlobalRealDraw (void) { return ms_bRealDraw; }
	static void fn_vSetGlobalRealDraw (BOOL bGlobalDrawMode) { ms_bRealDraw=bGlobalDrawMode; }
	// global draw activate
	static BOOL fn_bIsGlobalDraw (void) { return ms_bGlobalDraw; }
	static void fn_vSetGlobalDraw (BOOL bGlobalDraw) { ms_bGlobalDraw=bGlobalDraw; }
	// general functions
	// solve local/global directions
	BOOL fn_bIsGeneralRealDraw (void) 	{ return ms_bGlobalDraw ? ms_bRealDraw : m_bRealDraw; }
	void fn_vSetGeneralRealDraw (BOOL bDrawMode) { if (ms_bGlobalDraw) fn_vSetGlobalRealDraw (bDrawMode); else fn_vSetRealDraw(bDrawMode); }

	BOOL fn_bIsWaypointDrawable (void);

	//-------------------------------- Coherence management
	BOOL fn_bCheckCoherence (void);
	BOOL fn_bIsReferencedInAI (void);
};

extern CPA_List<WayPoint> g_ListWayPoint;

#endif //__OBJECT_HPP__
