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

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

/*
*  ROAD class
*/
class TItsRoad
{
public:
    TItsRoad();
    virtual ~TItsRoad();
    void Clear();

private:
    bool    FModified;
    bool    FCompleted;

public:
    String  ROAD_ID;
    String	ROAD_NM;
    String	DRCT_CD;
    String	STRT_NM;
    String	END_NM;
    String	DEL_YN;
    String	SECT_LNGT;
    String	F_NODE_ID;
    String	T_NODE_ID;
    String	SECT_GRAD_CD;
    String	REGN_YN;
    String	AREA_CD;

    String  LINK_ID;

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

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

    std::map<int, String>   FIfscs;

protected:

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

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

/*
* Road Manager
*/
class TItsRoadManager
{
public:
    TItsRoadManager();
    virtual ~TItsRoadManager();

public:
    TItsMap<String, TItsRoad*>   FLists;

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

    bool LoadRoad(TADOConnection *ADbConn=NULL);
    bool LoadIfscList(TADOConnection *ADbConn=NULL);

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

#endif

