//---------------------------------------------------------------------------

#ifndef CDSLink_VMSFH
#define CDSLink_VMSFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <stdio.h>
#include <ADODB.hpp>
#include <DB.hpp>
#include "ITSLibF.h"
#include "ITSDbF.h"
#include "CDSObjectF.h"
#include "CDSLayerF.h"
//---------------------------------------------------------------------------

/*
*  LINK class
*/
class TLink
{
public:
    TLink();
    virtual ~TLink();
    void Clear();

private:
    bool    FModified;
    bool    FCompleted;

public:
    String  LINK_ID;
    String	F_NODE_ID;
    String	T_NODE_ID;
    String	ROAD_USE;
    String	LANES;
    String	ROAD_RANK;
    String	ROAD_TYPE;
    String	ROAD_NO;
    String	ROAD_NAME;
    String	MULTI_LINK;
    String	LINK_CONNECT;
    String	MAX_SPD;
    String	REST_VEH;
    String	REST_W;
    String	REST_H;
    String	LINK_LENG;
    String	RMRK;
    String	DEL_YN;
    String	DFLT_SPED;
    String	DFLT_SPED_USE_YN;
    String	SECT_GRAD_CD;
    String	AREA_CD;
    String  PARA_ID;

    String	REGN_YN;

    String  IFSC_ID;
    String  ROAD_ID;

    TCDSTraffic             *TRAF;
    TItsMap<int, TItsVrtx*>  Vrtxs;

    bool   IsVertex;
    String X_CRDN_ARR;
    String Y_CRDN_ARR;
    int    SPED;
    int    TRAF_GRAD;

protected:

public:
    __property bool   Modified  = {read = FModified};
    __property bool   Completed = {read = FCompleted, write = FCompleted};

    void InitTraffic();
};
//---------------------------------------------------------------------------

/*
* Link Manager
*/
class TLinkManager
{
public:
    TLinkManager();
    virtual ~TLinkManager();

public:
    int                         FRegionPointCnt;
    String                      FRegionVertex;

    TItsMap<String, TLink*>  FLists;

public:
    bool LoadFromDb(TADOConnection *ADbConn=NULL);
    bool LoadVrtxFromDb(TADOConnection *ADbConn=NULL);

    bool LoadRegionVertexFromDb(TADOConnection *ADbConn=NULL);

    void InitTraffic();
    bool LoadTraffic(TADOConnection *ADbConn=NULL);
};
//---------------------------------------------------------------------------
extern TLinkManager *LinkManager;
//---------------------------------------------------------------------------

#endif

