reman3/Rayman_X/cpa/tempgrp/Owp/inc/NtwObj.hpp

200 lines
7.4 KiB
C++

//ROMTEAM Networks (Gabriela Dumitrascu 25/02/98)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : NtwObj.hpp
//
// Definition of the graph editors objects
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from : CPA_Object
// CPA_EdMot<ACP_tdxHandleOfLink>
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 1998-03-02 Author: CPA2 Gabi Dumitrascu
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
///////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __NTWOBJ_HPP__
#define __NTWOBJ_HPP__
#define _WP_D_WPARC_FREIND_
#include "Wparc.h"
#include "ogd.h"
class NtwDia;
class Waypoint_Interface;
class Graph : public CPA_SaveObject, public CPA_EdMot<WP_tdHandleOfGraph>
{
//protected:
public:
static NtwDia* ms_poNtwDia;
static Waypoint_Interface* ms_poInterface;
static BOOL ms_bNotifyHeader;
// Shaitan Correction {
CPA_List<CPA_SuperObject> ms_oListOfArrows; // list of all arrows of the graph
//End Shaitan Correction }
CPA_SuperObject* m_poSuperObject; // super object
BOOL m_bSave;
public:
static CPA_List<Graph> ms_oListOfGraph; //// list of all the graph
//--- static
static void fn_vInitObject (Waypoint_Interface* poInterface);
static Waypoint_Interface* GetInterface (void) { return ms_poInterface; }
static void fn_vCallbackSave ( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData,SCR_tde_Ntfy_Action _eAction );
static void fn_vCallbackEmptySectionWPGraph( SCR_tdst_File_Description *p_stFile, char *_p_szSectionName, void *_p_vData,SCR_tde_Ntfy_Action _eAction );
static void fn_vCallbackEmptySectionWPSommet( SCR_tdst_File_Description *p_stFile, char *_p_szSectionName, void *_p_vData,SCR_tde_Ntfy_Action _eAction );
static void fn_vSetDialog ( NtwDia* poNtwDia );
static void fn_vSetNotifyHeader (BOOL bNotifyHeader) { ms_bNotifyHeader = bNotifyHeader; }
static void fn_vRefreshGraph (void);
static Graph* fn_pGetGraph(WP_tdhWayPoint hWP);
static NtwDia* fn_pGetDialog ( void ) { return ms_poNtwDia; }
static CPA_List<Graph>* fn_poGetListOfGraph (void) { return &ms_oListOfGraph; }
static WayPoint* GetWaypoint(WP_tdhWayPoint hWP);
Graph( CPA_ObjectDLLBase *p_oDLL, CString csName = "1", BOOL bSave = TRUE );
Graph ( CPA_ObjectDLLBase *p_oDLL, WP_tdHandleOfGraph hEngineGraph, CString csName, CString csFileName, CString csSectionName );
Graph( Graph& rGraph );
~Graph();
Graph& operator= (Graph& rGraph);
//--- data
long GetDataType (void);
void* GetData (void) {return GetStruct();}
// Unicity
tdeMissingCriteria fn_eCheckUnicity (const CString csNewName);
//--- save
void fn_vNotifySave (void);
void fn_vNotifyUnSave (void);
void fn_vNotifyRestore (void);
void fn_vNotifyRename (void);
void fn_vUpdateReference (CPA_SaveObject *pReferencedObject);
//---set
void SetSuperObject ( CPA_SuperObject* poSuperObject) { m_poSuperObject=poSuperObject; }
void fn_vSetSave (BOOL bSave) { m_bSave=bSave; }
//----get
CPA_SuperObject* GetSuperObject (void) {return m_poSuperObject;}
WP_tdHandleOfGraph GetEngineStruct() {return (WP_tdHandleOfGraph)GetStruct();}
// Shaitan Correction {
void fn_vAddNode(WP_tdhWayPoint hWP, BOOL pBlock);
BOOL fn_bRemoveNode(int iNode, BOOL pBlock);
void fn_vAddNode(WayPoint *pWP, BOOL pBlock);
BOOL fn_bRemoveNode(WayPoint *pWP, BOOL pBlock);
//End Shaitan Correction }
BOOL fn_bHasNode(WP_tdhWayPoint hWP) {return fn_iGetNodeOfWayPoint(hWP) != -1;}
BOOL fn_bHasNode(WayPoint *pWP) {return fn_bHasNode((WP_tdhWayPoint)pWP->GetEngineStruct());}
int fn_iGetNumberOfNodes() {return WPG_fn_lNumberOfWaypointOfGraph(GetEngineStruct());}
WP_tdhGraphNode fn_hGetNode(int iNode);
WP_tdhWayPoint fn_hGetWayPointOfNode(int iNode);
int fn_iGetNodeOfWayPoint(WP_tdhWayPoint hWP);
int fn_iGetNumberOfArcs(WP_tdhGraphNode hNode);
WP_tdHandleOfArc fn_hGetArc(WP_tdhGraphNode hNode, int iArc);
int fn_iGetArcOfNode(WP_tdhGraphNode hNode, WP_tdhGraphNode hArcNode);
BOOL fn_bNodeHasArc(WP_tdhGraphNode hNode, WP_tdhGraphNode hArcNode) {return fn_iGetArcOfNode(hNode, hArcNode) != -1;}
// Shaitan Correction {
void fn_vAddArcToNode(WP_tdhGraphNode hNode, WP_tdhGraphNode hArcNode, BOOL pBlock);
void fn_vAddArcToNode(WayPoint *pSrcNode, WayPoint *pDstNode, BOOL bUpdate, BOOL pBlock);
void fn_vRemoveArcOfNode(WP_tdhGraphNode hNode, int iArc, BOOL pBlock);
void fn_vRemoveArcOfNode(WayPoint *pSrcNode, WayPoint *pDstNode, BOOL pBlock);
//End Shaitan Correction }
void fn_vSetDefaultArcWeight(WP_tdhGraphNode hNode, int iArc);
void fn_vSetDefaultAllArcsWeight();
// Shaitan NewParam {
long fn_lGetDefaultArcWeight(WayPoint* pSrcNode, WayPoint* pDstNode);
void fn_vSetAllArcsCapacity(long lCapacity);
//End Shaitan NewParam }
// Shaitan Correction {
void fn_vInitGraphicConnections (void);
void fn_vUpdateConnection (CPA_SuperObject *pConnection, BOOL bUpdate);
void fn_vDisplayConnection (CPA_SuperObject *pConnection, BOOL bUpdate);
void fn_vDisplayAllLinks (BOOL bDisplay, BOOL bUpdate);
void fn_vDisplayOutLinks (WayPoint* pSrcNode, BOOL bUpdate);
void fn_vDisplayInLinks (WayPoint* pDstNode, BOOL bUpdate);
void fn_vUpdateConnections (WayPoint *pMovedWP, BOOL bUpdate);
void fn_vAddGraphicConnection (CPA_SuperObject *pConnection);
void fn_vRemoveGraphicConnection (CPA_SuperObject *pConnection);
CPA_SuperObject * GetGraphicConnection (WayPoint* pSrcNode, WayPoint* pDstNode);
void GetConnectionsToWaypoint (WayPoint *pNode, int iType, CPA_List<CPA_SuperObject> *pListToFill);
void SetConnectionCapacity (WayPoint *pSrcNode, WayPoint *pDstNode, long lCapacity);
void SetConnectionWeight (WayPoint *pSrcNode, WayPoint *pDstNode, long lWeight);
long GetConnectionCapacity (WayPoint *pSrcNode, WayPoint *pDstNode);
long GetConnectionWeight (WayPoint *pSrcNode, WayPoint *pDstNode);
// Shaitan NewParam {
void SetNodeType (WayPoint *pSrcNode, long lType);
long GetNodeType (WayPoint *pSrcNode);
WayPoint * GetPrevNode (WayPoint *pSrcNode);
WayPoint * GetNextNode (WayPoint *pSrcNode);
WayPoint * GetPrevConnection (WayPoint *pSrcNode, WayPoint *pDstNode);
WayPoint * GetNextConnection (WayPoint *pSrcNode, WayPoint *pDstNode);
//End Shaitan NewParam }
void fn_vShowWaypoints (BOOL bShow);
//End Shaitan Correction }
};
class Connection : public Arrow3D
{
// Shaitan Correction {
/*
public:
int m_iGraph, m_iNode, m_iArc;
// construct
Connection(CPA_EditorBase *p_oEditor, int iGraph, int iNode, int iArc);
*/
private:
Graph *m_pGraph;
WayPoint *m_pSrcWP;
WayPoint *m_pDstWP;
long m_lCapacity;
long m_lWeight;
public:
Graph * GetGraph (void) { return m_pGraph; }
WayPoint * GetSrcWayPoint (void) { return m_pSrcWP; }
WayPoint * GetDstWayPoint (void) { return m_pDstWP; }
long GetCapacity (void) { return m_lCapacity; }
long GetWeight (void) { return m_lWeight; }
void SetCapacity (long lCapacity) { m_lCapacity = lCapacity; }
void SetWeight (long lWeight) { m_lWeight = lWeight; }
Connection(CPA_EditorBase *p_oEditor, Graph *pGraph, WayPoint *pSrcWP, WayPoint *pDstWP, long m_lCapacity, long m_lWeight);
//End Shaitan Correction }
};
#endif //__NTWOBJ_HPP__
//ENDROMTEAM Networks (Gabriela Dumitrascu)