EVSPH10MF.cpp 22 KB

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