TAS0010MF.cpp 23 KB

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