IAN0040MF.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "ITSDbF.h"
  6. #include "AppGlobalF.h"
  7. #include "CDSNodeF.h"
  8. #include "CDSLinkF.h"
  9. #include "CDSIfscF.h"
  10. #include "CDSRoadF.h"
  11. #include "ITSLangTransF.h"
  12. #include "ITSMapF.h"
  13. #pragma hdrstop
  14. #include "IAN0040MF.h"
  15. //---------------------------------------------------------------------------
  16. #pragma package(smart_init)
  17. #pragma link "cxButtons"
  18. #pragma link "cxCalc"
  19. #pragma link "cxCalendar"
  20. #pragma link "cxClasses"
  21. #pragma link "cxContainer"
  22. #pragma link "cxControls"
  23. #pragma link "cxCustomData"
  24. #pragma link "cxData"
  25. #pragma link "cxDataStorage"
  26. #pragma link "cxDropDownEdit"
  27. #pragma link "cxEdit"
  28. #pragma link "cxFilter"
  29. #pragma link "cxGraphics"
  30. #pragma link "cxGrid"
  31. #pragma link "cxGridCustomTableView"
  32. #pragma link "cxGridCustomView"
  33. #pragma link "cxGridLevel"
  34. #pragma link "cxGridTableView"
  35. #pragma link "cxGroupBox"
  36. #pragma link "cxLabel"
  37. #pragma link "cxLookAndFeelPainters"
  38. #pragma link "cxLookAndFeels"
  39. #pragma link "cxMaskEdit"
  40. #pragma link "cxSpinEdit"
  41. #pragma link "cxSplitter"
  42. #pragma link "cxStyles"
  43. #pragma link "cxTextEdit"
  44. #pragma link "cxTimeEdit"
  45. #pragma link "cxTrackBar"
  46. #pragma link "dxSkinBlack"
  47. #pragma link "dxSkinBlue"
  48. #pragma link "dxSkinsCore"
  49. #pragma link "dxSkinscxPCPainter"
  50. #pragma link "FRAME_OpenMapF"
  51. #pragma resource "*.dfm"
  52. TIAN0040M *IAN0040M = NULL;
  53. //---------------------------------------------------------------------------
  54. void TIAN0040M_MapCallback(TObject *ASender, const String AFunc, const String AArgs, const bool AFirst)
  55. {
  56. try
  57. {
  58. if (!IAN0040M) return;
  59. IAN0040M->OpenMapCallback(ASender, AFunc, AArgs, AFirst);
  60. }
  61. catch(Exception &exception)
  62. {
  63. }
  64. }
  65. //---------------------------------------------------------------------------
  66. __fastcall TIAN0040M::TIAN0040M(TComponent* Owner)
  67. : TForm(Owner)
  68. {
  69. LangTrans->Translate(this, ITSDb_GetConnection());
  70. ITSSkin_Load(this);
  71. CMM_LoadForm(g_sFormsDir, this);
  72. FTitle = Caption;//"소통정보 이력분석";
  73. FLinkMngr = new TTrafficValManager();
  74. FIfscMngr = new TTrafficValManager();
  75. FRoadMngr = new TTrafficValManager();
  76. CbLinkLevel->ItemIndex = 1; //IFSC
  77. FLinkLevel = CbLinkLevel->ItemIndex+1;
  78. FLayerIdx = LyrTp_Node;
  79. FRAMEOpenMap1->LayerIdx = FLayerIdx;
  80. FRAMEOpenMap1->ChkShowNmbr->Visible = false;
  81. FRAMEOpenMap1->BtnMoveMapToFit->Visible = false;
  82. FRAMEOpenMap1->MapCallbackFunc = TIAN0040M_MapCallback;
  83. }
  84. //---------------------------------------------------------------------------
  85. void __fastcall TIAN0040M::CommClose()
  86. {
  87. try
  88. {
  89. if (BtnStop->Enabled)
  90. BtnStopClick((TObject*)BtnStop);
  91. delete FLinkMngr;
  92. delete FIfscMngr;
  93. delete FRoadMngr;
  94. CMM_SaveForm(g_sFormsDir, this);
  95. }
  96. catch(...)
  97. {
  98. }
  99. }
  100. //---------------------------------------------------------------------------
  101. void __fastcall TIAN0040M::FormShow(TObject *Sender)
  102. {
  103. Refresh();
  104. FRAMEOpenMap1->OpenMap();
  105. FormInit();
  106. TmrShow->Enabled = true;
  107. }
  108. //---------------------------------------------------------------------------
  109. void __fastcall TIAN0040M::FormInit()
  110. {
  111. ADOQry->Connection = ITSDb_GetConnection();
  112. ADOSta->Connection = ITSDb_GetConnection();
  113. m_pGDC = TvList->DataController;
  114. TDateTime dtNow = Now() - ((double)3 / (double)24);
  115. DtStDate->Date = dtNow;
  116. DtEdDate->Date = Now();
  117. //DtStTime->EditValue = dtNow.FormatString("hh") + ":00";
  118. dtNow = Now() - ((double)2 / (double)24);
  119. //DtEdTime->EditValue = dtNow.FormatString("hh") + ":59";
  120. DtStTime->Time = StrToDateTime(dtNow.FormatString("hh") + ":00");
  121. DtEdTime->Time = StrToDateTime(dtNow.FormatString("hh") + ":59");
  122. }
  123. //---------------------------------------------------------------------------
  124. void __fastcall TIAN0040M::TmrShowTimer(TObject *Sender)
  125. {
  126. TmrShow->Enabled = false;
  127. if (TmrShow->Tag == 1)
  128. {
  129. int nIndex = m_pGDC->FocusedRecordIndex;
  130. if (nIndex < 0)
  131. {
  132. cxTrackBar1->Position = 0;
  133. FStatTime = "";
  134. BtnPlay->Enabled = true;
  135. BtnStop->Enabled = false;
  136. BtnSearch->Enabled = true;
  137. return;
  138. }
  139. if (m_pGDC->FocusedRecordIndex + 1 == m_pGDC->RecordCount)
  140. {
  141. cxTrackBar1->Position = 0;
  142. FStatTime = "";
  143. BtnPlay->Enabled = true;
  144. BtnStop->Enabled = false;
  145. BtnSearch->Enabled = true;
  146. return;
  147. }
  148. m_pGDC->FocusedRecordIndex++;
  149. nIndex = m_pGDC->FocusedRecordIndex;
  150. FSimIndex = nIndex;
  151. cxTrackBar1->Position = nIndex;
  152. FStatTime = VarToStr(m_pGDC->Values[nIndex][Column04->Index]);
  153. //cxGroupBox1->Caption = "▶ 소통정보 표출 - " + VarToStr(m_pGDC->Values[nIndex][Column02->Index]);
  154. cxGroupBox1->Caption = lblText1->Caption + " - " + VarToStr(m_pGDC->Values[nIndex][Column02->Index]);
  155. SelStatisticsHistory(FStatTime);
  156. BtnPlay->Enabled = false;
  157. BtnStop->Enabled = true;
  158. TmrShow->Interval = SeRefreshSec->Value * 1000;
  159. TmrShow->Enabled = true;
  160. }
  161. }
  162. //---------------------------------------------------------------------------
  163. void __fastcall TIAN0040M::InitGisLink()
  164. {
  165. if (!FRAMEOpenMap1->MapStart) return;
  166. TItsNode* pNode;
  167. String STRT_NM;
  168. String END_NM;
  169. try
  170. {
  171. if (FLinkLevel == 1)
  172. {
  173. ItsLinkManager->FLists.Lock();
  174. try
  175. {
  176. FOR_STL(TItsLink*, pLink, ItsLinkManager->FLists)
  177. {
  178. if (pLink->DEL_YN == "Y") continue;
  179. if (pLink->IsVertex)
  180. {
  181. TTrafficVal* pTraf = new TTrafficVal();
  182. pTraf->ID = pLink->LINK_ID;
  183. pTraf->IsUpdate = true;
  184. pTraf->GRADE_VAL = 0;
  185. FLinkMngr->FLists.Push(pTraf->ID, pTraf);
  186. pNode = ItsNodeManager->FLists.Find(pLink->F_NODE_ID);
  187. if (pNode) STRT_NM = pNode->NODE_NAME; else STRT_NM = " ";
  188. pNode = ItsNodeManager->FLists.Find(pLink->T_NODE_ID);
  189. if (pNode) END_NM = pNode->NODE_NAME; else END_NM = " ";
  190. sJs.printf(L"addEditLink('%s', '%s', '%s', '%s', '%s', '%s')",
  191. pLink->LINK_ID.c_str(),
  192. pLink->ROAD_NAME.c_str(),
  193. STRT_NM.c_str(),
  194. END_NM.c_str(),
  195. pLink->X_CRDN_ARR.c_str(),
  196. pLink->Y_CRDN_ARR.c_str());
  197. FRAMEOpenMap1->ExecScript(sJs);
  198. }
  199. }
  200. }
  201. __finally
  202. {
  203. ItsLinkManager->FLists.UnLock();
  204. }
  205. FRAMEOpenMap1->ExecScript("makeEditLinkLayer()");
  206. }
  207. else
  208. if (FLinkLevel == 2)
  209. {
  210. ItsIfscManager->FLists.Lock();
  211. try
  212. {
  213. FOR_STL(TItsIfsc*, pIfsc, ItsIfscManager->FLists)
  214. {
  215. if (pIfsc->DEL_YN == "Y") continue;
  216. if (pIfsc->IsVertex)
  217. {
  218. TTrafficVal* pTraf = new TTrafficVal();
  219. pTraf->ID = pIfsc->IFSC_ID;
  220. pTraf->IsUpdate = true;
  221. pTraf->GRADE_VAL = 0;
  222. FIfscMngr->FLists.Push(pTraf->ID, pTraf);
  223. sJs.printf(L"addEditLink('%s', '%s', '%s', '%s', '%s', '%s')",
  224. pIfsc->IFSC_ID.c_str(),
  225. pIfsc->IFSC_NM.c_str(),
  226. pIfsc->STRT_NM.c_str(),
  227. pIfsc->END_NM.c_str(),
  228. pIfsc->X_CRDN_ARR.c_str(),
  229. pIfsc->Y_CRDN_ARR.c_str());
  230. FRAMEOpenMap1->ExecScript(sJs);
  231. }
  232. }
  233. }
  234. __finally
  235. {
  236. ItsIfscManager->FLists.UnLock();
  237. }
  238. FRAMEOpenMap1->ExecScript("makeEditLinkLayer()");
  239. }
  240. else
  241. if (FLinkLevel == 3)
  242. {
  243. ItsRoadManager->FLists.Lock();
  244. try
  245. {
  246. FOR_STL(TItsRoad*, pRoad, ItsRoadManager->FLists)
  247. {
  248. if (pRoad->DEL_YN == "Y") continue;
  249. if (pRoad->IsVertex)
  250. {
  251. TTrafficVal* pTraf = new TTrafficVal();
  252. pTraf->ID = pRoad->ROAD_ID;
  253. pTraf->IsUpdate = true;
  254. pTraf->GRADE_VAL = 0;
  255. FRoadMngr->FLists.Push(pTraf->ID, pTraf);
  256. sJs.printf(L"addEditLink('%s', '%s', '%s', '%s', '%s', '%s')",
  257. pRoad->ROAD_ID.c_str(),
  258. pRoad->ROAD_NM.c_str(),
  259. pRoad->STRT_NM.c_str(),
  260. pRoad->END_NM.c_str(),
  261. pRoad->X_CRDN_ARR.c_str(),
  262. pRoad->Y_CRDN_ARR.c_str());
  263. FRAMEOpenMap1->ExecScript(sJs);
  264. }
  265. }
  266. }
  267. __finally
  268. {
  269. ItsRoadManager->FLists.UnLock();
  270. }
  271. FRAMEOpenMap1->ExecScript("makeEditLinkLayer()");
  272. }
  273. }
  274. catch(...)
  275. {
  276. }
  277. }
  278. //---------------------------------------------------------------------------
  279. void __fastcall TIAN0040M::BtnSearchClick(TObject *Sender)
  280. {
  281. Application->ProcessMessages();
  282. TSqlCursor sqlCrs((TControl*)BtnSearch);
  283. // SelStatisticsHistory(""); return;
  284. #if 0
  285. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  286. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  287. #else
  288. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  289. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  290. #endif
  291. if (FStDateTime > FEdDateTime)
  292. {
  293. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  294. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  295. ActiveControl = DtStDate;
  296. return;
  297. }
  298. if ( StrToInt(DtEdTime->Time.FormatString("hh")) - StrToInt(DtStTime->Time.FormatString("hh")) >= 3)
  299. {
  300. Application->MessageBox(lblText2->Caption.c_str(),//L"3시간 이상의 정보를 조회할 수 없습니다.",
  301. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  302. ActiveControl = DtStDate;
  303. return;
  304. }
  305. #if 0
  306. FStDateTime = FStDateTime + "0000";
  307. FEdDateTime = FEdDateTime + "5959";
  308. #else
  309. FStDateTime = FStDateTime + "00";
  310. FEdDateTime = FEdDateTime + "59";
  311. #endif
  312. if (FLinkLevel != CbLinkLevel->ItemIndex+1)
  313. {
  314. //링크레벨을 고정하지 않고 변경할 경우 여기에서 링크 버텍스를 다시 로딩해 줘야 한다.
  315. }
  316. FLinkLevel = CbLinkLevel->ItemIndex+1;
  317. SelHistory();
  318. ClearGis();
  319. }
  320. //---------------------------------------------------------------------------
  321. void __fastcall TIAN0040M::BtnCloseClick(TObject *Sender)
  322. {
  323. Close();
  324. }
  325. //---------------------------------------------------------------------------
  326. void __fastcall TIAN0040M::FormClose(TObject *Sender, TCloseAction &Action)
  327. {
  328. CommClose();
  329. IAN0040M = NULL;
  330. Action = caFree;
  331. }
  332. //---------------------------------------------------------------------------
  333. void __fastcall TIAN0040M::DtStDatePropertiesValidate(TObject *Sender, Variant &DisplayValue, TCaption &ErrorText, bool &Error)
  334. {
  335. DtEdDate->Date = DtStDate->Date;
  336. }
  337. //---------------------------------------------------------------------------
  338. void __fastcall TIAN0040M::SelHistory()
  339. {
  340. TSqlCursor sqlCrs;
  341. String sQry;
  342. TADOQuery *pADO = ADOQry;
  343. int nLevel = StrToInt(FLinkLevel);
  344. switch(nLevel)
  345. {
  346. case 1:
  347. sQry = "SELECT PRCN_DT, COUNT(LINK_ID) CNT \r\n"
  348. " FROM TB_LINK_TRAF_HS A \r\n"
  349. " WHERE PRCN_DT BETWEEN :p01 AND :p02 \r\n"
  350. " GROUP BY PRCN_DT \r\n"
  351. " ORDER BY PRCN_DT \r\n";
  352. break;
  353. case 2:
  354. sQry = "SELECT STAT_DT AS PRCN_DT, COUNT(IFSC_ID) CNT \r\n"
  355. " FROM TB_IFSC_15M_STAT A \r\n"
  356. " WHERE STAT_DT BETWEEN :p01 AND :p02 \r\n"
  357. " GROUP BY STAT_DT \r\n"
  358. " ORDER BY STAT_DT \r\n";
  359. break;
  360. case 3:
  361. sQry = "SELECT PRCN_DT, COUNT(ROAD_ID) CNT \r\n"
  362. " FROM TB_ROAD_TRAF_HS A \r\n"
  363. " WHERE PRCN_DT BETWEEN :p01 AND :p02 \r\n"
  364. " GROUP BY PRCN_DT \r\n"
  365. " ORDER BY PRCN_DT \r\n";
  366. break;
  367. default: return;
  368. }
  369. try
  370. {
  371. ITSDb_SQLText(pADO, sQry);
  372. ITSDb_SQLBind(pADO, "p01", FStDateTime);
  373. ITSDb_SQLBind(pADO, "p02", FEdDateTime);
  374. ITSDb_SQLOpen(pADO);
  375. DspHistory();
  376. }
  377. catch(EDatabaseError &E)
  378. {
  379. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  380. DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry);
  381. throw Exception(String(E.ClassName()) + E.Message);
  382. }
  383. catch(Exception &exception)
  384. {
  385. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  386. DBERRORMSG(Caption, String(exception.ClassName()), exception.Message, sQry);
  387. throw Exception(String(exception.ClassName()) + exception.Message);
  388. }
  389. }
  390. //---------------------------------------------------------------------------
  391. void __fastcall TIAN0040M::DspHistory()
  392. {
  393. TADOQuery *pADO = ADOQry;
  394. try
  395. {
  396. CMM_ClearGridTableView(TvList);
  397. int nRow = 0;
  398. try
  399. {
  400. TvList->BeginUpdate();
  401. m_pGDC->RecordCount = pADO->RecordCount;
  402. for( ; !pADO->Eof; pADO->Next(), nRow++)
  403. {
  404. m_pGDC->Values[nRow][Column01->Index] = nRow+1;
  405. //m_pGDC->Values[nRow][Column02->Index] = pADO->FieldByName("PRCN_DT2")->AsDateTime.DateTimeString(); //가공시각
  406. m_pGDC->Values[nRow][Column02->Index] = ITSUtil_StrToTime(pADO->FieldByName("PRCN_DT")->AsString); //가공시각
  407. m_pGDC->Values[nRow][Column03->Index] = pADO->FieldByName("CNT")->AsInteger;
  408. m_pGDC->Values[nRow][Column04->Index] = pADO->FieldByName("PRCN_DT")->AsString;
  409. }
  410. }
  411. __finally
  412. {
  413. if (pADO)
  414. {
  415. pADO->Close();
  416. }
  417. TvList->EndUpdate();
  418. CxList->SetFocus();
  419. cxTrackBar1->Position = 0;
  420. cxTrackBar1->Properties->Max = nRow;
  421. cxTrackBar1->Properties->Frequency = cxTrackBar1->Properties->Max * 0.1;
  422. LblRecords->Caption = FormatFloat("##,##0", m_pGDC->RecordCount) + FrmLang->lblEA->Caption;//" 건";
  423. String sEnd = FrmLang->lblQrySel->Caption + " [" + LblRecords->Caption + "]";//"데이터 " + LblRecords->Caption + " 이 조회 되었습니다.";
  424. Application->MessageBox(sEnd.c_str(),
  425. FrmLang->lblQryEnd->Caption.c_str(),//L"데이터 조회 완료",
  426. MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  427. }
  428. }
  429. catch(EDatabaseError &E)
  430. {
  431. throw Exception(String(E.ClassName()) + E.Message);
  432. }
  433. catch(...)
  434. {
  435. throw Exception(FrmLang->lblDbErr->Caption);//"알수없는 오류가 발생하였습니다.");
  436. }
  437. }
  438. //---------------------------------------------------------------------------
  439. void __fastcall TIAN0040M::BtnPlayClick(TObject *Sender)
  440. {
  441. if (m_pGDC->RecordCount <= 0)
  442. {
  443. Application->MessageBox(lblText3->Caption.c_str(),//L"표출할 정보가 없습니다. 이력정보를 다시 조회하신 후 작업을 진행 하십시요.",
  444. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  445. return;
  446. }
  447. m_pGDC->FocusedRecordIndex = 0;
  448. int nIndex = m_pGDC->FocusedRecordIndex;
  449. if (nIndex < 0) return;
  450. FSimIndex = nIndex;
  451. cxTrackBar1->Position = nIndex;
  452. FStatTime = VarToStr(m_pGDC->Values[nIndex][Column04->Index]);
  453. CxList->SetFocus();
  454. BtnPlay->Enabled = false;
  455. BtnStop->Enabled = true;
  456. BtnSearch->Enabled = false;
  457. cxGroupBox1->Caption = lblText1->Caption + " - " + VarToStr(m_pGDC->Values[nIndex][Column02->Index]);
  458. SelStatisticsHistory(FStatTime);
  459. TmrShow->Tag = 1;
  460. TmrShow->Interval = SeRefreshSec->Value * 1000;
  461. TmrShow->Enabled = true;
  462. }
  463. //---------------------------------------------------------------------------
  464. void __fastcall TIAN0040M::BtnStopClick(TObject *Sender)
  465. {
  466. TmrShow->Enabled = false;
  467. BtnPlay->Enabled = true;
  468. BtnStop->Enabled = false;
  469. BtnSearch->Enabled = true;
  470. }
  471. //---------------------------------------------------------------------------
  472. void __fastcall TIAN0040M::SelStatisticsHistory(String AStatTime)
  473. {
  474. int ii;
  475. TSqlCursor sqlCrs;
  476. String sQry;
  477. TADOQuery *pADO = ADOSta;
  478. #if 1
  479. sQry = "SELECT A.IFSC_ID, NVL(B.CMTR_GRAD_CD, 'LTC0') TRFGRD, C.SPED, C.STAT_DT REGDATE \r\n"
  480. " FROM TB_IFSC A, \r\n"
  481. " TB_SECT_GRAD_STUP B, \r\n"
  482. " TB_IFSC_15M_STAT C \r\n"
  483. " WHERE A.IFSC_ID = C.IFSC_ID \r\n"
  484. " AND A.SECT_GRAD_CD = B.SECT_GRAD_CD \r\n"
  485. " AND (C.SPED >= B.LWST_TRVL_SPED AND C.SPED <= B.HGHS_TRVL_SPED) \r\n"
  486. " AND STAT_DT = :p01 \r\n";
  487. ITSDb_SQLText(pADO, sQry);
  488. ITSDb_SQLBind(pADO, "p01", AStatTime);
  489. #else
  490. sQry = "SELECT A.IFSC_ID, 'LTC' || mod(rownum, 4) as TRFGRD, 1 as SPED \r\n"
  491. " FROM TB_IFSC A \r\n";
  492. ITSDb_SQLText(pADO, sQry);
  493. #endif
  494. int nGradeCd;
  495. try
  496. {
  497. ITSDb_SQLOpen(pADO);
  498. for( ; !pADO->Eof; pADO->Next())
  499. {
  500. String sID = pADO->FieldByName("IFSC_ID")->AsString;
  501. TTrafficVal *pTraf = FIfscMngr->FLists.Find(sID);
  502. if (pTraf)
  503. {
  504. String TRFGRD = pADO->FieldByName("TRFGRD")->AsString;
  505. if (TRFGRD == "LTC1") nGradeCd = 1;
  506. else if (TRFGRD == "LTC2") nGradeCd = 2;
  507. else if (TRFGRD == "LTC3") nGradeCd = 3;
  508. else nGradeCd = 0;
  509. if (pTraf->GRADE_VAL != nGradeCd)
  510. {
  511. pTraf->GRADE_VAL = nGradeCd;
  512. sJs.printf(L"updateHistLink('%s', %d)", sID.c_str(), nGradeCd);
  513. FRAMEOpenMap1->ExecScript(sJs);
  514. }
  515. }
  516. }
  517. }
  518. catch(EDatabaseError &E)
  519. {
  520. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  521. DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry);
  522. throw Exception(String(E.ClassName()) + E.Message);
  523. }
  524. catch(Exception &exception)
  525. {
  526. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  527. DBERRORMSG(Caption, String(exception.ClassName()), exception.Message, sQry);
  528. throw Exception(String(exception.ClassName()) + exception.Message);
  529. }
  530. }
  531. //---------------------------------------------------------------------------
  532. void __fastcall TIAN0040M::ClearGis()
  533. {
  534. cxGroupBox1->Caption = lblText1->Caption;//"▶ 소통정보 표출";
  535. }
  536. //---------------------------------------------------------------------------
  537. void __fastcall TIAN0040M::TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  538. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  539. {
  540. if (BtnPlay->Enabled == false) return;
  541. int nRow = m_pGDC->FocusedRecordIndex;
  542. if( nRow <= -1 )
  543. return;
  544. FStatTime = VarToStr(m_pGDC->Values[nRow][Column04->Index]);
  545. cxGroupBox1->Caption = lblText1->Caption + " - " + VarToStr(m_pGDC->Values[nRow][Column02->Index]);
  546. SelStatisticsHistory(FStatTime);
  547. }
  548. //---------------------------------------------------------------------------
  549. void __fastcall TIAN0040M::BtnSearch2Click(TObject *Sender)
  550. {
  551. Application->ProcessMessages();
  552. if (!FRAMEOpenMap1->MapStart) return;
  553. String sLinkId = EdLinkId->Text.Trim();
  554. sJs.printf(L"extentLayerObject(%d, '%s')", LyrTp_Traffic, sLinkId.c_str());
  555. FRAMEOpenMap1->ExecScript(sJs);
  556. }
  557. //---------------------------------------------------------------------------
  558. void __fastcall TIAN0040M::OpenMapCallback(TObject *ASender, const String AFunc, const String AArgs, const bool AFirst)
  559. {
  560. try
  561. {
  562. if (AFirst)
  563. {
  564. //지도를 편집모드로 변경
  565. sJs.printf(L"setEditMode(%d, 1)", FLayerIdx);
  566. FRAMEOpenMap1->ExecScript(sJs);
  567. //편집레이어 생성
  568. FRAMEOpenMap1->ExecScript("initEditLayer()");
  569. FRAMEOpenMap1->ExecScript("setEditArrow(0)");
  570. FRAMEOpenMap1->ExecScript("setEditColor()");
  571. //배경링크레이어 생성
  572. InitGisLink();
  573. return;
  574. }
  575. }
  576. catch(Exception &exception)
  577. {
  578. }
  579. }
  580. //---------------------------------------------------------------------------
  581. void __fastcall TIAN0040M::FormCloseQuery(TObject *Sender, bool &CanClose)
  582. {
  583. FRAMEOpenMap1->OnCloseQuery(CanClose);
  584. }
  585. //---------------------------------------------------------------------------