123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "WindowMsgF.h"
- #include "CDSFacilityF.h"
- #include "CDSIncidentF.h"
- #include "FrmMainF.h"
- #include "ITSLangTransF.h"
- #include "ITSMapF.h"
- #include "CDSLayerF.h"
- #include "CDSNodeF.h"
- #include "CDSLinkF.h"
- #include "CDSIfscF.h"
- #include "CDSRoadF.h"
- #include "FrmCctvImgF.h"
- #include "FrmVmsMsgF.h"
- #include "FrmLinkInfoF.h"
- #include "FrmGisSearchF.h"
- #include "FrmStreamPlayerF.h"
- #include "FrmLinkInfoF.h"
- #include "FrmParkMsgF.h"
- #pragma hdrstop
- #include "ITS0000MF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "FRAME_FacilityStatusListF"
- #pragma link "FRAME_ProcessStatusListF"
- #pragma link "FRAME_IncidentListF"
- #pragma link "FRAME_RepeatCongestListF"
- #pragma link "FRAME_TrafficMissLinkListF"
- #pragma link "FRAME_IncidentAutoListF"
- #pragma link "cxClasses"
- #pragma link "cxContainer"
- #pragma link "cxControls"
- #pragma link "cxCustomData"
- #pragma link "cxData"
- #pragma link "cxDataStorage"
- #pragma link "cxEdit"
- #pragma link "cxFilter"
- #pragma link "cxGraphics"
- #pragma link "cxGrid"
- #pragma link "cxGridCustomTableView"
- #pragma link "cxGridCustomView"
- #pragma link "cxGridLevel"
- #pragma link "cxGridTableView"
- #pragma link "cxGroupBox"
- #pragma link "cxLabel"
- #pragma link "cxLookAndFeelPainters"
- #pragma link "cxLookAndFeels"
- #pragma link "cxPC"
- #pragma link "cxPCdxBarPopupMenu"
- #pragma link "cxSplitter"
- #pragma link "cxStyles"
- #pragma link "dxSkinBlack"
- #pragma link "dxSkinBlue"
- #pragma link "dxSkinsCore"
- #pragma link "dxSkinscxPCPainter"
- #pragma link "FRAME_DatabaseStatusF"
- #pragma link "FRAME_OpenMapF"
- #pragma link "cxButtons"
- #pragma link "cxCheckBox"
- #pragma link "cxTextEdit"
- #pragma link "cxProgressBar"
- #pragma link "dxGDIPlusClasses"
- #pragma link "FRAME_AtmpPltnListF"
- #pragma link "FRAME_VilgFrcsListF"
- #pragma link "FRAME_VilgShprListF"
- #pragma resource "*.dfm"
- TITS0000M *ITS0000M = NULL;
- //---------------------------------------------------------------------------
- TColor g_clrStatus[5] = {
- clGreen,
- clRed,
- clYellow,
- clBlack,//clSilver,
- clBlack,//clSilver,
- };
- String g_strStatus[5] = {
- "", "", "", "", "",
- };
- String g_strIncident[6] = {
- "", "사고", "공사", "행사", "기상", "기타",
- };
- TColor g_clrTraffic[4] = {
- clGray,
- clLime,
- clYellow,
- clRed,
- };
- String g_strTraffic[4] = {
- "", "", "", "",
- };
- //---------------------------------------------------------------------------
- String g_sTrafficSql[] = {
- "0*************************************************************************\r\n",
- "1*************************************************************************\r\n",
- "SELECT A.ROAD_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
- " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
- " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
- " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
- " FROM TB_ROAD A, \r\n"
- " (SELECT * \r\n"
- " FROM TB_ROAD_TRAF \r\n"
- " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
- " ) B \r\n"
- " WHERE A.ROAD_ID = B.ROAD_ID(+) \r\n",
- "SELECT A.IFSC_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
- " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
- " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
- " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
- " FROM TB_IFSC A, \r\n"
- " (SELECT * \r\n"
- " FROM TB_IFSC_TRAF \r\n"
- " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
- " ) B \r\n"
- " WHERE A.IFSC_ID = B.IFSC_ID(+) \r\n",
- "4************************************************************************\r\n",
- "SELECT A.LINK_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
- " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
- " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
- " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
- " FROM TB_LINK A, \r\n"
- " (SELECT * \r\n"
- " FROM TB_LINK_TRAF \r\n"
- " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
- " ) B \r\n"
- " WHERE A.LINK_ID = B.LINK_ID(+) \r\n",
- "6************************************************************************\r\n",
- };
- void TITS0000M_MapCallback(TObject *ASender, const String AFunc, const String AArgs, const bool AFirst)
- {
- try
- {
- if (!ITS0000M) return;
- ITS0000M->OpenMapCallback(ASender, AFunc, AArgs, AFirst);
- }
- catch(Exception &exception)
- {
- }
- }
- //---------------------------------------------------------------------------
- __fastcall TITS0000M::TITS0000M(TComponent* Owner)
- : TForm(Owner)
- {
- LangTrans->Translate(this, ITSDb_GetConnection());
- ITSSkin_Load(this);
- LoadLocalSkin();
- CMM_LoadForm(g_sFormsDir, this);
- GrpSystem->Caption = lblSysTab->Caption + " - " + TsIncident->Caption;//"▶ 시스템 운영 정보 - " + TsIncident->Caption;
- FRAMEFacilityStatusList1->PnlBottom->Visible = false;
- FRAMETrafficMissLinkList1->Column18->Visible = false;
- //FrmMain->dxStatusBar->Panels->Items[isbGisPos]->Visible = true;
- //시스템자동돌발
- FRAMEIncidentAutoList1->Visible = false;
- TsIncidentAuto->TabVisible = false;
- TsIncidentAuto->Visible = false;
- //기상-초단기예보
- FRAMEVilgShprList1->Visible = false;
- TsVilgShpr->TabVisible = false;
- TsVilgShpr->Visible = false;
- //기상-동네예보
- FRAMEVilgFrcsList1->Visible = false;
- TsVilgFrcs->TabVisible = false;
- TsVilgFrcs->Visible = false;
- TabDebug->TabVisible = false;
- TabDebug->Visible = false;
- reMsg->Lines->Clear();
- PgSystem->Properties->ActivePage = TsIncident;
- PgSystemOpr->Properties->ActivePage = TsFacilityOpr;
- FRAMEOpenMap1->PnlToolbar->Visible = false;
- FRAMEOpenMap1->MapCallbackFunc = TITS0000M_MapCallback;
- #ifdef USE_PARK
- ChkPark->Tag = LyrTp_Park;
- ChkPark->Visible = true;
- #else
- ChkPark->Visible = false;
- #endif
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::CommClose()
- {
- try
- {
- if (FrmMain->dxStatusBar->Panels->Items[isbGisPos]->Visible)
- FrmMain->dxStatusBar->Panels->Items[isbGisPos]->Visible = false;
- CMM_SaveForm(g_sFormsDir, this);
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FormCreate(TObject *Sender)
- {
- //
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FormShow(TObject *Sender)
- {
- Refresh();
- FRAMEOpenMap1->OpenMap();
- Application->ProcessMessages();
- TmrShow->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::LoadLocalSkin()
- {
- #define MAX_VIEW 12
- TcxGridTableView *pView[MAX_VIEW];
- TcxGrid *pGrid[MAX_VIEW];
- for (int ii = 0; ii < MAX_VIEW; ii++)
- {
- pGrid[ii] = NULL;
- pView[ii] = NULL;
- }
- pGrid[ 0] = FRAMEProcessStatusList1->CxList; //프로세스상태
- pGrid[ 1] = FRAMEFacilityStatusList1->CxList; //시설물상태
- #if 0
- pGrid[ 2] = NULL;
- pGrid[ 3] = NULL;
- #else
- pGrid[ 2] = FRAMEDatabaseStatus1->CxList;//FRAMEUtisStatusList1->CxUtisRun; //UTIS현황-운영현황
- //pGrid[ 3] = FRAMEUtisStatusList1->CxUtisRse; //UTIS현황-RSE상태현황
- #endif
- pGrid[ 4] = FRAMEIncidentList1->CxList; //돌발
- pGrid[ 5] = FRAMERepeatCongestList1->CxList; //반복정체구간
- pGrid[ 6] = FRAMETrafficMissLinkList1->CxList; //소통정보결측구간
- pGrid[ 7] = FRAMEIncidentAutoList1->CxList2; //소통정보결측구간
- //pGrid[ 8] = FRAMEBlackBoxEventList1->CxList; //블랙박스이벤트리스트
- pGrid[ 9] = FRAMEVilgFrcsList1->CxList; //기상정보리스트
- pGrid[10] = FRAMEVilgShprList1->CxList; //기상정보리스트(초단기예보)
- pGrid[11] = FRAMEAtmpPltnList1->CxList; //환경정보(대기오염)
- pView[ 0] = FRAMEProcessStatusList1->TvList;
- pView[ 1] = FRAMEFacilityStatusList1->TvList;
- #if 0
- pView[ 2] = NULL;
- pView[ 3] = NULL;
- #else
- pView[ 2] = FRAMEDatabaseStatus1->TvList;//FRAMEUtisStatusList1->TvUtisRun;
- //pView[ 3] = FRAMEUtisStatusList1->TvUtisRse;
- #endif
- pView[ 4] = FRAMEIncidentList1->TvList;
- pView[ 5] = FRAMERepeatCongestList1->TvList;
- pView[ 6] = FRAMETrafficMissLinkList1->TvList;
- pView[ 7] = FRAMEIncidentAutoList1->TvList2;
- //pView[ 8] = FRAMEBlackBoxEventList1->TvList;
- pView[ 9] = FRAMEVilgFrcsList1->TvList;
- pView[10] = FRAMEVilgShprList1->TvList;
- pView[11] = (TcxGridTableView*)FRAMEAtmpPltnList1->TvList;
- for (int ii = 0; ii < MAX_VIEW; ii++)
- {
- if (!pView[ii]) continue;
- //pGrid[ii]->LookAndFeel->SkinName = "McSkin";
- pView[ii]->Styles->Inactive = NULL;
- pView[ii]->Styles->ContentOdd = NULL;
- pView[ii]->Styles->ContentEven= NULL;
- pView[ii]->Styles->Selection = NULL;
- pView[ii]->OptionsSelection->CellSelect = false;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::TmrShowTimer(TObject *Sender)
- {
- TmrShow->Enabled = false;
- // 상태바 표출
- PnlProgress->Left = (this->Width - PnlProgress->Width) / 2;
- PnlProgress->Top = (this->Height - PnlProgress->Height) / 2;
- PnlProgress->Top -= 50;
- PnlProgress->Visible = true;
- PbLoadMap->Properties->Text = lblGisStep1->Caption;//"지도 로딩 중...";
- Application->ProcessMessages();
- PbLoadMap->Position = 30;
- // 리스트 항목을 초기화한다.
- InitListData();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::InitListData()
- {
- FIncidentCnt = 0;
- FRrCongestCnt = 0;
- FMissLinkCnt = 0;
- FRAMEFacilityStatusList1->UpdateList();
- UpdateFacilityStatusTotal();
- FRAMEProcessStatusList1->UpdateList();
- if (GrpBottomUtis->Visible)
- {
- FRAMEDatabaseStatus1->UpdateList();
- //FRAMEUtisStatusList1->UpdateList();
- }
- if (FRAMEIncidentList1->Visible) FRAMEIncidentList1->UpdateList();
- if (FRAMERepeatCongestList1->Visible) FRAMERepeatCongestList1->UpdateList();
- if (FRAMETrafficMissLinkList1->Visible) FRAMETrafficMissLinkList1->UpdateList();
- if (FRAMEIncidentAutoList1->Visible) FRAMEIncidentAutoList1->UpdateList();
- //FRAMEBlackBoxEventList1->UpdateList();
- if (FRAMEVilgFrcsList1->Visible) FRAMEVilgFrcsList1->UpdateList();
- if (FRAMEVilgShprList1->Visible) FRAMEVilgShprList1->UpdateList();
- if (FRAMEAtmpPltnList1->Visible) FRAMEAtmpPltnList1->UpdateList();
- UpdateAlarmStatus();
- UpdateClctSystStts(); // 수집/가공현황 업데이트
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateAlarmStatus()
- {
- String sAlarmMsg = "";
- FIncidentCnt = FRAMEIncidentList1->TvList->DataController->RecordCount;
- FRrCongestCnt = FRAMERepeatCongestList1->TvList->DataController->RecordCount;
- FMissLinkCnt = FRAMETrafficMissLinkList1->TvList->DataController->RecordCount;
- FIncidentAutoCnt = FRAMEIncidentAutoList1->TvList2->DataController->RecordCount;
- //FBlackBoxEventCnt = FRAMEBlackBoxEventList1->TvList->DataController->RecordCount;
- FVilgFrcsCnt1 = FRAMEVilgFrcsList1->GetAlarmCount1();
- FVilgFrcsCnt2 = FRAMEVilgFrcsList1->GetAlarmCount2();
- FVilgFrcsCnt3 = FRAMEVilgShprList1->GetAlarmCount();
- FAtmpPlntCnt = FRAMEAtmpPltnList1->GetAlarmCount();
- if (TsIncidentAuto->TabVisible == false)
- {
- FIncidentAutoCnt = 0;
- }
- if (TsVilgShpr->TabVisible == false)
- {
- FVilgFrcsCnt3 = 0;
- }
- if (TsVilgFrcs->TabVisible == false)
- {
- FVilgFrcsCnt1 = 0;
- FVilgFrcsCnt2 = 0;
- }
- if (TsAtmpPltn->TabVisible == false)
- {
- FAtmpPlntCnt = 0;
- }
- if (FIncidentCnt > 0)
- {
- sAlarmMsg += TsIncident->Caption + "(" + String(FIncidentCnt) + ") ";//"돌발상황(" + String(FIncidentCnt) + ") ";
- TsIncident->ImageIndex = 1;
- }
- else
- TsIncident->ImageIndex = 2;
- if (FRrCongestCnt > 0)
- {
- sAlarmMsg += TsRrCongest->Caption + "(" + String(FRrCongestCnt) + ") ";//"반복정체구간(" + String(FRrCongestCnt) + ") ";
- TsRrCongest->ImageIndex = 1;
- }
- else
- TsRrCongest->ImageIndex = 2;
- if (FMissLinkCnt > 0)
- {
- sAlarmMsg += TsMissingLink->Caption + "(" + String(FMissLinkCnt) + ") ";//"결측구간(" + String(FMissLinkCnt) + ") ";
- TsMissingLink->ImageIndex = 1;
- }
- else
- TsMissingLink->ImageIndex = 2;
- if (FIncidentAutoCnt > 0)
- {
- sAlarmMsg += TsIncidentAuto->Caption + "(" + String(FIncidentAutoCnt) + ") ";//"자동돌발(" + String(FIncidentAutoCnt) + ") ";
- TsIncidentAuto->ImageIndex = 1;
- }
- else
- TsIncidentAuto->ImageIndex = 2;
- if ((FVilgFrcsCnt1 + FVilgFrcsCnt2) > 0)
- {
- //sAlarmMsg += TsVilgFrcs->Caption + "(" + String(FVilgFrcsCnt1 + FVilgFrcsCnt2) + ") ";
- sAlarmMsg += TsVilgFrcs->Caption + " ";
- TsVilgFrcs->ImageIndex = 1;
- }
- else
- TsVilgFrcs->ImageIndex = 2;
- if ((FVilgFrcsCnt3) > 0)
- {
- //sAlarmMsg += TsVilgShpr->Caption + "(" + String(FVilgFrcsCnt3) + ") ";
- sAlarmMsg += TsVilgShpr->Caption + " ";
- TsVilgShpr->ImageIndex = 1;
- }
- else
- TsVilgShpr->ImageIndex = 2;
- if ((FAtmpPlntCnt) > 0)
- {
- sAlarmMsg += TsAtmpPltn->Caption + "(" + String(FAtmpPlntCnt) + ") ";
- TsAtmpPltn->ImageIndex = 1;
- }
- else
- TsAtmpPltn->ImageIndex = 2;
- LblAlarm->Caption = sAlarmMsg;
- if ((FIncidentCnt+FRrCongestCnt+FMissLinkCnt+FIncidentAutoCnt+FBlackBoxEventCnt+FVilgFrcsCnt1+FVilgFrcsCnt2+FVilgFrcsCnt3+FAtmpPlntCnt) > 0)
- {
- LblAlarm->Visible = true;
- }
- else
- {
- LblAlarm->Visible = false;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::PgSystemPageChanging(TObject *Sender, TcxTabSheet *NewPage, bool &AllowChange)
- {
- GrpSystem->Caption = lblSysTab->Caption + " - " + NewPage->Caption;//"▶ 시스템 운영 정보 - " + NewPage->Caption;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FormClose(TObject *Sender, TCloseAction &Action)
- {
- try {
- CommClose();
- ITS0000M = NULL;
- Action = caFree;
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- /*
- * 메인폼에서 데이터를 수신시 발생하는 이벤트 핸들러
- * arguments
- *
- * return
- * void
- */
- void __fastcall TITS0000M::OnMainFormMessage(TMessage &Msg)
- {
- switch(Msg.WParam)
- {
- case WP_DB_SELECT_OK:
- switch(Msg.LParam)
- {
- case LP_MSG_TRAFFIC: //소통정보 조회 완료
- DebugMsg("교통정보 업데이트");
- UpdateTrafficMissLinkInfo(); // 결측구간
- UpdateTrafficRrCongestInfo(); // 반복정체구간
- UpdateGisTraffic(); // 지도 소통정보 업데이트
- if (BtnRefresh->Enabled == false)
- {
- BtnRefresh->Enabled = true;
- }
- UpdateClctSystStts(); // 수집/가공현황 업데이트
- break;
- case LP_MSG_PROCESS_STTS: //프로세스 상태 조회 완료
- DebugMsg("프로세스 상태정보 업데이트");
- UpdateProcessStatusInfo();
- break;
- case LP_MSG_DATABASE_STTS: //데이터베이스 상태
- DebugMsg("데이터베이스 상태정보 업데이트");
- UpdateDatabaseStatusInfo();
- break;
- case LP_MSG_FACILITY_STTS: //시설물 상태 조회 완료
- DebugMsg("시설물 상태정보 업데이트");
- UpdateFacilityStatusInfo();
- break;
- case LP_MSG_INCIDENT: //돌발정보 조회 완료
- DebugMsg("돌발정보 업데이트");
- UpdateIncidentInfo();
- break;
- case LP_MSG_16: DebugMsg("블랙박스정보 로딩"); UpdateBlackBoxEventInfo(); break;
- case LP_MSG_WEATHER: DebugMsg("기상정보 로딩"); UpdateVilgFrcsInfo(); break;
- case LP_MSG_05: DebugMsg("UTIS 정보 로딩"); UpdateUtisStatusInfo(); break;
- case LP_MSG_14: DebugMsg("시설물정보 로딩"); UpdateFacilityInfo(); break;
- case LP_MSG_09: DebugMsg("프로세스정보 로딩"); FRAMEProcessStatusList1->UpdateList(); break;
- case LP_MSG_VMS_DSPLMSG: DebugMsg("VMS 표출 스케쥴 로딩"); UpdateVmsMsg(1); break;
- }
- break;
- case WP_MSG_01: //소통등급이 변경되었다.
- SetGisTrafficColor();
- break;
- case WP_MSG_02: //돌발정보를 현단말에서 취소/등록/해제 하였다.
- UpdateIncidentInfo();
- break;
- case WP_MSG_03: //시설물 기본정보가 변경됨
- UpdateFacilityInfo();
- break;
- case WP_DB_SELECT_ERROR:
- case WP_DB_SELECT_CANCEL:
- break;
- case WP_MSG_15:
- if (LP_MSG_15 == Msg.LParam)
- {
- RefreshGisLink();
- }
- break;
- }
- //TmrDebugHideTimer((TObject*)TmrDebugHide);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateTrafficMissLinkInfo()
- {
- FMissLinkCnt = 0;
- FRAMETrafficMissLinkList1->UpdateList();
- FRAMEIncidentAutoList1->UpdateList();
- UpdateAlarmStatus();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateTrafficRrCongestInfo()
- {
- FRrCongestCnt = 0;
- FRAMERepeatCongestList1->UpdateList();
- UpdateAlarmStatus();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateIncidentInfo()
- {
- FIncidentCnt = 0;
- FRAMEIncidentList1->UpdateList();
- FRAMEIncidentAutoList1->UpdateList();
- UpdateAlarmStatus();
- UpdateGisIncident();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateFacilityStatusInfo()
- {
- //FRAMEFacilityStatusList1->UpdateList();
- FRAMEFacilityStatusList1->RefreshList();
- UpdateFacilityStatusTotal();
- UpdateAlarmStatus();
- UpdateGisFacility();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateProcessStatusInfo()
- {
- FRAMEProcessStatusList1->RefreshList();
- UpdateAlarmStatus();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateUtisStatusInfo()
- {
- if (GrpBottomUtis->Visible)
- {
- //FRAMEUtisStatusList1->RefreshList();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateDatabaseStatusInfo()
- {
- if (GrpBottomUtis->Visible)
- {
- FRAMEDatabaseStatus1->RefreshList();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateFacilityInfo()
- {
- FRAMEFacilityStatusList1->UpdateList();
- UpdateFacilityStatusTotal();
- UpdateAlarmStatus();
- UpdateGisFacility(); //지도 시설물 재로딩
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateBlackBoxEventInfo()
- {
- FBlackBoxEventCnt = 0;
- //FRAMEBlackBoxEventList1->UpdateList();
- UpdateAlarmStatus();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateVilgFrcsInfo()
- {
- FVilgFrcsCnt1 = 0;
- FVilgFrcsCnt2 = 0;
- FVilgFrcsCnt3 = 0;
- FAtmpPlntCnt = 0;
- FRAMEVilgFrcsList1->RefreshList();
- FRAMEVilgShprList1->RefreshList();
- FRAMEAtmpPltnList1->RefreshList();
- UpdateAlarmStatus();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FRAMEIncidentList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift, bool &AHandled)
- {
- //돌발 클릭
- if (!ACellViewInfo) return;
- try {
- TcxDataController *pGDC = FRAMEIncidentList1->TvList->DataController;
- int nRow = pGDC->FocusedRecordIndex;
- if (nRow < 0) return;
- String sId = VarToStr(pGDC->Values[nRow][FRAMEIncidentList1->Column01->Index]);
- String sDx = VarToStr(pGDC->Values[nRow][FRAMEIncidentList1->Column07->Index]);
- String sDy = VarToStr(pGDC->Values[nRow][FRAMEIncidentList1->Column08->Index]);
- SelectObjectByPos(StrToFloat(sDx), StrToFloat(sDy), true);
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FRAMERepeatCongestList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift, bool &AHandled)
- {
- //반복정체구간 클릭
- if (!ACellViewInfo) return;
- try {
- TcxDataController *pGDC = FRAMERepeatCongestList1->TvList->DataController;
- int nRow = pGDC->FocusedRecordIndex;
- if (nRow < 0) return;
- String sSvcLinkId = VarToStr(pGDC->Values[nRow][FRAMERepeatCongestList1->Column01->Index]);
- SelectLinkById(2, sSvcLinkId, true);
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FRAMETrafficMissLinkList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift, bool &AHandled)
- {
- //소통정보 결측구간 클릭
- if (!ACellViewInfo) return;
- try {
- TcxDataController *pGDC = FRAMETrafficMissLinkList1->TvList->DataController;
- int nRow = pGDC->FocusedRecordIndex;
- if (nRow < 0) return;
- String sLinkId = VarToStr(pGDC->Values[nRow][FRAMETrafficMissLinkList1->Column02->Index]);
- SelectLinkById(1, sLinkId, true);
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FRAMEFacilityStatusList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift, bool &AHandled)
- {
- //시설물 위치이동
- if (!ACellViewInfo) return;
- try {
- TcxDataController *pGDC = FRAMEFacilityStatusList1->TvList->DataController;
- int nRow = pGDC->FocusedRecordIndex;
- if (nRow < 0) return;
- String sType = VarToStr(pGDC->Values[nRow][FRAMEFacilityStatusList1->Column01->Index]);
- FSelId = VarToStr(pGDC->Values[nRow][FRAMEFacilityStatusList1->Column02->Index]);
- if (sType == "CRSSVR") return;
- MoveGisFacility(sType, FSelId);
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::MoveGisFacility(String AType, String AId)
- {
- if (!FRAMEOpenMap1->MapStart) return;
- int nLayerIdx = ItsLayerManager->GetLayerIndex(AType);
- if (nLayerIdx < 0) return;
- TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
- if (pFacility)
- {
- if (pFacility->Object)
- {
- sJs.printf(L"selectLayerObject(%d, '%s', %d)", nLayerIdx, pFacility->Object->CTLR_NMBR.c_str(), FRAMEOpenMap1->MapZoom);
- FRAMEOpenMap1->ExecScript(sJs);
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FRAMEFacilityStatusList1TvListCellClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift, bool &AHandled)
- {
- if (AButton != mbRight) return;
- if (!ACellViewInfo) return;
- try {
- TcxDataController *pGDC = FRAMEFacilityStatusList1->TvList->DataController;
- int nRow = pGDC->FocusedRecordIndex;
- if (nRow < 0) return;
- String sType = VarToStr(pGDC->Values[nRow][FRAMEFacilityStatusList1->Column01->Index]);
- FSelId = VarToStr(pGDC->Values[nRow][FRAMEFacilityStatusList1->Column02->Index]);
- if (sType == "CRSSVR") return;
- int nLayerIndex = ItsLayerManager->GetLayerIndex(sType);
- OnMapPopupMenu(nLayerIndex, FSelId, true);
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::pmuFacilityPopup(TObject *Sender)
- {
- TPopupMenu *pPopup = (TPopupMenu*)Sender;
- FSelMenuTag = pPopup->Tag;
- String sLayerType = ItsLayerManager->GetLayerType(FSelMenuTag);
- if (sLayerType == "") return;
- TItsFacility *pFacility = ItsFacilityManager->FLists.Find(FSelId);
- if (!pFacility) return;
- TCDSObject *pObj = pFacility->Object;
- if (!pObj) return;
- pPopup->Items->Items[0]->Caption = "[" + sLayerType + "] " + pObj->NAME;
- #if 0
- switch(pPopup->Tag)
- {
- case LyrTp_Cctv:
- break;
- case LyrTp_Vms:
- break;
- case LyrTp_Vds:
- break;
- case LyrTp_VdsDet:
- break;
- case LyrTp_VdsR:
- case LyrTp_VdsRDet:
- case LyrTp_VdsC:
- case LyrTp_VdsCDet:
- case LyrTp_Avi:
- case LyrTp_Rse:
- case LyrTp_Dsrc:
- case LyrTp_Park:
- case LyrTp_PVms:
- case LyrTp_Bit:
- case LyrTp_Sig:
- case LyrTp_SigDet:
- break;
- case LyrTp_WCam:
- break;
- case LyrTp_CCam:
- break;
- case LyrTp_Event:
- case LyrTp_Wthr:
- case LyrTp_Atmp:
- case LyrTp_Incd:
- break;
- }
- #endif
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::mnuFacilityMoveClick(TObject *Sender)
- {
- TMenuItem *pMenu = (TMenuItem*)Sender;
- Application->ProcessMessages();
- String sLayerType = ItsLayerManager->GetLayerType(FSelMenuTag);
- if (sLayerType != "")
- {
- MoveGisFacility(sLayerType, FSelId);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::mnuFacilityPingClick(TObject *Sender)
- {
- TMenuItem *pMenu = (TMenuItem*)Sender;
- Application->ProcessMessages();
- String sIp = "";
- TItsFacility *pFacility = ItsFacilityManager->FLists.Find(FSelId);
- if (!pFacility) return;
- TCDSObject *pObj = pFacility->Object;
- if (!pObj) return;
- if (pMenu->Tag == 21) //제어기 핑 테스트
- {
- sIp = pObj->CTLR_IP;
- }
- else
- if (pMenu->Tag == 22 && FSelMenuTag == LyrTp_Vms)
- {
- TVmsCtlr *pObj = (TVmsCtlr*)pObj;
- sIp = pObj->WEB_CMRA_IP;
- }
- if (sIp.IsEmpty())
- {
- Application->MessageBox(Label2->Caption.c_str(),//L"IP Address 정보가 없습니다.\r\nIP Address 정보를 확인하세요.",
- Label1->Caption.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- else
- {
- ITSUtil_NetworkPing(sIp);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::mnuStopImageClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TPoint pt;
- GetCursorPos(&pt);
- pt = ScreenToClient(pt);
- ShowCctvStopImage(FSelId, pt);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ShowCctvStopImage(String AId, TPoint pt)
- {
- TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
- if (!pFacility) return;
- TCctvCtlr *pObj = (TCctvCtlr*)pFacility->Object;
- if (!pObj) return;
- try {
- if (pObj->FData1)
- {
- TFrmCctvImg *pForm = (TFrmCctvImg *)pObj->FData1;
- pForm->SetFocus();
- pForm->LoadStopImage();
- }
- else
- {
- TFrmCctvImg *pForm = new TFrmCctvImg(ITS0000M);
- pForm->Parent = ITS0000M;
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- pForm->FObj = pObj;
- pObj->FData2 = (void*)pForm;
- pForm->Show();
- }
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::mnuCctvCamClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TPoint pt;
- GetCursorPos(&pt);
- pt = ITS0000M->ScreenToClient(pt);
- ShowCctvCamera(FSelId, pt);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ShowCctvCamera(String AId, TPoint pt)
- {
- TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
- if (!pFacility) return;
- TCctvCtlr *pObj = (TCctvCtlr*)pFacility->Object;
- if (!pObj) return;
- try {
- if (pObj->FData1)
- {
- TFrmStreamPlayer *pForm = (TFrmStreamPlayer *)pObj->FData1;
- pForm->SetFocus();
- }
- else
- {
- TFrmStreamPlayer *pForm = new TFrmStreamPlayer(ITS0000M);
- pForm->FObj.IsCctv = true;
- pForm->FObj.ID = pObj->CCTV_CTLR_ID;
- pForm->FObj.NAME = pObj->CCTV_NM;
- pForm->FObj.RTSP_ADDR = pObj->STRM_SESN_NM;
- pForm->FObj.Data = (TCDSObject*)pObj;
- pForm->FObj.Installed = true;
- pForm->Parent = ITS0000M;
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- pObj->FData1 = (void*)pForm;
- pForm->Show();
- }
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::mnuVmsMsgClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TPoint pt;
- GetCursorPos(&pt);
- pt = ITS0000M->ScreenToClient(pt);
- ShowVmsMessage(FSelId, pt);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateVmsMsg(int AType)
- {
- try
- {
- FOR_STL(TVmsCtlr*, pObj, VmsCtlrManager->FLists)
- {
- if (pObj->DEL_YN == "Y") continue;
- if (pObj->FData2)
- {
- TFrmVmsMsg *pForm = (TFrmVmsMsg *)pObj->FData2;
- if (AType == 1)
- pForm->VmsFormReload();
- else
- pForm->VmsFormReload();
- }
- }
- }
- catch(Exception &e)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ShowVmsMessage(String AId, TPoint pt)
- {
- TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
- if (!pFacility) return;
- TVmsCtlr *pObj = (TVmsCtlr*)pFacility->Object;
- if (!pObj) return;
- try {
- if (pObj->FData2)
- {
- TFrmVmsMsg *pForm = (TFrmVmsMsg *)pObj->FData2;
- pForm->SetFocus();
- }
- else
- {
- TFrmVmsMsg *pForm = new TFrmVmsMsg(ITS0000M, pObj);
- pForm->Parent = ITS0000M;
- int nHG = pForm->ClientHeight - pForm->PnlVmsMsgDisp->Height;
- int nWG = pForm->ClientWidth - pForm->PnlVmsMsgDisp->Width;
- #if 0
- pForm->ClientHeight = nHG + pObj->Height;
- pForm->ClientWidth = nWG + pObj->Width;
- #endif
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- pObj->FData2 = (void*)pForm;
- pForm->Show();
- }
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::mnuVmsCamClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TPoint pt;
- GetCursorPos(&pt);
- pt = ITS0000M->ScreenToClient(pt);
- ShowVmsCamera(FSelId, pt);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ShowVmsCamera(String AId, TPoint pt)
- {
- TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
- if (!pFacility) return;
- TVmsCtlr *pObj = (TVmsCtlr*)pFacility->Object;
- if (!pObj) return;
- try {
- if (pObj->FData1)
- {
- TFrmStreamPlayer *pForm = (TFrmStreamPlayer *)pObj->FData1;
- pForm->SetFocus();
- }
- else
- {
- TFrmStreamPlayer *pForm = new TFrmStreamPlayer(ITS0000M);
- pForm->FObj.IsCctv = false;
- pForm->FObj.ID = pObj->VMS_CTLR_ID;
- pForm->FObj.NAME = pObj->VMS_NM;
- pForm->FObj.RTSP_ADDR = pObj->STRM_SESN_NM;
- pForm->FObj.Data = (TCDSObject*)pObj;
- pForm->FObj.Installed = true;
- pForm->Parent = ITS0000M;
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- pObj->FData1 = (void*)pForm;
- pForm->Show();
- }
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::MnuWebCamClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TPoint pt;
- GetCursorPos(&pt);
- pt = ITS0000M->ScreenToClient(pt);
- ShowWebCamera(FSelId, pt);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ShowWebCamera(String AId, TPoint pt)
- {
- TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
- if (!pFacility) return;
- TWCamCtlr *pObj = (TWCamCtlr*)pFacility->Object;
- if (!pObj) return;
- try {
- if (pObj->FData1)
- {
- TFrmStreamPlayer *pForm = (TFrmStreamPlayer *)pObj->FData1;
- pForm->SetFocus();
- }
- else
- {
- TFrmStreamPlayer *pForm = new TFrmStreamPlayer(ITS0000M);
- pForm->FObj.IsCctv = false;
- pForm->FObj.ID = pObj->WCAM_CTLR_ID;
- pForm->FObj.NAME = pObj->WCAM_NM;
- pForm->FObj.RTSP_ADDR = pObj->STRM_SESN_NM;
- pForm->FObj.Data = (TCDSObject*)pObj;
- pForm->FObj.Installed = true;
- pForm->Parent = ITS0000M;
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- pObj->FData1 = (void*)pForm;
- pForm->Show();
- }
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::MnuCrsCamClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TPoint pt;
- GetCursorPos(&pt);
- pt = ITS0000M->ScreenToClient(pt);
- ShowCrsCamera(FSelId, pt);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ShowCrsCamera(String AId, TPoint pt)
- {
- TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
- if (!pFacility) return;
- TCCamCtlr *pObj = (TCCamCtlr*)pFacility->Object;
- if (!pObj) return;
- try {
- if (pObj->FData1)
- {
- TFrmStreamPlayer *pForm = (TFrmStreamPlayer *)pObj->FData1;
- pForm->SetFocus();
- }
- else
- {
- TFrmStreamPlayer *pForm = new TFrmStreamPlayer(ITS0000M);
- pForm->FObj.IsCctv = false;
- pForm->FObj.ID = pObj->CCAM_CTLR_ID;
- pForm->FObj.NAME = pObj->CCAM_NM;
- pForm->FObj.RTSP_ADDR = pObj->STRM_SESN_NM;
- pForm->FObj.Data = (TCDSObject*)pObj;
- pForm->FObj.Installed = true;
- pForm->Parent = ITS0000M;
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- pObj->FData1 = (void*)pForm;
- pForm->Show();
- }
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FRAMEIncidentAutoList1TvList2CellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift, bool &AHandled)
- {
- //소통정보 결측구간 클릭
- if (!ACellViewInfo) return;
- try {
- TcxDataController *pGDC = FRAMEIncidentAutoList1->TvList2->DataController;
- int nRow = pGDC->FocusedRecordIndex;
- if (nRow < 0) return;
- String sLinkId = VarToStr(pGDC->Values[nRow][FRAMEIncidentAutoList1->ColumnA01->Index]);
- SelectLinkById(1, sLinkId, true);
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateFacilityStatusTotal()
- {
- int nRow = 0;
- try
- {
- CMM_ClearGridTableView(TvStatus);
- TcxDataController *pGDC = TvStatus->DataController;
- TvStatus->BeginUpdate();
- ItsFacilityManager->FListStatus.Lock();
- try
- {
- FOR_STL(TFacilityStatus*, pStatus, ItsFacilityManager->FListStatus)
- {
- nRow = pGDC->AppendRecord();
- if (pStatus->Type == "CCAM")
- pGDC->Values[nRow][ColName->Index] = "교차로감시";
- else
- if (pStatus->Type == "WCAM")
- pGDC->Values[nRow][ColName->Index] = "CCTV(웹카메라)";
- else
- if (pStatus->Type == "CRSSVR")
- {
- pGDC->Values[nRow][ColName->Index] = "교차로분석서버";
- }
- else
- if (pStatus->Type == "PARK")
- {
- pGDC->Values[nRow][ColName->Index] = "주차장";
- }
- else
- pGDC->Values[nRow][ColName->Index] = pStatus->Type;
- pGDC->Values[nRow][ColTotal->Index] = pStatus->Total;
- pGDC->Values[nRow][ColNormal->Index] = pStatus->Total - pStatus->Error;
- pGDC->Values[nRow][ColFail->Index] = pStatus->Error;
- if (pStatus->Type == "VDS" || pStatus->Type == "AVI" || pStatus->Type == "DSRC")
- pGDC->Values[nRow][ColModule->Index] = pStatus->Collect;//Module;
- else
- pGDC->Values[nRow][ColModule->Index] = "-";
- }
- }
- catch(Exception &exception)
- {
- }
- }
- __finally
- {
- ItsFacilityManager->FListStatus.UnLock();
- TvStatus->EndUpdate();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateClctSystStts()
- {
- int nRow = 0;
- CMM_ClearGridTableView(TvClctStts);
- TcxDataController *pGDC = TvClctStts->DataController;
- TvClctStts->BeginUpdate();
- ItsLinkManager->FClctSystStts.Lock();
- try
- {
- try
- {
- FOR_STL(TClctSystStts*, pObj, ItsLinkManager->FClctSystStts)
- {
- nRow = pGDC->AppendRecord();
- pGDC->Values[nRow][Column1->Index] = pObj->CLCT_SYST_NM;
- pGDC->Values[nRow][Column2->Index] = ITSUtil_FormatStr(pObj->PRCN_DT, STR_DATETIME);
- if (pObj->IsCollected)
- {
- pGDC->Values[nRow][Column3->Index] = FormatFloat("##,##0", pObj->CLCT_NUM);
- pGDC->Values[nRow][Column4->Index] = FormatFloat("##,##0", pObj->FLTR_NUM);
- pGDC->Values[nRow][Column5->Index] = FormatFloat("##,##0", pObj->FUSN_NUM);
- }
- else
- {
- pGDC->Values[nRow][Column3->Index] = "-";
- pGDC->Values[nRow][Column4->Index] = "-";
- pGDC->Values[nRow][Column5->Index] = "-";
- }
- }
- }
- catch(Exception &exception)
- {
- }
- }
- __finally
- {
- ItsLinkManager->FClctSystStts.UnLock();
- TvClctStts->EndUpdate();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ColNameCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas,
- TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone)
- {
- // 장비명
- if (AViewInfo->GridRecord->RecordIndex < 0) return;
- ACanvas->Font->Style = TFontStyles() << fsBold;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ColTotalCustomDrawCell(TcxCustomGridTableView *Sender,
- TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
- bool &ADone)
- {
- // 전체
- if (AViewInfo->GridRecord->RecordIndex < 0) return;
- ACanvas->Font->Style = TFontStyles() << fsBold;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ColNormalCustomDrawCell(TcxCustomGridTableView *Sender,
- TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
- bool &ADone)
- {
- // 정상
- if (AViewInfo->GridRecord->RecordIndex < 0) return;
- ACanvas->Font->Style = TFontStyles() << fsBold;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ColFailCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas,
- TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone)
- {
- // 이상
- if (AViewInfo->GridRecord->RecordIndex < 0) return;
- ACanvas->Font->Style = TFontStyles() << fsBold;
- if (!VarIsNull(AViewInfo->GridRecord->DisplayTexts[ColFail->Index]))
- {
- String sErr = AViewInfo->GridRecord->DisplayTexts[ColFail->Index];
- if (sErr != "0")
- {
- ACanvas->Font->Color = clRed;
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ColModuleCustomDrawCell(TcxCustomGridTableView *Sender,
- TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
- bool &ADone)
- {
- // 이상
- if (AViewInfo->GridRecord->RecordIndex < 0) return;
- ACanvas->Font->Style = TFontStyles() << fsBold;
- if (!VarIsNull(AViewInfo->GridRecord->DisplayTexts[ColModule->Index]))
- {
- String sErr = AViewInfo->GridRecord->DisplayTexts[ColModule->Index];
- if (sErr.Trim() == "-")
- return;
- if (sErr != "0")
- {
- ACanvas->Font->Color = clRed;
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::TvStatusCustomDrawCell(TcxCustomGridTableView *Sender,
- TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
- bool &ADone)
- {
- if (AViewInfo->GridRecord->Selected)
- {
- //ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentColor();
- //ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
- if (AViewInfo->GridRecord->Index % 2 == 0)
- {
- ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentEvenColor();
- ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
- }
- else
- {
- ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentOddColor();
- ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::BtnMapToJpgClick(TObject *Sender)
- {
- FRAMEOpenMap1->BtnMapToJpgClick(Sender);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::BtnMoveDefBoundsClick(TObject *Sender)
- {
- FRAMEOpenMap1->BtnMoveDefBoundsClick(Sender);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::BtnZoomInClick(TObject *Sender)
- {
- FRAMEOpenMap1->BtnZoomInClick(Sender);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::BtnZoomOutClick(TObject *Sender)
- {
- FRAMEOpenMap1->BtnZoomOutClick(Sender);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::BtnMapSelectClick(TObject *Sender)
- {
- if (FRAMEOpenMap1->MapStart)
- {
- sJs.printf(L"selectMode(%d)", BtnMapSelect->Down ? 1 : 0);
- FRAMEOpenMap1->ExecScript(sJs);
- sJs.printf(L"setMouseClick(%d)", (BtnMapSelect->Down) ? 1: 0);
- FRAMEOpenMap1->ExecScript(sJs);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::BtnRefreshClick(TObject *Sender)
- {
- if (FRAMEOpenMap1->MapStart)
- {
- FrmMain->FPollStatus01.Reset(); // 시설물상태정보
- FrmMain->FPollStatus02.Reset(); // 프로세스상태정보
- FrmMain->FPollStatus03.Reset(); // 돌발정보
- FrmMain->FPollTraffic00.Reset(); // 링크소통정보(전체)
- FrmMain->FPollTraffic05.Reset(); // UTIS운영정보
- FrmMain->FPollDatabase.Reset(); // 데이터베이스 상태
- FrmMain->FPollEvent01.Reset(); // 블랙박스이벤트
- FrmMain->FPollVilgFrcs.Reset(); // 기상정보
- BtnRefresh->Enabled = false;
- //TmrRefresh->Enabled = true;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::TmrRefreshTimer(TObject *Sender)
- {
- TmrRefresh->Enabled = false;
- BtnRefresh->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateGisIncident()
- {
- if (!FRAMEOpenMap1->MapStart) return;
- sJs.printf(L"removeLayerObject(%d)", LyrTp_Incd);
- FRAMEOpenMap1->ExecScript(sJs);
- int nStatus;
- String ROAD_NAME = " ";
- String arrObj = "";
- String sTemp;
- try
- {
- ItsIncidentManager->FLists.Lock();
- FOR_STL(TItsIncident *, pObj, ItsIncidentManager->FLists)
- {
- if (pObj->DISP_INCD == "N") continue;
- if (pObj->INCD_PRGR_STEP_CD == "ISS2")
- {
- ROAD_NAME = "";
- TItsLink *pLink = ItsLinkManager->FLists.Find(pObj->LINK_ID);
- if (pLink)
- {
- ROAD_NAME = pLink->ROAD_NAME;
- }
- nStatus = pObj->INCD_TYPE_CLSF_CD.ToIntDef(1);
- if (nStatus > 4 || nStatus < 1) nStatus = 1;
- if (arrObj != "") arrObj += "|";
- sTemp.printf(L"%s,%s,%s,%s,%s,%s,%s,%s,%d,%s,%s,%s,%s",
- pObj->INCD_OCRR_ID.c_str(),
- pObj->X_CRDN.c_str(),
- pObj->Y_CRDN.c_str(),
- ITSUtil_StrToTime(pObj->RGST_DT).c_str(),
- ITSUtil_StrToTime(pObj->INCD_STRT_DT).c_str(),
- ITSUtil_StrToTime(pObj->INCD_END_PRAR_DT).c_str(),
- ROAD_NAME.c_str(),
- pObj->INCD_TITL.c_str(),
- nStatus,
- g_strIncident[nStatus].c_str(),
- pObj->OCRR_LCTN_NM.c_str(),
- pObj->INCD_EXPL.c_str(),
- pObj->LINK_ID.c_str());
- arrObj += sTemp;
- }
- }
- }
- __finally
- {
- ItsIncidentManager->FLists.UnLock();
- }
- if (arrObj != "")
- {
- sJs.printf(L"addIncident('%s')", arrObj.c_str());
- FRAMEOpenMap1->ExecScript(sJs);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateGisFacility()
- {
- if (!FRAMEOpenMap1->MapStart) return;
- FOR_STL(TLayerIdx*, pLayer, ItsLayerManager->FFacilityLayers)
- {
- pLayer->arrObj = "";
- }
- String sTemp;
- TCDSObject *pObj;
- TLayerIdx *pLayer;
- ItsFacilityManager->FLists.Lock();
- try
- {
- FOR_STL(TItsFacility*, pFacility, ItsFacilityManager->FLists)
- {
- if (pFacility->FOldComm == pFacility->FComm)
- continue;
- pObj = pFacility->Object;
- if (pObj == NULL)
- {
- continue;
- }
- if (pFacility->FCLT_TYPE == "VDS" && pFacility->FCLT_KIND == "C")
- {
- continue;
- }
- pLayer = ItsLayerManager->FFacilityLayers.Find(pFacility->FCLT_TYPE);
- if (pLayer)
- {
- if (pLayer->arrObj != "") pLayer->arrObj += "|";
- sTemp.printf(L"%s,%d", pObj->CTLR_NMBR.c_str(), pFacility->FComm.ToIntDef(2));
- pLayer->arrObj += sTemp;
- }
- pFacility->FOldComm = pFacility->FComm;
- }
- }
- __finally
- {
- ItsFacilityManager->FLists.UnLock();
- }
- FOR_STL(TLayerIdx*, pLayer, ItsLayerManager->FFacilityLayers)
- {
- if (pLayer->arrObj != "")
- {
- sJs.printf(L"updateFacility(%d, '%s')", pLayer->Index, pLayer->arrObj.c_str());
- FRAMEOpenMap1->ExecScript(sJs);
- pLayer->arrObj = "";
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::InitGisFacility()
- {
- if (!FRAMEOpenMap1->MapStart) return;
- FOR_STL(TLayerIdx*, pLayer, ItsLayerManager->FFacilityLayers)
- {
- pLayer->arrObj = "";
- sJs.printf(L"removeLayerObject(%d)", pLayer->Index);
- FRAMEOpenMap1->ExecScript(sJs);
- }
- String sTemp;
- TCDSObject *pObj;
- TLayerIdx *pLayer;
- ItsFacilityManager->FLists.Lock();
- try
- {
- FOR_STL(TItsFacility*, pFacility, ItsFacilityManager->FLists)
- {
- pObj = pFacility->Object;
- if (pObj == NULL)
- {
- continue;
- }
- if (pFacility->FCLT_TYPE == "VDS" && pFacility->FCLT_KIND == "C")
- {
- continue;
- }
- pLayer = ItsLayerManager->FFacilityLayers.Find(pFacility->FCLT_TYPE);
- if (pLayer)
- {
- if (pLayer->arrObj != "") pLayer->arrObj += "|";
- sTemp.printf(L"%s,%s,%s,%.6f,%.6f,%d,0,0,0", pObj->CTLR_NMBR.c_str(), pObj->CTLR_ID.c_str(), pObj->NAME.c_str(), pObj->X_CRDN, pObj->Y_CRDN, pFacility->FComm.ToIntDef(2));
- pLayer->arrObj += sTemp;
- }
- pFacility->FOldComm = pFacility->FComm;
- }
- }
- __finally
- {
- ItsFacilityManager->FLists.UnLock();
- }
- FOR_STL(TLayerIdx*, pLayer, ItsLayerManager->FFacilityLayers)
- {
- if (pLayer->arrObj != "")
- {
- sJs.printf(L"addFacility(%d, '%s')", pLayer->Index, pLayer->arrObj.c_str());
- FRAMEOpenMap1->ExecScript(sJs);
- pLayer->arrObj = "";
- }
- if (pLayer->Visible == 0)
- {
- sJs.printf(L"showLayer(%d, 0)", pLayer->Index);
- FRAMEOpenMap1->ExecScript(sJs);
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::UpdateGisTraffic()
- {
- if (!FRAMEOpenMap1->MapStart) return;
- TItsVrtx* pVrtx;
- TItsNode* pNode;
- String STRT_NM;
- String END_NM;
- int nLinks, nIfscs, nRoads;
- nLinks = nIfscs = nRoads = 0;
- ItsLinkManager->FLists.Lock();
- try
- {
- FOR_STL(TItsLink*, pLink, ItsLinkManager->FLists)
- {
- if (pLink->DEL_YN == "Y") continue;
- if (pLink->IsVertex && pLink->TRAF && (pLink->SPED != pLink->TRAF->SPED || pLink->TRAF_GRAD != pLink->TRAF->TRAF_GRAD))
- {
- sJs.printf(L"updateLink('%s', '%d', %d)",
- pLink->LINK_ID.c_str(),
- pLink->TRAF->SPED,
- pLink->TRAF->TRAF_GRAD);
- FRAMEOpenMap1->ExecScript(sJs);
- pLink->SPED = pLink->TRAF->SPED;
- pLink->TRAF_GRAD = pLink->TRAF->TRAF_GRAD;
- nLinks++;
- }
- }
- }
- __finally
- {
- ItsLinkManager->FLists.UnLock();
- }
- ItsIfscManager->FLists.Lock();
- try
- {
- FOR_STL(TItsIfsc*, pIfsc, ItsIfscManager->FLists)
- {
- if (pIfsc->DEL_YN == "Y") continue;
- if (pIfsc->IsVertex && pIfsc->TRAF && (pIfsc->SPED != pIfsc->TRAF->SPED || pIfsc->TRAF_GRAD != pIfsc->TRAF->TRAF_GRAD))
- {
- sJs.printf(L"updateIfsc('%s', '%d', %d)",
- pIfsc->IFSC_ID.c_str(),
- pIfsc->TRAF->SPED,
- pIfsc->TRAF->TRAF_GRAD);
- FRAMEOpenMap1->ExecScript(sJs);
- pIfsc->SPED = pIfsc->TRAF->SPED;
- pIfsc->TRAF_GRAD = pIfsc->TRAF->TRAF_GRAD;
- nIfscs++;
- }
- }
- }
- __finally
- {
- ItsIfscManager->FLists.UnLock();
- }
- ItsRoadManager->FLists.Lock();
- try
- {
- FOR_STL(TItsRoad*, pRoad, ItsRoadManager->FLists)
- {
- if (pRoad->DEL_YN == "Y") continue;
- if (pRoad->IsVertex && pRoad->TRAF && (pRoad->SPED != pRoad->TRAF->SPED || pRoad->TRAF_GRAD != pRoad->TRAF->TRAF_GRAD))
- {
- sJs.printf(L"updateRoad('%s', '%d', %d)",
- pRoad->ROAD_ID.c_str(),
- pRoad->TRAF->SPED,
- pRoad->TRAF->TRAF_GRAD);
- FRAMEOpenMap1->ExecScript(sJs);
- pRoad->SPED = pRoad->TRAF->SPED;
- pRoad->TRAF_GRAD = pRoad->TRAF->TRAF_GRAD;
- nRoads++;
- }
- }
- }
- __finally
- {
- ItsRoadManager->FLists.UnLock();
- }
- try
- {
- if (FrmLinkInfo)
- {
- FrmLinkInfo->RefreshLinkInfo();
- }
- }
- catch(...)
- {
- }
- String sMsg;
- sMsg.printf(L"GIS Traffic Update: %d, %d, %d", nLinks, nIfscs, nRoads);
- DebugLog(sMsg);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::InitGisTraffic()
- {
- if (!FRAMEOpenMap1->MapStart) return;
- TItsVrtx* pVrtx;
- TItsNode* pNode;
- String STRT_NM;
- String END_NM;
- FLayerIdx = LyrTp_Node;
- sJs.printf(L"removeLayerObject(%d)", FLayerIdx);
- FRAMEOpenMap1->ExecScript(sJs);
- String arrObj = "";
- String sTemp;
- int cnt = 0;
- ItsNodeManager->FLists.Lock();
- try
- {
- FOR_STL(TItsNode*, pObj, ItsNodeManager->FLists)
- {
- if (arrObj != "") arrObj += "|";
- if (cnt == 0)
- {
- sTemp.printf(L"%s,%s,%s,%.6f,%.6f,0,0,0,0", pObj->NODE_ID.c_str(), pObj->NODE_ID.c_str(), pObj->NODE_NAME.c_str(), pObj->X_CRDN, pObj->Y_CRDN);
- arrObj += sTemp;
- sJs.printf(L"addFacility(%d, '%s')", FLayerIdx, arrObj.c_str());
- FRAMEOpenMap1->ExecScript(sJs);
- }
- else
- {
- sTemp.printf(L"%s,%s,%s,%.6f,%.6f,0,0,0,0", pObj->NODE_ID.c_str(), pObj->NODE_ID.c_str(), pObj->NODE_NAME.c_str(), pObj->X_CRDN, pObj->Y_CRDN);
- sJs.printf(L"addFacilityObject(%d, '%s')", FLayerIdx, sTemp.c_str());
- FRAMEOpenMap1->ExecScript(sJs);
- }
- cnt++;
- }
- }
- __finally
- {
- ItsNodeManager->FLists.UnLock();
- sJs.printf(L"showLayer(%d, 0)", FLayerIdx);
- FRAMEOpenMap1->ExecScript(sJs);
- }
- FRAMEOpenMap1->ExecScript("initTrafficLayer()");
- ItsLinkManager->FLists.Lock();
- try
- {
- FOR_STL(TItsLink*, pLink, ItsLinkManager->FLists)
- {
- if (pLink->DEL_YN == "Y") continue;
- if (pLink->IsVertex && pLink->TRAF)
- {
- pNode = ItsNodeManager->FLists.Find(pLink->F_NODE_ID);
- if (pNode) STRT_NM = pNode->NODE_NAME; else STRT_NM = " ";
- pNode = ItsNodeManager->FLists.Find(pLink->T_NODE_ID);
- if (pNode) END_NM = pNode->NODE_NAME; else END_NM = " ";
- sJs.printf(L"addLink('%s', '%s', '%s', '%s', '%s', '%d', %d, '%s', '%s')",
- pLink->LINK_ID.c_str(),
- pLink->ROAD_NAME.c_str(),
- STRT_NM.c_str(),
- END_NM.c_str(),
- pLink->LINK_LENG.c_str(),
- pLink->TRAF->SPED,
- pLink->TRAF->TRAF_GRAD,
- pLink->X_CRDN_ARR.c_str(),
- pLink->Y_CRDN_ARR.c_str());
- FRAMEOpenMap1->ExecScript(sJs);
- pLink->SPED = pLink->TRAF->SPED;
- pLink->TRAF_GRAD = pLink->TRAF->TRAF_GRAD;
- }
- }
- }
- __finally
- {
- ItsLinkManager->FLists.UnLock();
- }
- ItsIfscManager->FLists.Lock();
- try
- {
- FOR_STL(TItsIfsc*, pIfsc, ItsIfscManager->FLists)
- {
- if (pIfsc->DEL_YN == "Y") continue;
- if (pIfsc->IsVertex && pIfsc->TRAF)
- {
- sJs.printf(L"addIfsc('%s', '%s', '%s', '%s', '%s', '%d', %d, '%s', '%s')",
- pIfsc->IFSC_ID.c_str(),
- pIfsc->IFSC_NM.c_str(),
- pIfsc->STRT_NM.c_str(),
- pIfsc->END_NM.c_str(),
- pIfsc->SECT_LNGT.c_str(),
- pIfsc->TRAF->SPED,
- pIfsc->TRAF->TRAF_GRAD,
- pIfsc->X_CRDN_ARR.c_str(),
- pIfsc->Y_CRDN_ARR.c_str());
- FRAMEOpenMap1->ExecScript(sJs);
- pIfsc->SPED = pIfsc->TRAF->SPED;
- pIfsc->TRAF_GRAD = pIfsc->TRAF->TRAF_GRAD;
- }
- }
- }
- __finally
- {
- ItsIfscManager->FLists.UnLock();
- }
- ItsRoadManager->FLists.Lock();
- try
- {
- FOR_STL(TItsRoad*, pRoad, ItsRoadManager->FLists)
- {
- if (pRoad->DEL_YN == "Y") continue;
- if (pRoad->IsVertex && pRoad->TRAF)
- {
- sJs.printf(L"addRoad('%s', '%s', '%s', '%s', '%s', '%d', %d, '%s', '%s')",
- pRoad->ROAD_ID.c_str(),
- pRoad->ROAD_NM.c_str(),
- pRoad->STRT_NM.c_str(),
- pRoad->END_NM.c_str(),
- pRoad->SECT_LNGT.c_str(),
- pRoad->TRAF->SPED,
- pRoad->TRAF->TRAF_GRAD,
- pRoad->X_CRDN_ARR.c_str(),
- pRoad->Y_CRDN_ARR.c_str());
- FRAMEOpenMap1->ExecScript(sJs);
- pRoad->SPED = pRoad->TRAF->SPED;
- pRoad->TRAF_GRAD = pRoad->TRAF->TRAF_GRAD;
- }
- }
- }
- __finally
- {
- ItsRoadManager->FLists.UnLock();
- }
- FRAMEOpenMap1->ExecScript("makeTrafficLayer()");
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::OnMapPopupMenu(int ALayerType, String AFID, bool AOnList)
- {
- FSelId = AFID;
- #if 0
- TItsFacility *pFacility = ItsFacilityManager->FLists.Find(FSelId);
- if (!pFacility) return;
- TCDSObject *pObj = pFacility->Object;
- if (!pObj) return;
- #endif
- POINT p;
- GetCursorPos(&p);
- switch(ALayerType)
- {
- case LyrTp_Cctv:
- N1->Visible = AOnList;
- mnuMoveCctv->Visible = AOnList;
- pmuCctv->Popup(p.x, p.y);
- break;
- case LyrTp_Vms:
- N2->Visible = AOnList;
- mnuMoveVms->Visible = AOnList;
- pmuVms->Popup(p.x, p.y);
- break;
- case LyrTp_Vds:
- MenuItem6->Visible = AOnList;
- MenuItem7->Visible = AOnList;
- pmuVds->Popup(p.x, p.y);
- break;
- case LyrTp_VdsDet:
- case LyrTp_VdsR:
- case LyrTp_VdsRDet:
- case LyrTp_VdsC:
- case LyrTp_VdsCDet:
- break;
- case LyrTp_Avi:
- MenuItem11->Visible = AOnList;
- MenuItem12->Visible = AOnList;
- pmuAvi->Popup(p.x, p.y);
- break;
- case LyrTp_Rse:
- N5->Visible = AOnList;
- mnuMoveRse->Visible = AOnList;
- pmuRse->Popup(p.x, p.y);
- break;
- case LyrTp_Dsrc:
- MenuItem16->Visible = AOnList;
- MenuItem17->Visible = AOnList;
- pmuDsrc->Popup(p.x, p.y);
- break;
- case LyrTp_Park:
- MenuItem28->Visible = AOnList;
- MenuItem29->Visible = AOnList;
- pmuPark->Popup(p.x, p.y);
- break;
- case LyrTp_PVms:
- MenuItem24->Visible = AOnList;
- MenuItem25->Visible = AOnList;
- pmuPVms->Popup(p.x, p.y);
- break;
- case LyrTp_Bit:
- MenuItem18->Visible = AOnList;
- mnuMoveBit->Visible = AOnList;
- pmuBit->Popup(p.x, p.y);
- break;
- case LyrTp_Sig:
- MenuItem22->Visible = AOnList;
- mnuMoveSig->Visible = AOnList;
- pmuSig->Popup(p.x, p.y);
- break;
- case LyrTp_SigDet:
- MenuItem23->Visible = AOnList;
- mnuMoveSigDet->Visible = AOnList;
- pmuSigDet->Popup(p.x, p.y);
- break;
- case LyrTp_WCam:
- N7->Visible = AOnList;
- mnuMoveVmsWebCam->Visible = AOnList;
- pmuWCam->Popup(p.x, p.y);
- break;
- case LyrTp_CCam:
- N18->Visible = AOnList;
- mnuMoveCrsCam->Visible = AOnList;
- pmuCCam->Popup(p.x, p.y);
- break;
- case LyrTp_Event:
- case LyrTp_Wthr:
- case LyrTp_Atmp:
- break;
- case LyrTp_Incd:
- break;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::SelectObjectByPos(double dPosX, double dPosY, bool bArrow/*=false*/)
- {
- FRAMEOpenMap1->SelectObjectByPos(dPosX, dPosY, bArrow);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ShowLinkDetailInfo(String ALinkId, int ALinkLevel)
- {
- try
- {
- if (FrmLinkInfo == NULL)
- {
- FrmLinkInfo = new TFrmLinkInfo(Application);
- }
- FrmLinkInfo->Show();
- FrmLinkInfo->ShowLinkInfo(ALinkId, ALinkLevel);
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::MapZoomChanged(int AMapZoom)
- {
- String sLevl = ", L ";
- switch(AMapZoom)
- {
- case 12: case 13: sLevl = ", R "; break;
- case 14: case 15: sLevl = ", I "; break;
- }
- LblZoom->Caption = "Zoom: " + String(FRAMEOpenMap1->MapZoom) + sLevl;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::OpenMapCallback(TObject *ASender, const String AFunc, const String AArgs, const bool AFirst)
- {
- try
- {
- DebugLog(AFunc + " " + AArgs + (AFirst ? ", First" : ""));
- if (AFirst)
- {
- MapZoomChanged(FRAMEOpenMap1->MapZoom);
- Application->ProcessMessages();
- TmrInitGis->Enabled = true;
- return;
- }
- if (FRAMEOpenMap1->MapStart)
- {
- MapZoomChanged(FRAMEOpenMap1->MapZoom);
- }
- if (AFunc.Pos("onlinkclick"))
- {
- if (BtnMapSelect->Down)
- {
- String sLyrType = "";
- String sLinkId = "";
- TStringList *pStringList = new TStringList;
- pStringList->CommaText = AArgs;
- try
- {
- sLyrType = pStringList->Strings[0];
- sLinkId = pStringList->Strings[1];
- }
- catch(Exception &e)
- {
- }
- delete pStringList;
- if (sLinkId != "")
- {
- ShowLinkDetailInfo(sLinkId, sLyrType.ToIntDef(1));
- }
- }
- return;
- }
- if (AFunc.Pos("onfacilityrightclick"))
- {
- int nLyrType;
- String sFID;
- //int X, Y;
- TStringList *pStringList = new TStringList;
- pStringList->CommaText = AArgs;
- try
- {
- nLyrType = pStringList->Strings[0].ToIntDef(0);
- sFID = pStringList->Strings[1];
- //X = pStringList->Strings[4].ToIntDef(0);
- //Y = pStringList->Strings[5].ToIntDef(0);
- if (nLyrType != LyrTp_Vds) OnMapPopupMenu(nLyrType, sFID, false);
- }
- catch(Exception &e)
- {
- }
- delete pStringList;
- }
- }
- catch(Exception &exception)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::SetGisTrafficColor()
- {
- #if 0
- //TODO
- //소통등급별 색상을 던지는 것을 여기에 추가한다.
- TUTISLinkGrade UtisLinkColor;
- GetGisTrafficColor(UtisLinkColor);
- // 소통정보를 표출할 스레드 생성
- for (int ii = 0; ii < MAX_LAYERS; ii++)
- {
- if (m_pLinkSpeedUpdate[ii] == NULL) continue;
- m_pLinkSpeedUpdate[ii]->SetUTISLinkColor(UtisLinkColor);
- }
- #endif
- }
- //---------------------------------------------------------------------------
- bool __fastcall TITS0000M::SelectLinkById(int ALinkLevel, String AId, bool AHide/*=false*/)
- {
- if (!FRAMEOpenMap1->MapStart) return false;
- int nMapZoom = FRAMEOpenMap1->MapZoom;
- switch(ALinkLevel)
- {
- case 0:
- FLayerIdx = LyrTp_Node;
- break;
- case 1:
- FLayerIdx = LyrTp_Link;
- if (nMapZoom > 20 || nMapZoom < 16) nMapZoom = 17;
- break;
- case 2:
- FLayerIdx = LyrTp_Ifsc;
- if (nMapZoom > 15 || nMapZoom < 14) nMapZoom = 15;
- break;
- case 3:
- FLayerIdx = LyrTp_Road;
- if (nMapZoom > 13 || nMapZoom < 12) nMapZoom = 13;
- break;
- }
- sJs.printf(L"selectLayerObject(%d, '%s', %d)", FLayerIdx, AId.c_str(), nMapZoom);
- FRAMEOpenMap1->ExecScript(sJs);
- return true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::RefreshGisLink()
- {
- SelectLinkById(g_SelLink.Level, g_SelLink.Id, true);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::SelGisItem(int AType, String AId)
- {
- SelectLinkById(AType, AId);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::TmrInitGisTimer(TObject *Sender)
- {
- TmrInitGis->Enabled = false;
- if (!FRAMEOpenMap1->MapStart) return;
- PbLoadMap->Properties->Text = lblGisStep2->Caption;//"시설물 로딩 중...";
- PbLoadMap->Position = 60;
- Application->ProcessMessages();
- InitGisFacility();
- PbLoadMap->Properties->Text = lblGisStep3->Caption;//"소통정보 로딩 중...";
- PbLoadMap->Position = 80;
- Application->ProcessMessages();
- InitGisTraffic();
- PbLoadMap->Properties->Text = lblGisStep4->Caption;//"돌발정보 로딩 중...";
- PbLoadMap->Position = 100;
- Application->ProcessMessages();
- UpdateGisIncident();
- //여기부분은 모든 레이어를 생성한 후에 실행해야 한다.
- //ChkTrafficClick((TObject*)ChkTraffic);
- ChkTrafficTooltipClick((TObject*)ChkTrafficTooltip);
- PnlProgress->Visible = false;
- PnlToolbar->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ChkFacilityLayerShowHideClick(TObject *Sender)
- {
- if (!FRAMEOpenMap1->MapStart) return;
- TcxCheckBox *pCheck = (TcxCheckBox*)Sender;
- sJs.printf(L"showLayer(%d, %d)", pCheck->Tag, pCheck->Checked ? 1 : 0);
- FRAMEOpenMap1->ExecScript(sJs);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ChkTrafficClick(TObject *Sender)
- {
- if (!FRAMEOpenMap1->MapStart) return;
- TcxCheckBox *pCheck = (TcxCheckBox*)Sender;
- sJs.printf(L"showTrafficLayer(%d)", pCheck->Checked ? 1 : 0);
- FRAMEOpenMap1->ExecScript(sJs);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ChkTrafficTooltipClick(TObject *Sender)
- {
- if (!FRAMEOpenMap1->MapStart) return;
- TcxCheckBox *pCheck = (TcxCheckBox*)Sender;
- sJs.printf(L"showTrafficTooltip(%d)", pCheck->Checked ? 1 : 0);
- FRAMEOpenMap1->ExecScript(sJs);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::LblZoomDblClick(TObject *Sender)
- {
- FRAMEOpenMap1->reMsg->Visible = !FRAMEOpenMap1->reMsg->Visible;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ChkGisSearchClick(TObject *Sender)
- {
- try
- {
- if (ChkGisSearch->Checked)
- {
- if (FrmGisSearch == NULL)
- {
- FrmGisSearch = new TFrmGisSearch(this);
- //FrmGisSearch->Parent = this;
- }
- FrmGisSearch->Show();
- }
- else
- {
- if (FrmGisSearch)
- {
- if (FrmGisSearch->m_bClose == false)
- {
- FrmGisSearch->Close();
- }
- }
- }
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FormCloseQuery(TObject *Sender, bool &CanClose)
- {
- FRAMEOpenMap1->OnCloseQuery(CanClose);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::DebugMsg(String AMsg)
- {
- LblMsg->Caption = AMsg;
- LblMsg->Refresh();
- if (LblMsg->Visible == false) LblMsg->Visible = true;
- TmrDebugHide->Enabled = false;
- TmrDebugHide->Enabled = true;
- DebugLog(AMsg);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::DebugLog(String AMsg)
- {
- if (TabDebug->Visible)
- {
- reMsg->Lines->Add(Now().FormatString("HH:NN:SS.ZZZ") + ": " + AMsg);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::TmrDebugHideTimer(TObject *Sender)
- {
- LblMsg->Visible = false;
- TmrDebugHide->Enabled = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::reMsgDblClick(TObject *Sender)
- {
- reMsg->Lines->Clear();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FRAMEAtmpPltnList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift, bool &AHandled)
- {
- if (!ACellViewInfo) return;
- try {
- TcxDataController *pGDC = FRAMEAtmpPltnList1->TvList->DataController;
- int nRow = pGDC->FocusedRecordIndex;
- if (nRow < 0) return;
- String sId = VarToStr(pGDC->Values[nRow][FRAMEAtmpPltnList1->Col00->Index]);
- String sDx = VarToStr(pGDC->Values[nRow][FRAMEAtmpPltnList1->Col30->Index]);
- String sDy = VarToStr(pGDC->Values[nRow][FRAMEAtmpPltnList1->Col31->Index]);
- SelectObjectByPos(StrToFloat(sDx), StrToFloat(sDy), true);
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FRAMEVilgShprList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift, bool &AHandled)
- {
- if (!ACellViewInfo) return;
- try {
- TcxDataController *pGDC = FRAMEVilgShprList1->TvList->DataController;
- int nRow = pGDC->FocusedRecordIndex;
- if (nRow < 0) return;
- String sId = VarToStr(pGDC->Values[nRow][FRAMEVilgShprList1->Col00->Index]);
- String sDx = VarToStr(pGDC->Values[nRow][FRAMEVilgShprList1->Col20->Index]);
- String sDy = VarToStr(pGDC->Values[nRow][FRAMEVilgShprList1->Col21->Index]);
- SelectObjectByPos(StrToFloat(sDx), StrToFloat(sDy), true);
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::FRAMEVilgFrcsList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift, bool &AHandled)
- {
- if (!ACellViewInfo) return;
- try {
- TcxDataController *pGDC = FRAMEVilgFrcsList1->TvList->DataController;
- int nRow = pGDC->FocusedRecordIndex;
- if (nRow < 0) return;
- String sId = VarToStr(pGDC->Values[nRow][FRAMEVilgFrcsList1->Col00->Index]);
- String sDx = VarToStr(pGDC->Values[nRow][FRAMEVilgFrcsList1->Col20->Index]);
- String sDy = VarToStr(pGDC->Values[nRow][FRAMEVilgFrcsList1->Col21->Index]);
- SelectObjectByPos(StrToFloat(sDx), StrToFloat(sDy), true);
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::PnlFacilityDblClick(TObject *Sender)
- {
- FRAMEOpenMap1->ExecScript("getMapExtent()");
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::mnuParkMsgClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TPoint pt;
- GetCursorPos(&pt);
- pt = ITS0000M->ScreenToClient(pt);
- ShowParkingLotInfo(FSelId, pt);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0000M::ShowParkingLotInfo(String AId, TPoint pt)
- {
- TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
- if (!pFacility) return;
- TPrltCtlr *pObj = (TPrltCtlr*)pFacility->Object;
- if (!pObj) return;
- try {
- if (pObj->FData1)
- {
- TFrmParkMsg *pForm = (TFrmParkMsg *)pObj->FData1;
- pForm->SetFocus();
- }
- else
- {
- TFrmParkMsg *pForm = new TFrmParkMsg(ITS0000M, pObj);
- pForm->Parent = ITS0000M;
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- pObj->FData1 = (void*)pForm;
- pForm->Show();
- }
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
|