/*
------------------------------------------------------------------------------------------
HEADER FILE FOR :
  Definition of functions and sturctures for waypoints
------------------------------------------------------------------------------------------
File Name :
 WPWayPt.h
------------------------------------------------------------------------------------------
Creation :
  * Date : 
    March 10, 1997
  * Author : 
    Albert PAIS
------------------------------------------------------------------------------------------
Contents :
  This files defines functions and structures for managing waypoints.
------------------------------------------------------------------------------------------
Remarks :
  Part of code comes from previous waypoint.c/.h
------------------------------------------------------------------------------------------
See Also :
  WPWayPt.c for implementation
------------------------------------------------------------------------------------------
Module tag :
  WP
------------------------------------------------------------------------------------------
Modification :
  * Date : 
  * Author : 
  * Modify :
------------------------------------------------------------------------------------------
*/
 
/* in order to compile AI in C++ and link with GAM in C*/
#if defined(__cplusplus)
extern "C"
{
#endif
 
#if !defined(__WPWAYPT_TYPES__)
#define __WPWAYPT_TYPES__
 
#if !defined(ONLY_TYPES)
#define WPWAYPT_UNDEF
#define ONLY_TYPES
#endif /* !ONLY_TYPES */
 
/*
------------------------------------------------------------------------------------------
INCLUDE FILES :
------------------------------------------------------------------------------------------
*/
#include "Acp_Base.h"
#include "SPO.h"
/*#include "SCR.h"*/
#include "MTH.h"
 
/*
----------------------------------------
File Name :
 WP_Handl.h
----------------------------------------
Required for :
 Defines waypoint handles.
----------------------------------------
*/
#define _WP_D_DEFINE_WAYPOINTS_
#include "WP_Handl.h"
#include "WP_Func.h"
 
 
#if defined(WPWAYPT_UNDEF)
#undef ONLY_TYPES
#undef WPWAYPT_UNDEF
#endif /* !WPWAYPT_UNDEF */
 
/*
------------------------------------------------------------------------------------------
TYPE AND STRUCTURE DEFINITION :
------------------------------------------------------------------------------------------
*/
/*
----------------------------------------
Type definition :
 Waypoint structure and handle
----------------------------------------
 Structure Name :
 WP_tdstWayPoint_
 Type def :
 WP_tdstWayPoint
 Handle :
 WP_tdhWayPoint
----------------------------------------
Creation Date : 
  March 10,1997
Author : 
  Albert PAIS
----------------------------------------
Members :
  * Type    : MTH3D_tdstVector
    Name    : m_stVertex
    Meaning : The position of the waypoint
  * Type    : MTH_tdxReal
    Name    : m_xRadius
    Meaning : The raidus of the waypoint
  * Type    : HIE_tdxHandleToSuperObject
    Name    : m_hSuperObject
    Meaning : The owner of the waypoint 
    (invalid value if the waypoint is 
    static).
  * Type    : unsigned char
    Name    : m_ucUsedCount
    Meaning : The used count of the waypoint
---------------------------------------
*/
#ifdef _WP_D_WAYPOINT_FRIEND_
typedef struct WP_tdstWayPoint_
{
/* ANNECY AV {*/
/* struct GEO_tdstGeometricObject_ *m_p_stGeoObj;    Not used anymore*/
/* END ANNECY AV }*/
 MTH3D_tdstVector m_stVertex;
 MTH_tdxReal m_xRadius;
 HIE_tdxHandleToSuperObject m_hSuperObject;
/* ANNECY AV {*/
/* unsigned char m_ucUsedCount;    // Not used anymore*/
/* END ANNECY AV }*/
}WP_tdstWayPoint;
#endif /* _WP_D_WAYPOINT_FRIEND_ */
/* allready defined in WP_Handl.h
typedef struct WP_tdstWayPoint_* WP_tdhWayPoint;
*/
 
#endif /* !__WPWAYPT_TYPES__ */
 
#if !defined(ONLY_TYPES)
 
#if !defined(__WPWAYPT_VARS__)
#define __WPWAYPT_VARS__
 
#undef WP_WAYPOINT_EXTERN
#undef extern
#if !defined(WP_D_WAYPOINT_GLOBALS_)
#define WP_WAYPOINT_EXTERN extern
#else /* !WP_D_WAYPOINT_GLOBALS_ */
#define WP_WAYPOINT_EXTERN
#endif /* !WP_D_WAYPOINT_GLOBALS_ */
 
/*
------------------------------------------------------------------------------------------
VARIABLE DECLARATION :
 <type> <variable name>
 #if defined(WP_D_WAYPOINT_GLOBALS_)
 = <initial values>
 #endif
 ;
------------------------------------------------------------------------------------------
*/
 
/*
------------------------------------------------------------------------------------------
MACROS-CONSTANT DECLARATION:
------------------------------------------------------------------------------------------
*/
/* allready defined in WP_Handl.h
#define WP_C_hWayPointInvalid ((WP_tdhWayPoint)0)
*/
 
#undef extern
#endif /* !__WPWAYPT_VARS__ */
 
#if !defined (__WPWAYPT_PROTOS__)
#define __WPWAYPT_PROTOS__
 
/****************************************/
#if !defined(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 /*CPA_WANTS_IMPORT || CPA_WANTS_EXPORT*/
#endif /*CPA_EXPORT*/
/****************************************/
 
/*
------------------------------------------------------------------------------------------
MACROS-FUNCTIONS DECLARATION:
------------------------------------------------------------------------------------------
*/
#if defined(_WP_D_WAYPOINT_FRIEND_)
/* Friend modules can access directly to the field :*/
#define WP_M_vWayPointGetStructureField(_hWayPt,_pxPointer,_SlotName)\
 (*(_pxPointer) = (_hWayPt)->m_st##_SlotName)
#define WP_M_xWayPointGetScalarField(_hWayPt,_Prefix,_SlotName)\
 ((_hWayPt)->m_##_Prefix ##_SlotName)
#define WP_M_vWayPointSetStructureField(_hWayPt,_pxPointer,_SlotName)\
 ((_hWayPt)->m_st##_SlotName = *(_pxPointer))
#define WP_M_vWayPointSetScalarField(_hWayPt,_xScalar,_Prefix,_SlotName)\
 ((_hWayPt)->m_##_Prefix ##_SlotName = (_xScalar))
 
#define WP_M_uwWayPointSizeOf()\
 ((unsigned short)(sizeof(struct WP_tdstWayPoint_)))
 
 
#else /* _WP_D_WAYPOINT_FRIEND_ */
/* Non friend modules accesss fields through functions */
#define WP_M_vWayPointGetStructureField(_hWayPt,_pxPointer,_SlotName)\
 (WP_fnv_WayPoint_Get##_SlotName(_hWayPt,_pxPointer))
#define WP_M_xWayPointGetScalarField(_hWayPt,_Prefix,_SlotName)\
 (WP_fn##_Prefix_WayPoint_Get##_SlotName(_hWayPt))
#define WP_M_vWayPointSetStructureField(_hWayPt,_pxPointer,_SlotName)\
 (WP_fnv_WayPoint_Set##_SlotName(_hWayPt,_pxPointer))
#define WP_M_vWayPointSetScalarField(_hWayPt,_xScalar,_Prefix,_SlotName)\
 (WP_fnv_WayPoint_Set##_SlotName(_hWayPt,_xScalar))
 
#define WP_M_uwWayPointSizeOf()\
 WP_fnuw_WayPoint_SizeOf()
#endif /* _WP_D_WAYPOINT_FRIEND_ */
 
/* accessing to fields :*/
#define WP_M_vWayPointGetVertex(_hWayPt,_pstVertex)\
 WP_M_vWayPointGetStructureField(_hWayPt,_pstVertex,Vertex)
#define WP_M_vWayPointSetVertex(_hWayPt,_pstNuevoVertex)\
 WP_M_vWayPointSetStructureField(_hWayPt,_pstNuevoVertex,Vertex)
 
#define WP_M_xWayPointGetRadius(_hWayPt)\
 WP_M_xWayPointGetScalarField(_hWayPt,x,Radius)
#define WP_M_vWayPointSetRadius(_hWayPt,_xNuevoRadius)\
 WP_M_vWayPointSetScalarField(_hWayPt,_xNuevoRadius,x,Radius)
 
#define WP_M_hWayPointGetSuperObject(_hWayPt)\
 WP_M_xWayPointGetScalarField(_hWayPt,h,SuperObject)
#define WP_M_vWayPointSetSuperObject(_hWayPt,_hNuevoSuperObj)\
 WP_M_vWayPointSetScalarField(_hWayPt,_hNuevoSuperObj,h,SuperObject)
 
#define WP_M_ucWayPointGetUsedCount(_hWayPt)\
 WP_M_xWayPointGetScalarField(_hWayPt,uc,UsedCount)
#define WP_M_vWayPointSetUsedCount(_hWayPt,_ucNuevoUsedCount)\
 WP_M_vWayPointSetScalarField(_hWayPt,_ucNuevoUsedCount,uc,UsedCount)
 
 
/*
------------------------------------------------------------------------------------------
FUNCTIONS DECLARATION:
------------------------------------------------------------------------------------------
*/
CPA_EXPORT void fn_vDrawWayPoint(struct WP_tdstWayPoint_ *p_stWayPt);
/* creation function :*/
CPA_EXPORT WP_tdhWayPoint WP_fnh_WayPoint_Create(void);
/* destruction */
CPA_EXPORT void WP_fnv_WayPoint_Destroy(WP_tdhWayPoint);
/* add reference and release */
CPA_EXPORT void WP_fnv_WayPoint_AddRef(WP_tdhWayPoint);
CPA_EXPORT void WP_fnv_WayPoint_Release(WP_tdhWayPoint);
/* "constructor" : */
CPA_EXPORT WP_tdhWayPoint WP_fnh_WayPoint_Build(MTH3D_tdstVector*,MTH_tdxReal,HIE_tdxHandleToSuperObject);
/* duplicate : */ 
CPA_EXPORT WP_tdhWayPoint WP_fnh_WayPoint_Duplicate(WP_tdhWayPoint);
/* copy */
CPA_EXPORT void WP_fnv_WayPoint_Copy(WP_tdhWayPoint,WP_tdhWayPoint);
/* sizeof */
CPA_EXPORT unsigned short WP_fnuw_WayPoint_SizeOf(void);
/* accessing to members :*/
CPA_EXPORT void WP_fnv_WayPoint_GetVertex(WP_tdhWayPoint,MTH3D_tdstVector*);
CPA_EXPORT void WP_fnv_WayPoint_SetVertex(WP_tdhWayPoint,MTH3D_tdstVector*);
 
CPA_EXPORT MTH_tdxReal WP_fnx_WayPoint_GetRadius(WP_tdhWayPoint);
CPA_EXPORT void WP_fnv_WayPoint_SetRadius(WP_tdhWayPoint,MTH_tdxReal);
 
CPA_EXPORT HIE_tdxHandleToSuperObject WP_fnh_WayPoint_GetSuperObject(WP_tdhWayPoint);
CPA_EXPORT void WP_fnv_WayPoint_SetSuperObject(WP_tdhWayPoint,HIE_tdxHandleToSuperObject);
 
CPA_EXPORT unsigned char WP_fnuc_WayPoint_GetUsedCount(WP_tdhWayPoint);
CPA_EXPORT void WP_fnv_WayPoint_SetUsedCount(WP_tdhWayPoint,unsigned char);
 
/* validity of handles : */
CPA_EXPORT void WP_fnv_WayPoint_Invalidate(WP_tdhWayPoint*);
CPA_EXPORT ACP_tdxBool WP_fnb_WayPoint_IsValid(WP_tdhWayPoint);
CPA_EXPORT ACP_tdxBool WP_fnb_WayPoint_IsInvalid(WP_tdhWayPoint);
 
CPA_EXPORT ACP_tdxBool WP_fnb_WayPoint_IsDynamic(WP_tdhWayPoint);
CPA_EXPORT ACP_tdxBool WP_fnb_WayPoint_IsStatic(WP_tdhWayPoint);
 
/* loading waypoints */
#if !defined(U64)
CPA_EXPORT SCR_tde_Anl_ReturnValue WP_fne_WayPoint_ScriptCallBackLoad(SCR_tdst_File_Description *,char *,char **, SCR_tde_Anl_Action);
CPA_EXPORT SCR_tde_Anl_ReturnValue WP_fne_WayPoint_ScriptSubSectionCallBackLoad(SCR_tdst_File_Description *,char *,char **, SCR_tde_Anl_Action);
/*ANNECY Bart 19/01/98 {*/
CPA_EXPORT SCR_tde_Anl_ReturnValue WP_fne_WPGraph_ScriptCallBackLoad(SCR_tdst_File_Description *,char *,char **, SCR_tde_Anl_Action);
CPA_EXPORT SCR_tde_Anl_ReturnValue WP_fne_WPSommet_ScriptCallBackLoad(SCR_tdst_File_Description *,char *,char **, SCR_tde_Anl_Action);
CPA_EXPORT void WP_fn_vReloadWPGraph(char* szNameOfGraph);
/*ENDANNECY Bart }*/
 
#endif /* U64 */
 
/* export link table */
CPA_EXPORT struct SCR_tdst_Link_Table_ *WP_fnp_WayPoint_GetLinkTable (void);
 
/* add by jt*/
/* compute second pass */
/*CPA_EXPORT void WP_fnv_WayPoint_LinkTableSecondPass (void);*/
 
/* tools */
CPA_EXPORT void WP_fnv_WayPoint_ComputeLocation(WP_tdhWayPoint,MTH3D_tdstVector*);
 
#endif /* !__WPWAYPT_PROTOS__ */
 
#endif /* !ONLY_TYPES */
 
 
 
/* in order to compile AI in C++ and link with GAM in C*/
#if defined(__cplusplus)
}
#endif
 
