ITS0000MF.cpp 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "WindowMsgF.h"
  6. #include "CDSFacilityF.h"
  7. #include "CDSIncidentF.h"
  8. #include "FrmMainF.h"
  9. #include "CommFlashF.h"
  10. #pragma hdrstop
  11. #include "ITS0000MF.h"
  12. //---------------------------------------------------------------------------
  13. #pragma package(smart_init)
  14. #pragma link "FRAME_FacilityStatusListF"
  15. #pragma link "FRAME_ProcessStatusListF"
  16. #pragma link "FRAME_UtisStatusListF"
  17. #pragma link "FRAME_IncidentListF"
  18. #pragma link "FRAME_RepeatCongestListF"
  19. #pragma link "FRAME_TrafficMissLinkListF"
  20. #pragma link "cxContainer"
  21. #pragma link "cxControls"
  22. #pragma link "cxEdit"
  23. #pragma link "cxGraphics"
  24. #pragma link "cxGroupBox"
  25. #pragma link "cxLabel"
  26. #pragma link "cxLookAndFeelPainters"
  27. #pragma link "cxLookAndFeels"
  28. #pragma link "cxPC"
  29. #pragma link "cxPCdxBarPopupMenu"
  30. #pragma link "cxSplitter"
  31. #pragma link "dxSkinBlack"
  32. #pragma link "dxSkinBlue"
  33. #pragma link "dxSkinCaramel"
  34. #pragma link "dxSkinCoffee"
  35. #pragma link "dxSkinDarkRoom"
  36. #pragma link "dxSkinDarkSide"
  37. #pragma link "dxSkinFoggy"
  38. #pragma link "dxSkinGlassOceans"
  39. #pragma link "dxSkiniMaginary"
  40. #pragma link "dxSkinLilian"
  41. #pragma link "dxSkinLiquidSky"
  42. #pragma link "dxSkinLondonLiquidSky"
  43. #pragma link "dxSkinMcSkin"
  44. #pragma link "dxSkinMoneyTwins"
  45. #pragma link "dxSkinOffice2007Black"
  46. #pragma link "dxSkinOffice2007Blue"
  47. #pragma link "dxSkinOffice2007Green"
  48. #pragma link "dxSkinOffice2007Pink"
  49. #pragma link "dxSkinOffice2007Silver"
  50. #pragma link "dxSkinOffice2010Black"
  51. #pragma link "dxSkinOffice2010Blue"
  52. #pragma link "dxSkinOffice2010Silver"
  53. #pragma link "dxSkinsCore"
  54. #pragma link "dxSkinscxPCPainter"
  55. #pragma link "dxSkinSeven"
  56. #pragma link "dxSkinSharp"
  57. #pragma link "dxSkinSilver"
  58. #pragma link "dxSkinStardust"
  59. #pragma link "FRAME_IncidentAutoListF"
  60. #pragma link "cxClasses"
  61. #pragma link "cxCustomData"
  62. #pragma link "cxData"
  63. #pragma link "cxDataStorage"
  64. #pragma link "cxFilter"
  65. #pragma link "cxGrid"
  66. #pragma link "cxGridCustomTableView"
  67. #pragma link "cxGridCustomView"
  68. #pragma link "cxGridLevel"
  69. #pragma link "cxGridTableView"
  70. #pragma link "cxStyles"
  71. #pragma link "cxTextEdit"
  72. #pragma resource "*.dfm"
  73. TITS0000M *ITS0000M = NULL;
  74. //---------------------------------------------------------------------------
  75. __fastcall TITS0000M::TITS0000M(TComponent* Owner)
  76. : TForm(Owner)
  77. {
  78. ITSSkin_Load(this);
  79. LoadLocalSkin();
  80. CMM_LoadForm(g_sFormsDir, this);
  81. PgSystem->Properties->ActivePage = TsIncident;
  82. GrpSystem->Caption = "▶ 시스템 운영 정보 - " + TsIncident->Caption;
  83. FRAMEFacilityStatusList1->PnlBottom->Visible = false;
  84. //FrmMain->dxStatusBar->Panels->Items[isbGisPos]->Visible = true;
  85. ITS00MAP = new TITS00MAP(PnlMapBack, (TForm*)this);
  86. //TsIncidentAuto->TabVisible = false;
  87. //TsIncidentAuto->Visible = false;
  88. }
  89. //---------------------------------------------------------------------------
  90. /*
  91. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  92. * Form과 DataModule class를 delete시킨다.
  93. * arguments
  94. *
  95. * return
  96. * void
  97. */
  98. void __fastcall TITS0000M::CommClose()
  99. {
  100. try
  101. {
  102. if (FrmMain->dxStatusBar->Panels->Items[isbGisPos]->Visible)
  103. FrmMain->dxStatusBar->Panels->Items[isbGisPos]->Visible = false;
  104. if (ITS00MAP)
  105. {
  106. delete ITS00MAP;
  107. ITS00MAP = NULL;
  108. }
  109. CMM_SaveForm(g_sFormsDir, this);
  110. }
  111. catch(...)
  112. {
  113. }
  114. }
  115. //---------------------------------------------------------------------------
  116. /*
  117. * Form이 메모리에서 생성될때 호출되는 생성자 이벤트 핸들러
  118. * arguments
  119. * Sender : event handler 객체
  120. * return
  121. * void
  122. */
  123. void __fastcall TITS0000M::FormCreate(TObject *Sender)
  124. {
  125. if (ITS00MAP)
  126. {
  127. ITS00MAP->Parent = PnlMapBack;
  128. ITS00MAP->Show();
  129. }
  130. }
  131. //---------------------------------------------------------------------------
  132. /*
  133. * Form을 보여줄때 호출되는 event 메서드이다.
  134. * arguments
  135. * Sender : event handler 객체
  136. * return
  137. * void
  138. */
  139. void __fastcall TITS0000M::FormShow(TObject *Sender)
  140. {
  141. Refresh();
  142. Application->ProcessMessages();
  143. TmrShow->Enabled = true;
  144. }
  145. //---------------------------------------------------------------------------
  146. /*
  147. * Form의 Skin 초기화 작업을 수행한다.
  148. * arguments
  149. * void
  150. * return
  151. * void
  152. */
  153. void __fastcall TITS0000M::LoadLocalSkin()
  154. {
  155. #define MAX_VIEW 8
  156. TcxGridTableView *pView[MAX_VIEW];
  157. TcxGrid *pGrid[MAX_VIEW];
  158. pGrid[ 0] = FRAMEProcessStatusList1->CxList; //프로세스상태
  159. pGrid[ 1] = FRAMEFacilityStatusList1->CxList; //시설물상태
  160. pGrid[ 2] = NULL;//FRAMEUtisStatusList1->CxUtisRun; //UTIS현황-운영현황
  161. pGrid[ 3] = NULL;//FRAMEUtisStatusList1->CxUtisRse; //UTIS현황-RSE상태현황
  162. #if 0
  163. pGrid[ 2] = FRAMEUtisStatusList1->CxUtisRun; //UTIS현황-운영현황
  164. pGrid[ 3] = RAMEUtisStatusList1->CxUtisRse; //UTIS현황-RSE상태현황
  165. #endif
  166. pGrid[ 4] = FRAMEIncidentList1->CxList; //돌발
  167. pGrid[ 5] = FRAMERepeatCongestList1->CxList; //반복정체구간
  168. pGrid[ 6] = FRAMETrafficMissLinkList1->CxList; //소통정보결측구간
  169. pGrid[ 7] = FRAMEIncidentAutoList1->CxList2; //소통정보결측구간
  170. pView[ 0] = FRAMEProcessStatusList1->TvList;
  171. pView[ 1] = FRAMEFacilityStatusList1->TvList;
  172. pView[ 2] = NULL;//FRAMEUtisStatusList1->TvUtisRun;
  173. pView[ 3] = NULL;//FRAMEUtisStatusList1->TvUtisRse;
  174. #if 0
  175. pView[ 2] = FRAMEUtisStatusList1->TvUtisRun;
  176. pView[ 3] = FRAMEUtisStatusList1->TvUtisRse;
  177. #endif
  178. pView[ 4] = FRAMEIncidentList1->TvList;
  179. pView[ 5] = FRAMERepeatCongestList1->TvList;
  180. pView[ 6] = FRAMETrafficMissLinkList1->TvList;
  181. pView[ 7] = FRAMEIncidentAutoList1->TvList2;
  182. for (int ii = 0; ii < MAX_VIEW; ii++)
  183. {
  184. if (!pView[ii]) continue;
  185. //pGrid[ii]->LookAndFeel->SkinName = "McSkin";
  186. pView[ii]->Styles->Inactive = NULL;
  187. pView[ii]->Styles->ContentOdd = NULL;
  188. pView[ii]->Styles->ContentEven= NULL;
  189. pView[ii]->Styles->Selection = NULL;
  190. pView[ii]->OptionsSelection->CellSelect = false;
  191. }
  192. }
  193. //---------------------------------------------------------------------------
  194. /*
  195. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  196. * arguments
  197. * Sender : event handler 객체
  198. * return
  199. * void
  200. */
  201. void __fastcall TITS0000M::TmrShowTimer(TObject *Sender)
  202. {
  203. TmrShow->Enabled = false;
  204. // 리스트 항목을 초기화한다.
  205. InitListData();
  206. }
  207. //---------------------------------------------------------------------------
  208. void __fastcall TITS0000M::InitListData()
  209. {
  210. FIncidentCnt = 0;
  211. FRrCongestCnt = 0;
  212. FMissLinkCnt = 0;
  213. FRAMEFacilityStatusList1->UpdateList();
  214. UpdateFacilityStatusTotal();
  215. FRAMEProcessStatusList1->UpdateList();
  216. FRAMEIncidentList1->UpdateList();
  217. FRAMERepeatCongestList1->UpdateList();
  218. FRAMETrafficMissLinkList1->UpdateList();
  219. FRAMEIncidentAutoList1->UpdateList();
  220. UpdateAlarmStatus();
  221. }
  222. //---------------------------------------------------------------------------
  223. void __fastcall TITS0000M::UpdateAlarmStatus()
  224. {
  225. String sAlarmMsg = "";
  226. FIncidentCnt = FRAMEIncidentList1->TvList->DataController->RecordCount;
  227. FRrCongestCnt = FRAMERepeatCongestList1->TvList->DataController->RecordCount;
  228. FMissLinkCnt = FRAMETrafficMissLinkList1->TvList->DataController->RecordCount;
  229. FIncidentAutoCnt = FRAMEIncidentAutoList1->TvList2->DataController->RecordCount;
  230. if (TsIncidentAuto->TabVisible == false)
  231. FIncidentAutoCnt = 0;
  232. if (FIncidentCnt > 0)
  233. {
  234. sAlarmMsg += "돌발상황(" + String(FIncidentCnt) + ") ";
  235. TsIncident->ImageIndex = 1;
  236. }
  237. else
  238. TsIncident->ImageIndex = 2;
  239. if (FRrCongestCnt > 0)
  240. {
  241. sAlarmMsg += "반복정체구간(" + String(FRrCongestCnt) + ") ";
  242. TsRrCongest->ImageIndex = 1;
  243. }
  244. else
  245. TsRrCongest->ImageIndex = 2;
  246. if (FMissLinkCnt > 0)
  247. {
  248. sAlarmMsg += "결측구간(" + String(FMissLinkCnt) + ") ";
  249. TsMissingLink->ImageIndex = 1;
  250. }
  251. else
  252. TsMissingLink->ImageIndex = 2;
  253. if (FIncidentAutoCnt > 0)
  254. {
  255. sAlarmMsg += "자동돌발(" + String(FIncidentAutoCnt) + ") ";
  256. TsIncidentAuto->ImageIndex = 1;
  257. }
  258. else
  259. TsIncidentAuto->ImageIndex = 2;
  260. LblAlarm->Caption = sAlarmMsg;
  261. if ((FIncidentCnt+FRrCongestCnt+FMissLinkCnt+FIncidentAutoCnt) > 0)
  262. {
  263. LblAlarm->Visible = true;
  264. }
  265. else
  266. {
  267. LblAlarm->Visible = false;
  268. }
  269. }
  270. //---------------------------------------------------------------------------
  271. void __fastcall TITS0000M::PgSystemPageChanging(TObject *Sender, TcxTabSheet *NewPage, bool &AllowChange)
  272. {
  273. GrpSystem->Caption = "▶ 시스템 운영 정보 - " + NewPage->Caption;
  274. }
  275. //---------------------------------------------------------------------------
  276. void __fastcall TITS0000M::FormClose(TObject *Sender, TCloseAction &Action)
  277. {
  278. try {
  279. CommClose();
  280. ITS0000M = NULL;
  281. Action = caFree;
  282. } catch(...) {}
  283. }
  284. //---------------------------------------------------------------------------
  285. /*
  286. * 메인폼에서 데이터를 수신시 발생하는 이벤트 핸들러
  287. * arguments
  288. *
  289. * return
  290. * void
  291. */
  292. void __fastcall TITS0000M::OnMainFormMessage(TMessage &Msg)
  293. {
  294. switch(Msg.WParam)
  295. {
  296. case WP_DB_SELECT_OK:
  297. switch(Msg.LParam)
  298. {
  299. case LP_MSG_01: if (g_AppCfg.bDebug) ITSUtil_Trace("LP_MSG_01"); UpdateTrafficMissLinkInfo(); break;
  300. case LP_MSG_02: if (g_AppCfg.bDebug) ITSUtil_Trace("LP_MSG_02"); /*서비스링크소통정보*/ break;
  301. case LP_MSG_03: if (g_AppCfg.bDebug) ITSUtil_Trace("LP_MSG_03"); /*도로소통정보*/ break;
  302. case LP_MSG_04: if (g_AppCfg.bDebug) ITSUtil_Trace("LP_MSG_04"); UpdateTrafficRrCongestInfo(); break;
  303. case LP_MSG_05: if (g_AppCfg.bDebug) ITSUtil_Trace("LP_MSG_05"); UpdateUtisStatusInfo(); break;
  304. case LP_MSG_11: if (g_AppCfg.bDebug) ITSUtil_Trace("LP_MSG_11"); UpdateFacilityStatusInfo(); break;
  305. case LP_MSG_12: if (g_AppCfg.bDebug) ITSUtil_Trace("LP_MSG_12"); UpdateProcessStatusInfo(); break;
  306. case LP_MSG_13: if (g_AppCfg.bDebug) ITSUtil_Trace("LP_MSG_13"); UpdateIncidentInfo(); break;
  307. case LP_MSG_14: if (g_AppCfg.bDebug) ITSUtil_Trace("LP_MSG_14"); UpdateFacilityInfo(); break;
  308. case LP_MSG_09: if (g_AppCfg.bDebug) ITSUtil_Trace("LP_MSG_09");
  309. FRAMEProcessStatusList1->UpdateList();
  310. break;
  311. #if 0
  312. case LP_MSG_10: //가공서버에서 소통정보 가공완료하였음.
  313. // GIS 소통정보 업데이트
  314. if (ITS00MAP) ITS00MAP->RefreshMapTraffic();
  315. break;
  316. #endif
  317. case LP_MSG_00: //가공서버에서 소통정보 가공완료하였음.
  318. // GIS 소통정보 업데이트
  319. if (ITS00MAP) ITS00MAP->RefreshMapTraffic();
  320. break;
  321. }
  322. break;
  323. case WP_MSG_01: //소통등급이 변경되었다.
  324. if (ITS00MAP) ITS00MAP->SetGisTrafficColor();
  325. break;
  326. case WP_MSG_02: //돌발정보를 현단말에서 취소/등록/해제 하였다.
  327. UpdateIncidentInfo();
  328. break;
  329. case WP_MSG_03: //시설물 기본정보가 변경됨
  330. UpdateFacilityInfo();
  331. //FRAMEFacilityStatusList1->UpdateList();
  332. break;
  333. case WP_DB_SELECT_ERROR:
  334. case WP_DB_SELECT_CANCEL:
  335. break;
  336. case WP_MSG_15:
  337. if (LP_MSG_15 == Msg.LParam)
  338. {
  339. if (ITS00MAP) ITS00MAP->RefreshGisLink();
  340. }
  341. break;
  342. }
  343. }
  344. //---------------------------------------------------------------------------
  345. void __fastcall TITS0000M::UpdateTrafficMissLinkInfo()
  346. {
  347. FMissLinkCnt = 0;
  348. FRAMETrafficMissLinkList1->UpdateList();
  349. FRAMEIncidentAutoList1->UpdateList();
  350. UpdateAlarmStatus();
  351. }
  352. //---------------------------------------------------------------------------
  353. void __fastcall TITS0000M::UpdateTrafficRrCongestInfo()
  354. {
  355. FRrCongestCnt = 0;
  356. FRAMERepeatCongestList1->UpdateList();
  357. UpdateAlarmStatus();
  358. }
  359. //---------------------------------------------------------------------------
  360. void __fastcall TITS0000M::UpdateIncidentInfo()
  361. {
  362. FIncidentCnt = 0;
  363. FRAMEIncidentList1->UpdateList();
  364. FRAMEIncidentAutoList1->UpdateList();
  365. UpdateAlarmStatus();
  366. if (ITS00MAP) ITS00MAP->UpdateIncidentStatus();
  367. }
  368. //---------------------------------------------------------------------------
  369. void __fastcall TITS0000M::UpdateFacilityStatusInfo()
  370. {
  371. //FRAMEFacilityStatusList1->UpdateList();
  372. FRAMEFacilityStatusList1->RefreshList();
  373. UpdateFacilityStatusTotal();
  374. if (ITS00MAP) ITS00MAP->UpdateFacilityStatus();
  375. }
  376. //---------------------------------------------------------------------------
  377. void __fastcall TITS0000M::UpdateProcessStatusInfo()
  378. {
  379. FRAMEProcessStatusList1->RefreshList();
  380. }
  381. //---------------------------------------------------------------------------
  382. void __fastcall TITS0000M::UpdateUtisStatusInfo()
  383. {
  384. //FRAMEUtisStatusList1->RefreshList();
  385. }
  386. //---------------------------------------------------------------------------
  387. void __fastcall TITS0000M::UpdateFacilityInfo()
  388. {
  389. FRAMEFacilityStatusList1->UpdateList();
  390. UpdateFacilityStatusTotal();
  391. if (ITS00MAP) ITS00MAP->UpdateFacilityStatus(); //지도 시설물 재로딩
  392. }
  393. //---------------------------------------------------------------------------
  394. void __fastcall TITS0000M::FRAMEIncidentList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  395. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  396. {
  397. //돌발 클릭
  398. if (!ACellViewInfo) return;
  399. try {
  400. TcxDataController *pGDC = FRAMEIncidentList1->TvList->DataController;
  401. int nRow = pGDC->FocusedRecordIndex;
  402. if (nRow < 0) return;
  403. String sId = VarToStr(pGDC->Values[nRow][FRAMEIncidentList1->Column01->Index]);
  404. String sDx = VarToStr(pGDC->Values[nRow][FRAMEIncidentList1->Column07->Index]);
  405. String sDy = VarToStr(pGDC->Values[nRow][FRAMEIncidentList1->Column08->Index]);
  406. if (ITS00MAP) ITS00MAP->SelectObjectByPos(StrToFloat(sDx), StrToFloat(sDy), true);
  407. } catch(...) {}
  408. }
  409. //---------------------------------------------------------------------------
  410. void __fastcall TITS0000M::FRAMERepeatCongestList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  411. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  412. {
  413. //반복정체구간 클릭
  414. if (!ACellViewInfo) return;
  415. try {
  416. TcxDataController *pGDC = FRAMERepeatCongestList1->TvList->DataController;
  417. int nRow = pGDC->FocusedRecordIndex;
  418. if (nRow < 0) return;
  419. String sSvcLinkId = VarToStr(pGDC->Values[nRow][FRAMERepeatCongestList1->Column01->Index]);
  420. if (ITS00MAP) ITS00MAP->SelectLinkById(2, sSvcLinkId, true);
  421. } catch(...) {}
  422. }
  423. //---------------------------------------------------------------------------
  424. void __fastcall TITS0000M::FRAMETrafficMissLinkList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  425. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  426. {
  427. //소통정보 결측구간 클릭
  428. if (!ACellViewInfo) return;
  429. try {
  430. TcxDataController *pGDC = FRAMETrafficMissLinkList1->TvList->DataController;
  431. int nRow = pGDC->FocusedRecordIndex;
  432. if (nRow < 0) return;
  433. String sLinkId = VarToStr(pGDC->Values[nRow][FRAMETrafficMissLinkList1->Column02->Index]);
  434. if (ITS00MAP) ITS00MAP->SelectLinkById(1, sLinkId, true);
  435. } catch(...) {}
  436. }
  437. //---------------------------------------------------------------------------
  438. void __fastcall TITS0000M::FRAMEFacilityStatusList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  439. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  440. {
  441. //시설물 위치이동
  442. if (!ACellViewInfo) return;
  443. try {
  444. TcxDataController *pGDC = FRAMEFacilityStatusList1->TvList->DataController;
  445. int nRow = pGDC->FocusedRecordIndex;
  446. if (nRow < 0) return;
  447. String sType = VarToStr(pGDC->Values[nRow][FRAMEFacilityStatusList1->Column01->Index]);
  448. FSelId = VarToStr(pGDC->Values[nRow][FRAMEFacilityStatusList1->Column02->Index]);
  449. MoveGisFacility(sType, FSelId);
  450. } catch(...) {}
  451. }
  452. //---------------------------------------------------------------------------
  453. void __fastcall TITS0000M::MoveGisFacility(String AType, String AId)
  454. {
  455. if (AType == "CCTV")
  456. {
  457. TItsCctv *pObj = ItsFacilityManager->FCctvLists.Find(AId);
  458. if (pObj) if (ITS00MAP) ITS00MAP->SelectObjectByPos(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0), true);
  459. }
  460. else
  461. if (AType == "VMS")
  462. {
  463. TItsVms *pObj = ItsFacilityManager->FVmsLists.Find(AId);
  464. if (pObj) if (ITS00MAP) ITS00MAP->SelectObjectByPos(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0), true);
  465. }
  466. else
  467. if (AType == "RSE")
  468. {
  469. TItsRse *pObj = ItsFacilityManager->FRseLists.Find(AId);
  470. if (pObj) if (ITS00MAP) ITS00MAP->SelectObjectByPos(StrToFloatDef(pObj->COORDX, 0), StrToFloatDef(pObj->COORDY, 0), true);
  471. }
  472. else
  473. if (AType == "WCAM")
  474. {
  475. TItsWebCam *pObj = ItsFacilityManager->FWebCamLists.Find(AId);
  476. if (pObj) if (ITS00MAP) ITS00MAP->SelectObjectByPos(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0), true);
  477. }
  478. else
  479. if (AType == "VDS")
  480. {
  481. #if 1
  482. TItsVds *pObj = ItsFacilityManager->FVdsLists.Find(AId);
  483. if (pObj) if (ITS00MAP) ITS00MAP->SelectObjectByPos(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0), true);
  484. #else
  485. TItsVds *pObj = NULL;//ItsFacilityManager->FVdsLists.Find(AId);
  486. FOR_STL(TItsVds*, pTmp, ItsFacilityManager->FVdsLists)
  487. {
  488. if (AId == pTmp->VDS_CTLR_ID)
  489. {
  490. pObj = pTmp;
  491. break;
  492. }
  493. }
  494. if (pObj) if (ITS00MAP) ITS00MAP->SelectObjectByPos(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0), true);
  495. #endif
  496. }
  497. else
  498. if (AType == "AVI")
  499. {
  500. #if 1
  501. TItsAvi *pObj = ItsFacilityManager->FAviLists.Find(AId);
  502. if (pObj) if (ITS00MAP) ITS00MAP->SelectObjectByPos(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0), true);
  503. #else
  504. TItsAvi *pObj = NULL;//ItsFacilityManager->FAviLists.Find(AId);
  505. FOR_STL(TItsAvi*, pTmp, ItsFacilityManager->FAviLists)
  506. {
  507. if (AId == pTmp->AVI_ID)
  508. {
  509. pObj = pTmp;
  510. break;
  511. }
  512. }
  513. if (pObj) if (ITS00MAP) ITS00MAP->SelectObjectByPos(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0), true);
  514. #endif
  515. }
  516. else
  517. if (AType == "DSRC")
  518. {
  519. #if 1
  520. TItsDsrc *pObj = ItsFacilityManager->FDsrcLists.Find(AId);
  521. if (pObj) if (ITS00MAP) ITS00MAP->SelectObjectByPos(StrToFloatDef(pObj->LCTN_X, 0), StrToFloatDef(pObj->LCTN_Y, 0), true);
  522. #else
  523. TItsDsrc *pObj = NULL;//ItsFacilityManager->FDsrcLists.Find(AId);
  524. FOR_STL(TItsDsrc*, pTmp, ItsFacilityManager->FDsrcLists)
  525. {
  526. if (AId == pTmp->RSE_ID)
  527. {
  528. pObj = pTmp;
  529. break;
  530. }
  531. }
  532. if (pObj) if (ITS00MAP) ITS00MAP->SelectObjectByPos(StrToFloatDef(pObj->LCTN_X, 0), StrToFloatDef(pObj->LCTN_Y, 0), true);
  533. #endif
  534. }
  535. }
  536. //---------------------------------------------------------------------------
  537. void __fastcall TITS0000M::FRAMEFacilityStatusList1TvListCellClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  538. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  539. {
  540. if (AButton != mbRight) return;
  541. if (!ACellViewInfo) return;
  542. try {
  543. TcxDataController *pGDC = FRAMEFacilityStatusList1->TvList->DataController;
  544. int nRow = pGDC->FocusedRecordIndex;
  545. if (nRow < 0) return;
  546. String sType = VarToStr(pGDC->Values[nRow][FRAMEFacilityStatusList1->Column01->Index]);
  547. FSelId = VarToStr(pGDC->Values[nRow][FRAMEFacilityStatusList1->Column02->Index]);
  548. POINT p;
  549. GetCursorPos(&p);
  550. if (sType == "CCTV") pmuCctv->Popup(p.x, p.y);
  551. else
  552. if (sType == "VMS") pmuVms->Popup(p.x, p.y);
  553. else
  554. if (sType == "RSE") pmuRse->Popup(p.x, p.y);
  555. else
  556. if (sType == "WCAM") pmuWebCam->Popup(p.x, p.y);
  557. else
  558. if (sType == "VDS") pmuVds->Popup(p.x, p.y);
  559. else
  560. if (sType == "AVI") pmuAvi->Popup(p.x, p.y);
  561. else
  562. if (sType == "DSRC") pmuDsrc->Popup(p.x, p.y);
  563. } catch(...) {}
  564. }
  565. //---------------------------------------------------------------------------
  566. void __fastcall TITS0000M::pmuFacilityPopup(TObject *Sender)
  567. {
  568. String sLoc = " ";
  569. TPopupMenu *pMenu = (TPopupMenu*)Sender;
  570. if (pMenu->Tag == 0)
  571. {
  572. TItsCctv *pObj = ItsFacilityManager->FCctvLists.Find(FSelId);
  573. if (pObj) sLoc = TCommFlash::ReplaceName(pObj->ISTL_LCTN_NM);
  574. //MnuCctvId->Caption = "[CCTV] " + FSelId + " " + sLoc;
  575. MnuCctvId->Caption = "[CCTV] " + sLoc;
  576. }
  577. else
  578. if (pMenu->Tag == 1)
  579. {
  580. TItsVms *pObj = ItsFacilityManager->FVmsLists.Find(FSelId);
  581. if (pObj) sLoc = TCommFlash::ReplaceName(pObj->VMS_NM);
  582. //MnuVmsId->Caption = "[VMS] " + FSelId + " " + sLoc;
  583. MnuVmsId->Caption = "[VMS] " + sLoc;
  584. }
  585. else
  586. if (pMenu->Tag == 2)
  587. {
  588. TItsRse *pObj = ItsFacilityManager->FRseLists.Find(FSelId);
  589. if (pObj) sLoc = TCommFlash::ReplaceName(pObj->LOCATION);
  590. //MnuRseId->Caption = "[RSE] " + FSelId + " " + sLoc;
  591. MnuRseId->Caption = "[RSE] " + sLoc;
  592. }
  593. else
  594. if (pMenu->Tag == 3)
  595. {
  596. TItsWebCam *pObj = ItsFacilityManager->FWebCamLists.Find(FSelId);
  597. if (pObj) sLoc = TCommFlash::ReplaceName(pObj->ISTL_LCTN_NM);
  598. //MnuWebCamId->Caption = "[웹카메라] " + FSelId + " " + sLoc;
  599. MnuWebCamId->Caption = "[웹카메라] " + sLoc;
  600. }
  601. else
  602. if (pMenu->Tag == 4)
  603. {
  604. TItsVds *pObj = ItsFacilityManager->FVdsLists.Find(FSelId);
  605. if (pObj) sLoc = TCommFlash::ReplaceName(pObj->LCTN);
  606. //MnuVdsId->Caption = "[VDS] " + FSelId + " " + sLoc;
  607. MnuVdsId->Caption = "[VDS] " + sLoc;
  608. }
  609. else
  610. if (pMenu->Tag == 5)
  611. {
  612. TItsAvi *pObj = ItsFacilityManager->FAviLists.Find(FSelId);
  613. if (pObj) sLoc = TCommFlash::ReplaceName(pObj->AVI_LCTN_NM);
  614. //MnuAviId->Caption = "[AVI] " + FSelId + " " + sLoc;
  615. MnuAviId->Caption = "[AVI] " + sLoc;
  616. }
  617. else
  618. if (pMenu->Tag == 6)
  619. {
  620. TItsDsrc *pObj = ItsFacilityManager->FDsrcLists.Find(FSelId);
  621. if (pObj) sLoc = TCommFlash::ReplaceName(pObj->ISTL_LCTN_NM);
  622. //MnuDsrcId->Caption = "[DSRC] " + FSelId + " " + sLoc;
  623. MnuDsrcId->Caption = "[DSRC] " + sLoc;
  624. }
  625. }
  626. //---------------------------------------------------------------------------
  627. void __fastcall TITS0000M::mnuFacilityMoveClick(TObject *Sender)
  628. {
  629. TMenuItem *pMenu = (TMenuItem*)Sender;
  630. Application->ProcessMessages();
  631. if (pMenu->Tag == 0)
  632. {
  633. MoveGisFacility("CCTV", FSelId);
  634. }
  635. else
  636. if (pMenu->Tag == 1)
  637. {
  638. MoveGisFacility("VMS", FSelId);
  639. }
  640. else
  641. if (pMenu->Tag == 2)
  642. {
  643. MoveGisFacility("RSE", FSelId);
  644. }
  645. else
  646. if (pMenu->Tag == 3)
  647. {
  648. MoveGisFacility("WCAM", FSelId);
  649. }
  650. else
  651. if (pMenu->Tag == 4)
  652. {
  653. MoveGisFacility("VDS", FSelId);
  654. }
  655. else
  656. if (pMenu->Tag == 5)
  657. {
  658. MoveGisFacility("AVI", FSelId);
  659. }
  660. else
  661. if (pMenu->Tag == 6)
  662. {
  663. MoveGisFacility("DSRC", FSelId);
  664. }
  665. }
  666. //---------------------------------------------------------------------------
  667. void __fastcall TITS0000M::mnuFacilityPingClick(TObject *Sender)
  668. {
  669. if (ITS00MAP)
  670. {
  671. ITS00MAP->FSelId = FSelId;
  672. ITS00MAP->mnuFacilityPingClick(Sender);
  673. }
  674. }
  675. //---------------------------------------------------------------------------
  676. void __fastcall TITS0000M::mnuStopImageClick(TObject *Sender)
  677. {
  678. if (ITS00MAP)
  679. {
  680. ITS00MAP->FSelId = FSelId;
  681. ITS00MAP->mnuStopImageClick(Sender);
  682. }
  683. }
  684. //---------------------------------------------------------------------------
  685. void __fastcall TITS0000M::mnuCctvCamClick(TObject *Sender)
  686. {
  687. if (ITS00MAP)
  688. {
  689. ITS00MAP->FSelId = FSelId;
  690. ITS00MAP->mnuCctvCamClick(Sender);
  691. }
  692. }
  693. //---------------------------------------------------------------------------
  694. void __fastcall TITS0000M::mnuVmsMsgClick(TObject *Sender)
  695. {
  696. if (ITS00MAP)
  697. {
  698. ITS00MAP->FSelId = FSelId;
  699. ITS00MAP->mnuVmsMsgClick(Sender);
  700. }
  701. }
  702. //---------------------------------------------------------------------------
  703. void __fastcall TITS0000M::mnuVmsCamClick(TObject *Sender)
  704. {
  705. if (ITS00MAP)
  706. {
  707. ITS00MAP->FSelId = FSelId;
  708. ITS00MAP->mnuVmsCamClick(Sender);
  709. }
  710. }
  711. //---------------------------------------------------------------------------
  712. void __fastcall TITS0000M::MnuWebCamClick(TObject *Sender)
  713. {
  714. if (ITS00MAP)
  715. {
  716. ITS00MAP->FSelId = FSelId;
  717. ITS00MAP->MnuWebCamClick(Sender);
  718. }
  719. }
  720. //---------------------------------------------------------------------------
  721. void __fastcall TITS0000M::FRAMEIncidentAutoList1TvList2CellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  722. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  723. {
  724. //소통정보 결측구간 클릭
  725. if (!ACellViewInfo) return;
  726. try {
  727. TcxDataController *pGDC = FRAMEIncidentAutoList1->TvList2->DataController;
  728. int nRow = pGDC->FocusedRecordIndex;
  729. if (nRow < 0) return;
  730. String sLinkId = VarToStr(pGDC->Values[nRow][FRAMEIncidentAutoList1->ColumnA01->Index]);
  731. if (ITS00MAP) ITS00MAP->SelectLinkById(1, sLinkId, true);
  732. } catch(...) {}
  733. }
  734. //---------------------------------------------------------------------------
  735. void __fastcall TITS0000M::UpdateFacilityStatusTotal()
  736. {
  737. int nRow = 0;
  738. try
  739. {
  740. CMM_ClearGridTableView(TvStatus);
  741. TcxDataController *pGDC = TvStatus->DataController;
  742. TvStatus->BeginUpdate();
  743. try
  744. {
  745. FOR_STL(TFacilityStatus*, pStatus, ItsFacilityManager->FListStatus)
  746. {
  747. nRow = pGDC->AppendRecord();
  748. pGDC->Values[nRow][ColName->Index] = pStatus->Type;
  749. pGDC->Values[nRow][ColTotal->Index] = pStatus->Total;
  750. pGDC->Values[nRow][ColNormal->Index] = pStatus->Total - pStatus->Error;
  751. pGDC->Values[nRow][ColFail->Index] = pStatus->Error;
  752. if (pStatus->Type == "VDS" || pStatus->Type == "AVI")
  753. pGDC->Values[nRow][ColModule->Index] = pStatus->Collect;//Module;
  754. else
  755. pGDC->Values[nRow][ColModule->Index] = "-";
  756. }
  757. }
  758. catch(Exception &exception)
  759. {
  760. }
  761. }
  762. __finally
  763. {
  764. TvStatus->EndUpdate();
  765. }
  766. }
  767. //---------------------------------------------------------------------------
  768. void __fastcall TITS0000M::ColNameCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas,
  769. TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone)
  770. {
  771. // 장비명
  772. if (AViewInfo->GridRecord->RecordIndex < 0) return;
  773. ACanvas->Font->Style = TFontStyles() << fsBold;
  774. }
  775. //---------------------------------------------------------------------------
  776. void __fastcall TITS0000M::ColTotalCustomDrawCell(TcxCustomGridTableView *Sender,
  777. TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  778. bool &ADone)
  779. {
  780. // 전체
  781. if (AViewInfo->GridRecord->RecordIndex < 0) return;
  782. ACanvas->Font->Style = TFontStyles() << fsBold;
  783. }
  784. //---------------------------------------------------------------------------
  785. void __fastcall TITS0000M::ColNormalCustomDrawCell(TcxCustomGridTableView *Sender,
  786. TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  787. bool &ADone)
  788. {
  789. // 정상
  790. if (AViewInfo->GridRecord->RecordIndex < 0) return;
  791. ACanvas->Font->Style = TFontStyles() << fsBold;
  792. }
  793. //---------------------------------------------------------------------------
  794. void __fastcall TITS0000M::ColFailCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas,
  795. TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone)
  796. {
  797. // 이상
  798. if (AViewInfo->GridRecord->RecordIndex < 0) return;
  799. ACanvas->Font->Style = TFontStyles() << fsBold;
  800. if (!VarIsNull(AViewInfo->GridRecord->DisplayTexts[ColFail->Index]))
  801. {
  802. String sErr = AViewInfo->GridRecord->DisplayTexts[ColFail->Index];
  803. if (sErr != "0")
  804. {
  805. ACanvas->Font->Color = clRed;
  806. }
  807. }
  808. }
  809. //---------------------------------------------------------------------------
  810. void __fastcall TITS0000M::ColModuleCustomDrawCell(TcxCustomGridTableView *Sender,
  811. TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  812. bool &ADone)
  813. {
  814. // 이상
  815. if (AViewInfo->GridRecord->RecordIndex < 0) return;
  816. ACanvas->Font->Style = TFontStyles() << fsBold;
  817. if (!VarIsNull(AViewInfo->GridRecord->DisplayTexts[ColModule->Index]))
  818. {
  819. String sErr = AViewInfo->GridRecord->DisplayTexts[ColModule->Index];
  820. if (sErr != "0")
  821. {
  822. ACanvas->Font->Color = clRed;
  823. }
  824. }
  825. }
  826. //---------------------------------------------------------------------------