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

#ifndef CDSIfscFH
#define CDSIfscFH
//---------------------------------------------------------------------------

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

/*
*  IFSC class
*/
class TItsIfsc
{
public:
    TItsIfsc();
    virtual ~TItsIfsc();
    void Clear();

private:
    bool    FModified;
    bool    FCompleted;

public:
    String  IFSC_ID;
    String  IFSC_NM;                // IIFSC_NM				VARCHAR(100 BYTE),                      IFSC_NM IS '정보제공구간 명';
    String  DRCT_CD;                // IDRCT_CD				VARCHAR(7 BYTE),                        DRCT_CD IS '방향 코드';
    String  STRT_NM;                // ISTRT_NM				VARCHAR(100 BYTE),                      STRT_NM IS '시점 명';
    String  END_NM;                 // IEND_NM				VARCHAR(100 BYTE)                       END_NM IS '종점 명';
    String  SECT_LNGT;              // ISECT_LNGT			NUMBER(5) DEFAULT 0,                  	SECT_LNGT IS '구간 길이';
    String  EXTR_CNCT_SECT_YN;      // IEXTR_CNCT_SECT_YN	CHAR(1 BYTE) DEFAULT 'N',     			EXTR_CNCT_SECT_YN IS '외부 연계 구간 여부';
    String  DEL_YN;                 // IDEL_YN				CHAR(1 BYTE) DEFAULT 'N',               DEL_YN IS '삭제 여부';
    String  RMRK;                   // IRMRK				VARCHAR(600 BYTE),                      RMRK IS '비고';
    String  F_NODE_ID;              // IF_NODE_ID			NUMBER(10),                           	F_NODE_ID IS '시작노드ID';
    String  T_NODE_ID;              // IT_NODE_ID			NUMBER(10),                           	T_NODE_ID IS '종료노드ID';
    String  SECT_GRAD_CD;           // ISECT_GRAD_CD		VARCHAR(7 BYTE),                   		SECT_GRAD_CD IS '구간 등급 코드';
    String  AREA_CD;                //	AREA_CD VARCHAR(7 BYTE)
    String  REGN_YN;

    String  LINK_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;

    std::map<int, String>    FLinks;

protected:

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

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


/*
* IFSC Manager
*/
class TItsIfscManager
{
public:
    TItsIfscManager();
    virtual ~TItsIfscManager();

public:
    TItsMap<String, TItsIfsc*>  FLists;

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

    bool LoadIfsc(TADOConnection *ADbConn=NULL);
    bool LoadLinkList(TADOConnection *ADbConn=NULL);

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

#endif

