ITSSELAMF.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "CDSNodeF.h"
  7. #include "CDSLinkF.h"
  8. #include "CDSIfscF.h"
  9. #include "CDSRoadF.h"
  10. #include "ITSLangTransF.h"
  11. #pragma hdrstop
  12. #include "ITSSELAMF.h"
  13. #include "CommFlashF.h"
  14. //---------------------------------------------------------------------------
  15. #pragma package(smart_init)
  16. #pragma link "cxButtons"
  17. #pragma link "cxCalc"
  18. #pragma link "cxClasses"
  19. #pragma link "cxContainer"
  20. #pragma link "cxControls"
  21. #pragma link "cxCustomData"
  22. #pragma link "cxData"
  23. #pragma link "cxDataStorage"
  24. #pragma link "cxEdit"
  25. #pragma link "cxFilter"
  26. #pragma link "cxGraphics"
  27. #pragma link "cxGrid"
  28. #pragma link "cxGridCustomTableView"
  29. #pragma link "cxGridCustomView"
  30. #pragma link "cxGridLevel"
  31. #pragma link "cxGridTableView"
  32. #pragma link "cxGroupBox"
  33. #pragma link "cxLabel"
  34. #pragma link "cxLookAndFeelPainters"
  35. #pragma link "cxLookAndFeels"
  36. #pragma link "cxPC"
  37. #pragma link "cxPCdxBarPopupMenu"
  38. #pragma link "cxSplitter"
  39. #pragma link "cxStyles"
  40. #pragma link "cxTextEdit"
  41. #pragma link "dxSkinBlack"
  42. #pragma link "dxSkinBlue"
  43. #pragma link "dxSkinsCore"
  44. #pragma link "dxSkinscxPCPainter"
  45. #pragma link "FRAME_GoogleMapF"
  46. #pragma link "FRAME_LinkListF"
  47. #pragma link "FRAME_NodeListF"
  48. #pragma link "FRAME_RoadListF"
  49. #pragma link "FRAME_ServiceLinkListF"
  50. #pragma link "GMClasses"
  51. #pragma link "GMLinkedComponents"
  52. #pragma link "GMMap"
  53. #pragma link "GMPolyline"
  54. #pragma link "GMPolylineVCL"
  55. #pragma link "GMMarker"
  56. #pragma link "GMMarkerVCL"
  57. #pragma resource "*.dfm"
  58. TITSSELAM *ITSSELAM = NULL;
  59. //---------------------------------------------------------------------------
  60. __fastcall TITSSELAM::TITSSELAM(TComponent* Owner, int ALinkLevel/*=1*/)
  61. : TForm(Owner)
  62. {
  63. LangTrans->Translate(this, ITSDb_GetConnection());
  64. ITSSkin_Load(this);
  65. CMM_LoadForm(g_sFormsDir, this);
  66. LoadLocalSkin();
  67. FTitle = Caption;//"구간 선택";
  68. MapStart = false;
  69. FRefreshId = "";
  70. FSelPosX = "0";
  71. FSelPosY = "0";
  72. FSelected = false;
  73. FMultiSelect = false;
  74. FLinkId = "";
  75. FPosX = FPosY = 0;
  76. FMouseDownPosX = FMouseDownPosY = 0;
  77. FSelManager = new TSelManager();
  78. FSelLink = NULL;
  79. PgList->Properties->ActivePage = TabNode;
  80. TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<선택구간목록>";
  81. FRAMENodeList1->PnlTop->Visible = false;
  82. FRAMENodeList1->PnlBottom->Visible = false;
  83. FRAMELinkList1->PnlTop->Visible = false;
  84. FRAMELinkList1->PnlBottom->Visible = false;
  85. FRAMEServiceLinkList1->PnlTop->Visible = false;
  86. FRAMEServiceLinkList1->PnlBottom->Visible = false;
  87. FRAMERoadList1->PnlTop->Visible = false;
  88. FRAMERoadList1->PnlBottom->Visible = false;
  89. FLinkLevel = ALinkLevel;
  90. FRAMEGoogleMap1->BtnIconSelect->Visible = true;
  91. FRAMEGoogleMap1->BtnIconSelect->Enabled = true;
  92. FRAMEGoogleMap1->FOnZoomChanged = FRAMEGoogleMapOnZoomChange;
  93. OpenMap();
  94. }
  95. //---------------------------------------------------------------------------
  96. /*
  97. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  98. * Form과 DataModule class를 delete시킨다.
  99. * arguments
  100. *
  101. * return
  102. * void
  103. */
  104. void __fastcall TITSSELAM::CommClose()
  105. {
  106. try
  107. {
  108. CMM_SaveForm(g_sFormsDir, this);
  109. CloseMap();
  110. if (FSelManager)
  111. {
  112. delete FSelManager;
  113. FSelManager = NULL;
  114. }
  115. }
  116. catch(...)
  117. {
  118. }
  119. }
  120. //---------------------------------------------------------------------------
  121. void __fastcall TITSSELAM::LoadLocalSkin()
  122. {
  123. }
  124. //---------------------------------------------------------------------------
  125. /*
  126. * Form을 보여줄때 호출되는 event 메서드이다.
  127. * arguments
  128. * Sender : event handler 객체
  129. * return
  130. * void
  131. */
  132. void __fastcall TITSSELAM::FormShow(TObject *Sender)
  133. {
  134. Refresh();
  135. FormInit();
  136. TmrShow->Enabled = true;
  137. }
  138. //---------------------------------------------------------------------------
  139. void __fastcall TITSSELAM::SetLinkLevel(int ALinkLevel)
  140. {
  141. TabLink->Visible = false;
  142. TabLink->TabVisible = false;
  143. TabServiceLink->Visible = false;
  144. TabServiceLink->TabVisible = false;
  145. TabRoad->Visible = false;
  146. TabRoad->TabVisible = false;
  147. switch(ALinkLevel)
  148. {
  149. case 1:
  150. FRAMELinkList1->UpdateList();
  151. TabLink->Visible = true;
  152. TabLink->TabVisible = true;
  153. TabServiceLink->Visible = false;
  154. TabServiceLink->TabVisible = false;
  155. TabRoad->Visible = false;
  156. TabRoad->TabVisible = false;
  157. break;
  158. case 2:
  159. FRAMEServiceLinkList1->UpdateList();
  160. TabLink->Visible = false;
  161. TabLink->TabVisible = false;
  162. TabServiceLink->Visible = true;
  163. TabServiceLink->TabVisible = true;
  164. TabRoad->Visible = false;
  165. TabRoad->TabVisible = false;
  166. break;
  167. case 3:
  168. FRAMERoadList1->UpdateList();
  169. TabLink->Visible = false;
  170. TabLink->TabVisible = false;
  171. TabServiceLink->Visible = false;
  172. TabServiceLink->TabVisible = false;
  173. TabRoad->Visible = true;
  174. TabRoad->TabVisible = true;
  175. break;
  176. default: return;
  177. }
  178. FLinkLevel = ALinkLevel;
  179. }
  180. //---------------------------------------------------------------------------
  181. void __fastcall TITSSELAM::FormInit()
  182. {
  183. FRAMENodeList1->UpdateList();
  184. }
  185. //---------------------------------------------------------------------------
  186. void __fastcall TITSSELAM::TmrShowTimer(TObject *Sender)
  187. {
  188. TmrShow->Enabled = false;
  189. BtnSearchClick((TObject*)BtnSearch);
  190. Application->ProcessMessages();
  191. cxGroupBox1->Caption = cxGroupBox1->Caption + " - Level: " + String(LinkLevel);
  192. DrawLink();
  193. MapStart = true;
  194. RefreshId();
  195. }
  196. //---------------------------------------------------------------------------
  197. void __fastcall TITSSELAM::DrawLink()
  198. {
  199. TGMPolyline *pLink = GMPolyLink;
  200. TPolyline *pLn = NULL;
  201. if (FLinkLevel == 1)
  202. {
  203. pLink = GMPolyLink;
  204. try
  205. {
  206. ItsLinkManager->FLists.Lock();
  207. FOR_STL(TItsLink*, pObj, ItsLinkManager->FLists)
  208. {
  209. if (pObj->Coords.Size() < 2) continue;
  210. pLn = pLink->Add();
  211. if (!pLn) continue;
  212. pLn->Tag = (int)pObj;
  213. pLn->FObject = (TObject*)&pObj->bounds;
  214. pLn->Text = pObj->LINK_ID;
  215. FOR_STL(TItsCoord*, pCoord, pObj->Coords)
  216. {
  217. pLn->AddLinePoint(pCoord->Y, pCoord->X);
  218. }
  219. pLn->StrokeColor = clBlue;
  220. pLn->StrokeWeight = 4;
  221. pLn->StrokeOpacity = 1;
  222. pLn->AutoUpdatePath = true;
  223. pLn->Visible = true;
  224. pLn->Clickable = true;
  225. FSelManager->FLists.Push(pLn->Text, pLn);
  226. }
  227. }
  228. __finally
  229. {
  230. ItsLinkManager->FLists.UnLock();
  231. pLink->Map = FRAMEGoogleMap1->GMMap1;
  232. }
  233. }
  234. else
  235. if (FLinkLevel == 2)
  236. {
  237. pLink = GMPolyLink;
  238. try
  239. {
  240. ItsIfscManager->FLists.Lock();
  241. FOR_STL(TItsIfsc*, pObj, ItsIfscManager->FLists)
  242. {
  243. if (pObj->Coords.Size() < 2) continue;
  244. pLn = pLink->Add();
  245. if (!pLn) continue;
  246. pLn->Tag = (int)pObj;
  247. pLn->FObject = (TObject*)&pObj->bounds;
  248. pLn->Text = pObj->IFSC_ID;
  249. FOR_STL(TItsCoord*, pCoord, pObj->Coords)
  250. {
  251. pLn->AddLinePoint(pCoord->Y, pCoord->X);
  252. }
  253. pLn->StrokeColor = clBlue;
  254. pLn->StrokeWeight = 4;
  255. pLn->StrokeOpacity = 1;
  256. pLn->AutoUpdatePath = true;
  257. pLn->Visible = true;
  258. pLn->Clickable = true;
  259. FSelManager->FLists.Push(pLn->Text, pLn);
  260. }
  261. }
  262. __finally
  263. {
  264. ItsIfscManager->FLists.UnLock();
  265. pLink->Map = FRAMEGoogleMap1->GMMap1;
  266. }
  267. }
  268. else
  269. if (FLinkLevel == 3)
  270. {
  271. pLink = GMPolyLink;
  272. try
  273. {
  274. ItsRoadManager->FLists.Lock();
  275. FOR_STL(TItsRoad*, pObj, ItsRoadManager->FLists)
  276. {
  277. if (pObj->Coords.Size() < 2) continue;
  278. pLn = pLink->Add();
  279. if (!pLn) continue;
  280. pLn->Tag = (int)pObj;
  281. pLn->FObject = (TObject*)&pObj->bounds;
  282. pLn->Text = pObj->ROAD_ID;
  283. FOR_STL(TItsCoord*, pCoord, pObj->Coords)
  284. {
  285. pLn->AddLinePoint(pCoord->Y, pCoord->X);
  286. }
  287. pLn->StrokeColor = clBlue;
  288. pLn->StrokeWeight = 4;
  289. pLn->StrokeOpacity = 1;
  290. pLn->AutoUpdatePath = true;
  291. pLn->Visible = true;
  292. pLn->Clickable = true;
  293. FSelManager->FLists.Push(pLn->Text, pLn);
  294. }
  295. }
  296. __finally
  297. {
  298. ItsRoadManager->FLists.UnLock();
  299. pLink->Map = FRAMEGoogleMap1->GMMap1;
  300. }
  301. }
  302. GMMarkerPos->Map = FRAMEGoogleMap1->GMMap1;
  303. }
  304. //---------------------------------------------------------------------------
  305. void __fastcall TITSSELAM::RefreshId()
  306. {
  307. if (FRefreshId.IsEmpty()) return;
  308. Application->ProcessMessages();
  309. SelGisItem(FLinkLevel, FRefreshId);
  310. Application->ProcessMessages();
  311. }
  312. //---------------------------------------------------------------------------
  313. /*
  314. * Search 버튼 클릭 이벤트 핸들러
  315. * arguments
  316. * Sender : event handler 객체
  317. * return
  318. * void
  319. */
  320. void __fastcall TITSSELAM::BtnSearchClick(TObject *Sender)
  321. {
  322. Application->ProcessMessages();
  323. TSqlCursor sqlCrs((TControl*)BtnSearch);
  324. RefreshData();
  325. }
  326. //---------------------------------------------------------------------------
  327. /*
  328. * Refresh Data Event Function
  329. * arguments
  330. *
  331. * return
  332. * void
  333. */
  334. void __fastcall TITSSELAM::RefreshData()
  335. {
  336. }
  337. //---------------------------------------------------------------------------
  338. void __fastcall TITSSELAM::SelListData()
  339. {
  340. }
  341. //---------------------------------------------------------------------------
  342. /*
  343. * Close 버튼 클릭 이벤트 핸들러
  344. * arguments
  345. * Sender : event handler 객체
  346. * return
  347. * void
  348. */
  349. void __fastcall TITSSELAM::BtnCloseClick(TObject *Sender)
  350. {
  351. Close();
  352. }
  353. //---------------------------------------------------------------------------
  354. void __fastcall TITSSELAM::FormClose(TObject *Sender, TCloseAction &Action)
  355. {
  356. CommClose();
  357. ITSSELAM = NULL;
  358. //Action = caFree;
  359. }
  360. //---------------------------------------------------------------------------
  361. void __fastcall TITSSELAM::FRAMENodeList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  362. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  363. {
  364. if (!MapStart) return;
  365. int nIndex = Sender->DataController->FocusedRecordIndex;
  366. if (nIndex < 0) return;
  367. String sX = Sender->DataController->Values[nIndex][FRAMENodeList1->Column06->Index];
  368. String sY = Sender->DataController->Values[nIndex][FRAMENodeList1->Column07->Index];
  369. TMarker *pMarker = GMMarkerPos->Items[0];
  370. if (pMarker == NULL)
  371. pMarker = GMMarkerPos->Items[0];
  372. if (!pMarker) return;
  373. TmrPosClear->Enabled = false;
  374. pMarker->Visible = false;
  375. pMarker->Position->Lat = sY.ToDouble(); // dLat;
  376. pMarker->Position->Lng = sX.ToDouble(); // dLng;
  377. pMarker->CenterMapTo();
  378. pMarker->CenterMapToMarker();
  379. pMarker->Animation->OnDrop = false;
  380. pMarker->Animation->OnDrop = true;
  381. pMarker->Visible = true;
  382. TmrPosClear->Enabled = true;
  383. }
  384. //---------------------------------------------------------------------------
  385. void __fastcall TITSSELAM::FRAMELinkList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  386. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  387. {
  388. int nIndex = Sender->DataController->FocusedRecordIndex;
  389. if (nIndex < 0) return;
  390. SelGisItem(1, Sender->DataController->Values[nIndex][FRAMELinkList1->Column01->Index]);
  391. }
  392. //---------------------------------------------------------------------------
  393. void __fastcall TITSSELAM::FRAMEServiceLinkList1TvListCellClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  394. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  395. {
  396. int nIndex = Sender->DataController->FocusedRecordIndex;
  397. if (nIndex < 0) return;
  398. SelGisItem(2, Sender->DataController->Values[nIndex][FRAMEServiceLinkList1->Column01->Index]);
  399. }
  400. //---------------------------------------------------------------------------
  401. void __fastcall TITSSELAM::FRAMERoadList1TvListCellClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  402. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  403. {
  404. int nIndex = Sender->DataController->FocusedRecordIndex;
  405. if (nIndex < 0) return;
  406. SelGisItem(3, Sender->DataController->Values[nIndex][FRAMERoadList1->Column01->Index]);
  407. }
  408. //---------------------------------------------------------------------------
  409. void __fastcall TITSSELAM::BtnSelectClick(TObject *Sender)
  410. {
  411. if (TvList->DataController->RecordCount <= 0)
  412. {
  413. Application->MessageBox(lblText1->Caption.c_str(),//L"구간이 선택되지 않았습니다.\r\n지도에서 구간을 선택하세요.",
  414. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  415. return;
  416. }
  417. FLinkId = EdLinkId->Text.Trim();
  418. FSelected = true;
  419. Close();
  420. Application->ProcessMessages();
  421. }
  422. //---------------------------------------------------------------------------
  423. void __fastcall TITSSELAM::SelGisItem(int AType, String AId)
  424. {
  425. if (!MapStart) return;
  426. if (AType == 0) return; //노드
  427. TmrClearTimer(NULL);
  428. TPolyline* pLn = FSelManager->FLists.Find(AId);
  429. if (pLn)
  430. {
  431. FSelLink = pLn;
  432. FSelColor= pLn->StrokeColor;
  433. pLn->StrokeColor = clGreen;
  434. pLn->ZoomToPoints();
  435. TmrClear->Enabled = true;
  436. }
  437. }
  438. //---------------------------------------------------------------------------
  439. void __fastcall TITSSELAM::TmrClearTimer(TObject *Sender)
  440. {
  441. TmrClear->Enabled = false;
  442. if (FSelLink)
  443. {
  444. FSelLink->StrokeColor = FSelColor;
  445. }
  446. FSelLink = NULL;
  447. }
  448. //---------------------------------------------------------------------------
  449. void __fastcall TITSSELAM::BtnDeleteClick(TObject *Sender)
  450. {
  451. try
  452. {
  453. TcxDataController *pGDC = TvList->DataController;
  454. TvList->BeginUpdate();
  455. try
  456. {
  457. for (int ii = 0; ii < pGDC->RecordCount; ii++)
  458. {
  459. String sLinkId = pGDC->Values[ii][Column01->Index];
  460. DeleteSelect(sLinkId);
  461. }
  462. TvList->Controller->DeleteSelection();
  463. }
  464. catch(...)
  465. {
  466. }
  467. }
  468. __finally
  469. {
  470. TvList->EndUpdate();
  471. }
  472. RefreshSelect();
  473. }
  474. //---------------------------------------------------------------------------
  475. bool __fastcall TITSSELAM::GetLinkId(int X, int Y, String &ALinkId)
  476. {
  477. return true;
  478. }
  479. //---------------------------------------------------------------------------
  480. void __fastcall TITSSELAM::UpdateSelect(String ALinkId, double X, double Y)
  481. {
  482. try
  483. {
  484. int nRow;
  485. TcxDataController *pGDC = TvList->DataController;
  486. TvList->BeginUpdate();
  487. try
  488. {
  489. bool bAdd = true;
  490. if (!FMultiSelect)
  491. {
  492. for (int ii = 0; ii < pGDC->RecordCount; ii++)
  493. {
  494. String sLinkId = pGDC->Values[ii][Column01->Index];
  495. DeleteSelect(sLinkId);
  496. }
  497. CMM_ClearGridTableView(TvList);
  498. }
  499. else
  500. {
  501. for (int ii = 0; ii < pGDC->RecordCount; ii++)
  502. {
  503. String sTmpLinkId = pGDC->Values[ii][Column01->Index];
  504. if (sTmpLinkId == ALinkId)
  505. {
  506. pGDC->Values[ii][Column02->Index] = X;
  507. pGDC->Values[ii][Column03->Index] = Y;
  508. bAdd = false;
  509. break;
  510. }
  511. }
  512. }
  513. if (bAdd)
  514. {
  515. nRow = pGDC->AppendRecord();
  516. pGDC->Values[nRow][Column01->Index] = ALinkId;
  517. pGDC->Values[nRow][Column02->Index] = X;
  518. pGDC->Values[nRow][Column03->Index] = Y;
  519. }
  520. }
  521. catch(...)
  522. {
  523. }
  524. }
  525. __finally
  526. {
  527. TvList->EndUpdate();
  528. }
  529. RefreshSelect();
  530. }
  531. //---------------------------------------------------------------------------
  532. void __fastcall TITSSELAM::DeleteSelect(String ALinkId)
  533. {
  534. TPolyline* pLn = FSelManager->FLists.Find(ALinkId);
  535. if (pLn)
  536. {
  537. pLn->StrokeColor = clBlue;
  538. }
  539. }
  540. //---------------------------------------------------------------------------
  541. void __fastcall TITSSELAM::FRAMEGoogleMapOnZoomChange(TObject *Sender)
  542. {
  543. int nStrokeWeight = 4;
  544. if (FRAMEGoogleMap1->FMapZoom >= 14)
  545. {
  546. nStrokeWeight = 8;
  547. }
  548. FOR_STL(TPolyline*, pLn, FSelManager->FLists)
  549. {
  550. pLn->StrokeWeight = nStrokeWeight;
  551. }
  552. }
  553. //---------------------------------------------------------------------------
  554. void __fastcall TITSSELAM::RefreshSelect()
  555. {
  556. if (!MapStart) return;
  557. try
  558. {
  559. int nRow;
  560. TcxDataController *pGDC = TvList->DataController;
  561. TvList->BeginUpdate();
  562. try
  563. {
  564. for (int ii = 0; ii < pGDC->RecordCount; ii++)
  565. {
  566. String sLinkId = pGDC->Values[ii][Column01->Index];
  567. TPolyline* pLn = FSelManager->FLists.Find(sLinkId);
  568. if (pLn)
  569. {
  570. pLn->StrokeColor = clRed;
  571. }
  572. }
  573. }
  574. catch(...)
  575. {
  576. }
  577. }
  578. __finally
  579. {
  580. TvList->EndUpdate();
  581. }
  582. }
  583. //---------------------------------------------------------------------------
  584. void __fastcall TITSSELAM::OpenMap()
  585. {
  586. TMarker *pMarker = GMMarkerPos->Items[0];
  587. if (pMarker == NULL)
  588. pMarker = GMMarkerPos->Items[0];
  589. if (pMarker)
  590. {
  591. pMarker->Icon = g_sImageDir + "pos.png";
  592. }
  593. FRAMEGoogleMap1->LinkLevel = LinkLevel;
  594. FRAMEGoogleMap1->LoadGisMap();
  595. }
  596. //---------------------------------------------------------------------------
  597. void __fastcall TITSSELAM::CloseMap()
  598. {
  599. FRAMEGoogleMap1->GMMap1->Active = false;
  600. }
  601. //---------------------------------------------------------------------------
  602. void __fastcall TITSSELAM::TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  603. TMouseButton AButton, TShiftState AShift,
  604. bool &AHandled)
  605. {
  606. if (!MapStart) return;
  607. int nIndex = Sender->DataController->FocusedRecordIndex;
  608. if (nIndex < 0) return;
  609. String sX = Sender->DataController->Values[nIndex][Column02->Index];
  610. String sY = Sender->DataController->Values[nIndex][Column03->Index];
  611. TMarker *pMarker = GMMarkerPos->Items[0];
  612. if (pMarker == NULL)
  613. pMarker = GMMarkerPos->Items[0];
  614. if (!pMarker) return;
  615. TmrPosClear->Enabled = false;
  616. pMarker->Visible = false;
  617. pMarker->Position->Lat = sY.ToDouble(); // dLat;
  618. pMarker->Position->Lng = sX.ToDouble(); // dLng;
  619. pMarker->CenterMapTo();
  620. pMarker->CenterMapToMarker();
  621. pMarker->Animation->OnDrop = false;
  622. pMarker->Animation->OnDrop = true;
  623. pMarker->Visible = true;
  624. TmrPosClear->Enabled = true;
  625. }
  626. //---------------------------------------------------------------------------
  627. void __fastcall TITSSELAM::GMPolyLinkClick(TObject *Sender, TLatLng *LatLng, int Index,
  628. TLinkedComponent *LinkedComponent)
  629. {
  630. TGMPolyline* pGrpLink = (TGMPolyline*)Sender;
  631. TPolyline* pLink = pGrpLink->Items[Index];
  632. if (FRAMEGoogleMap1->BtnIconSelect->SpeedButtonOptions->Down)
  633. {
  634. UpdateSelect(pLink->Text, LatLng->Lng, LatLng->Lat);
  635. }
  636. }
  637. //---------------------------------------------------------------------------
  638. void __fastcall TITSSELAM::FRAMEGoogleMap1GMMap1Click(TObject *Sender, TLatLng *LatLng,
  639. double X, double Y)
  640. {
  641. StatusBar->Panels->Items[1]->Text = "Click: " + LatLng->LngToStr(FRAMEGoogleMap1->GMMap1->Precision) + "," + LatLng->LatToStr(FRAMEGoogleMap1->GMMap1->Precision);
  642. }
  643. //---------------------------------------------------------------------------
  644. void __fastcall TITSSELAM::TmrPosClearTimer(TObject *Sender)
  645. {
  646. TmrPosClear->Enabled = false;
  647. TMarker *pMarker = GMMarkerPos->Items[0];
  648. if (pMarker == NULL)
  649. pMarker = GMMarkerPos->Items[0];
  650. if (pMarker)
  651. {
  652. pMarker->Visible = false;
  653. }
  654. }
  655. //---------------------------------------------------------------------------