DSRM040MF.cpp 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890
  1. /****************************************************************************
  2. * @source :
  3. * @description :
  4. ****************************************************************************
  5. * DATE AUTHOR DESCRIPTION
  6. * --------------------------------------------------------------------------
  7. * 2011/12/24 정승호 최초작성
  8. *
  9. ****************************************************************************/
  10. //---------------------------------------------------------------------------
  11. #include <vcl.h>
  12. #include "ITSSkinF.h"
  13. #include "ITSUtilF.h"
  14. #include "AppGlobalF.h"
  15. #include "CDSCodeF.h"
  16. #include "CDSFacilityF.h"
  17. #include "CDSNodeF.h"
  18. #include "CDSServiceLinkF.h"
  19. #include "XiMapUtilF.h"
  20. #pragma hdrstop
  21. #include "DSRM040MF.h"
  22. //---------------------------------------------------------------------------
  23. #pragma package(smart_init)
  24. #pragma link "cxButtons"
  25. #pragma link "cxCalendar"
  26. #pragma link "cxContainer"
  27. #pragma link "cxControls"
  28. #pragma link "cxDropDownEdit"
  29. #pragma link "cxEdit"
  30. #pragma link "cxGraphics"
  31. #pragma link "cxGroupBox"
  32. #pragma link "cxLabel"
  33. #pragma link "cxLookAndFeelPainters"
  34. #pragma link "cxLookAndFeels"
  35. #pragma link "cxMaskEdit"
  36. #pragma link "cxPC"
  37. #pragma link "cxPCdxBarPopupMenu"
  38. #pragma link "cxSpinEdit"
  39. #pragma link "cxSplitter"
  40. #pragma link "cxTextEdit"
  41. #pragma link "cxTimeEdit"
  42. #pragma link "dxSkinBlack"
  43. #pragma link "dxSkinBlue"
  44. #pragma link "dxSkinCaramel"
  45. #pragma link "dxSkinCoffee"
  46. #pragma link "dxSkinDarkRoom"
  47. #pragma link "dxSkinDarkSide"
  48. #pragma link "dxSkinFoggy"
  49. #pragma link "dxSkinGlassOceans"
  50. #pragma link "dxSkiniMaginary"
  51. #pragma link "dxSkinLilian"
  52. #pragma link "dxSkinLiquidSky"
  53. #pragma link "dxSkinLondonLiquidSky"
  54. #pragma link "dxSkinMcSkin"
  55. #pragma link "dxSkinMoneyTwins"
  56. #pragma link "dxSkinOffice2007Black"
  57. #pragma link "dxSkinOffice2007Blue"
  58. #pragma link "dxSkinOffice2007Green"
  59. #pragma link "dxSkinOffice2007Pink"
  60. #pragma link "dxSkinOffice2007Silver"
  61. #pragma link "dxSkinOffice2010Black"
  62. #pragma link "dxSkinOffice2010Blue"
  63. #pragma link "dxSkinOffice2010Silver"
  64. #pragma link "dxSkinsCore"
  65. #pragma link "dxSkinscxPCPainter"
  66. #pragma link "dxSkinSeven"
  67. #pragma link "dxSkinSharp"
  68. #pragma link "dxSkinSilver"
  69. #pragma link "dxSkinStardust"
  70. #pragma link "FRAME_DsrcListF"
  71. #pragma link "cxRadioGroup"
  72. #pragma link "cxClasses"
  73. #pragma link "cxCustomData"
  74. #pragma link "cxData"
  75. #pragma link "cxDataStorage"
  76. #pragma link "cxDBData"
  77. #pragma link "cxFilter"
  78. #pragma link "cxGrid"
  79. #pragma link "cxGridCustomTableView"
  80. #pragma link "cxGridCustomView"
  81. #pragma link "cxGridDBTableView"
  82. #pragma link "cxGridLevel"
  83. #pragma link "cxGridTableView"
  84. #pragma link "cxStyles"
  85. #pragma link "FRAME_GisMapF"
  86. #pragma link "cxCheckBox"
  87. #pragma link "cxCalc"
  88. #pragma resource "*.dfm"
  89. TDSRM040M *DSRM040M = NULL;
  90. //---------------------------------------------------------------------------
  91. __fastcall TDSRM040M::TDSRM040M(TComponent* Owner)
  92. : TForm(Owner)
  93. {
  94. ITSSkin_Load(this);
  95. CMM_LoadForm(g_sFormsDir, this);
  96. FUpdate= false;
  97. FTitle = "DSRC-RSE 정보제공구간 관리";
  98. TvList->OptionsView->NoDataToDisplayInfoText = "<DSRC-RSE 정보제공구간 정보가 없습니다>";
  99. TvLink->OptionsView->NoDataToDisplayInfoText = "<서비스링크 정보가 없습니다>";
  100. m_pGDC = TvList->DataController;
  101. FRAMEGisMap1->LbDef->Visible = false;
  102. FRAMEGisMap1->LbDef->Caption = "(선택메뉴를 클릭하여 위치를 선택합니다.)";
  103. FRAMEGisMap1->LbDef->Hint = FRAMEGisMap1->LbDef->Caption;
  104. FRAMEDsrcList1->PnlBottom->Visible = false;
  105. FRAMEDsrcList1->PnlTop->Visible = false;
  106. FRAMEDsrcList1->ColumnSel->Visible = false;
  107. //FRAMEDsrcList1->Column02->Visible = false;
  108. MyItsDsrcOfferSectManager = new TItsDsrcOfferSectManager();
  109. MyItsDsrcOfferSectManager->LoadFromDb();
  110. }
  111. //---------------------------------------------------------------------------
  112. /*
  113. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  114. * Form과 DataModule class를 delete시킨다.
  115. * arguments
  116. *
  117. * return
  118. * void
  119. */
  120. void __fastcall TDSRM040M::CommClose()
  121. {
  122. try
  123. {
  124. CMM_SaveForm(g_sFormsDir, this);
  125. }
  126. catch(...)
  127. {
  128. }
  129. }
  130. //---------------------------------------------------------------------------
  131. /*
  132. * Form을 보여줄때 호출되는 event 메서드이다.
  133. * arguments
  134. * Sender : event handler 객체
  135. * return
  136. * void
  137. */
  138. void __fastcall TDSRM040M::FormShow(TObject *Sender)
  139. {
  140. Refresh();
  141. FRAMEGisMap1->LinkLevel = 2;
  142. FormInit();
  143. ChangeEditMode(1);
  144. TmrShow->Enabled = true;
  145. }
  146. //---------------------------------------------------------------------------
  147. /*
  148. * form 초기화
  149. *
  150. * arguments
  151. *
  152. * return
  153. * void
  154. */
  155. void __fastcall TDSRM040M::FormInit()
  156. {
  157. EdRseSectId->Text = "";
  158. EdRseSectName->Text = "";
  159. SeCNGSSPD->Value = 20;
  160. SeDELYSPD->Value = 10;
  161. EdStartSpotId->Text = "";
  162. EdStartSpotNm->Text = "";
  163. EdEndSpotId->Text = "";
  164. EdEndSpotNm->Text = "";
  165. EdRseSectLength->Text = "";
  166. CMM_ClearGridTableView(TvLink);
  167. FRAMEGisMap1->xclntMap->ClearUserDrawPolyGon();
  168. FRAMEGisMap1->xclntMap->ClearPathInfo();
  169. FRAMEGisMap1->xclntMap->ReDraw();
  170. FNewDb = false;
  171. }
  172. //---------------------------------------------------------------------------
  173. /*
  174. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  175. * arguments
  176. * Sender : event handler 객체
  177. * return
  178. * void
  179. */
  180. void __fastcall TDSRM040M::TmrShowTimer(TObject *Sender)
  181. {
  182. TmrShow->Enabled = false;
  183. FRAMEGisMap1->LoadGisMap();
  184. //FRAMEGisMap1->ShowHideTrafficLayer(false);
  185. UpdateRseIcon();
  186. FRAMEDsrcList1->UpdateList();
  187. UpdateList();
  188. }
  189. //---------------------------------------------------------------------------
  190. void __fastcall TDSRM040M::UpdateList()
  191. {
  192. CMM_ClearGridTableView(TvList);
  193. int nRow;
  194. try
  195. {
  196. TvList->BeginUpdate();
  197. FOR_STL(TItsDsrcOfferSect*, pObj, MyItsDsrcOfferSectManager->FLists)
  198. {
  199. if (pObj->DEL_YN == "Y") continue;
  200. nRow = m_pGDC->AppendRecord();
  201. m_pGDC->Values[nRow][Column01->Index] = pObj->OFFR_SECT_ID;
  202. m_pGDC->Values[nRow][Column02->Index] = pObj->OFFR_DRCT_NM;
  203. m_pGDC->Values[nRow][Column03->Index] = pObj->ID;
  204. m_pGDC->Values[nRow][Column04->Index] = pObj->PRE_ID;
  205. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  206. }
  207. }
  208. __finally
  209. {
  210. TvList->EndUpdate();
  211. TvList->DataController->GotoFirst();
  212. TvList->DataController->FocusedRecordIndex = 0;
  213. //CxList->SetFocus();
  214. }
  215. }
  216. //---------------------------------------------------------------------------
  217. /*
  218. * Close 버튼 클릭 이벤트 핸들러
  219. * arguments
  220. * Sender : event handler 객체
  221. * return
  222. * void
  223. */
  224. void __fastcall TDSRM040M::BtnCloseClick(TObject *Sender)
  225. {
  226. Close();
  227. }
  228. //---------------------------------------------------------------------------
  229. void __fastcall TDSRM040M::FormClose(TObject *Sender, TCloseAction &Action)
  230. {
  231. CommClose();
  232. DSRM040M = NULL;
  233. Action = caFree;
  234. }
  235. //---------------------------------------------------------------------------
  236. void __fastcall TDSRM040M::FormCloseQuery(TObject *Sender, bool &CanClose)
  237. {
  238. #if 0
  239. if (FUpdate)
  240. {
  241. POST_MSG(Application->MainForm->Handle, WM_DATABASE_REFRESH, WP_MSG_14, 0);
  242. }
  243. #endif
  244. if (MyItsDsrcOfferSectManager)
  245. {
  246. delete MyItsDsrcOfferSectManager;
  247. MyItsDsrcOfferSectManager = NULL;
  248. }
  249. FRAMEDsrcList1->OnCloseQuery(CanClose);
  250. }
  251. //---------------------------------------------------------------------------
  252. void __fastcall TDSRM040M::DisplayInfo(TItsDsrcOfferSect* AObj)
  253. {
  254. FormInit();
  255. if (!AObj) return;
  256. EdRseSectId->Text = AObj->OFFR_SECT_ID;
  257. EdRseSectName->Text = AObj->OFFR_DRCT_NM;
  258. SeCNGSSPD->Value = StrToFloatDef(AObj->CNGS_BASI_SPED, 0);
  259. SeDELYSPD->Value = StrToFloatDef(AObj->DELY_BASI_SPED, 0);
  260. EdStartSpotId->Text = AObj->ID;
  261. EdStartSpotNm->Text = AObj->TARGETNM;
  262. EdEndSpotId->Text = AObj->PRE_ID;
  263. EdEndSpotNm->Text = AObj->PRENM;
  264. EdRseSectLength->Text = AObj->OBU_ENTR_DRCT_NMBR;
  265. DisplaySectLink(AObj);
  266. ChangeEditMode(3);
  267. }
  268. //---------------------------------------------------------------------------
  269. void __fastcall TDSRM040M::UpdateRseIcon()
  270. {
  271. FRAMEGisMap1->xclntMap->ClearCCTVEvent(true);
  272. try
  273. {
  274. //if (ChkViewIcon->Checked)
  275. {
  276. try
  277. {
  278. FRAMEDsrcList1->MyItsDsrcManager->FLists.Lock();
  279. FOR_STL(TItsDsrc*, pObj, FRAMEDsrcList1->MyItsDsrcManager->FLists)
  280. {
  281. if (pObj->DEL_YN == "Y") continue;
  282. try {
  283. String sTitle = "▶▶DSRC-RSE 정보◀◀|ID : " + pObj->ID + "|명칭 : " + pObj->ISTL_LCTN_NM;
  284. FRAMEGisMap1->xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->LCTN_X, 0), StrToFloatDef(pObj->LCTN_Y, 0)), pObj->ID, pObj->ISTL_LCTN_NM, sTitle, 6, 1, 7);
  285. } catch(...) { }
  286. }
  287. }
  288. __finally
  289. {
  290. FRAMEDsrcList1->MyItsDsrcManager->FLists.UnLock();
  291. }
  292. }
  293. }
  294. catch(...)
  295. {
  296. }
  297. FRAMEGisMap1->xclntMap->ReDraw();
  298. }
  299. //---------------------------------------------------------------------------
  300. void __fastcall TDSRM040M::BtnEditClick(TObject *Sender)
  301. {
  302. if (BtnEdit->Caption == "편집")
  303. {
  304. ChangeEditMode(0);
  305. FNewDb = false;
  306. }
  307. else
  308. {
  309. String sSectId = EdRseSectId->Text;
  310. ChangeEditMode(1);
  311. TItsDsrcOfferSect *pObj = MyItsDsrcOfferSectManager->FLists.Find(sSectId);
  312. if (pObj)
  313. {
  314. CMM_SetGridRow(CxList, TvList, sSectId, Column01->Index);
  315. DisplayInfo(pObj);
  316. }
  317. }
  318. }
  319. //---------------------------------------------------------------------------
  320. void __fastcall TDSRM040M::ChangeEditMode(int AEdit)
  321. {
  322. bool bEnabled = false;
  323. switch(AEdit)
  324. {
  325. case 0: //편집버튼클릭
  326. {
  327. BtnEdit->Enabled = true;
  328. BtnInsert->Enabled = false;
  329. BtnDelete->Enabled = false;
  330. BtnSave->Enabled = true;
  331. BtnEdit->Caption = "취소";
  332. BtnEdit->Hint = "데이터 편집 취소";
  333. }
  334. break;
  335. case 1: //편집[취소]버튼클릭
  336. {
  337. FormInit(); //화면을 모두 지운다.
  338. BtnEdit->Enabled = false;
  339. BtnInsert->Enabled = true;
  340. BtnDelete->Enabled = false;
  341. BtnSave->Enabled = false;
  342. BtnEdit->Caption = "편집";
  343. BtnEdit->Hint = "데이터 편집";
  344. bEnabled = true;
  345. }
  346. break;
  347. case 2: //추가
  348. {
  349. BtnEdit->Enabled = true;
  350. BtnInsert->Enabled = false;
  351. BtnDelete->Enabled = false;
  352. BtnSave->Enabled = true;
  353. BtnEdit->Caption = "취소";
  354. BtnEdit->Hint = "데이터 편집 취소";
  355. }
  356. break;
  357. case 3: //수정모드
  358. {
  359. BtnEdit->Enabled = true;
  360. BtnInsert->Enabled = true;
  361. BtnDelete->Enabled = true;
  362. BtnSave->Enabled = false;
  363. BtnEdit->Caption = "편집";
  364. BtnEdit->Hint = "데이터 편집";
  365. bEnabled = true;
  366. }
  367. break;
  368. }
  369. if (AEdit == 0 || AEdit == 2)
  370. {
  371. CxList->Enabled = false;
  372. }
  373. else
  374. {
  375. CxList->Enabled = true;
  376. }
  377. EdRseSectName->Properties->ReadOnly = bEnabled;
  378. SeCNGSSPD->Properties->ReadOnly = bEnabled;
  379. SeDELYSPD->Properties->ReadOnly = bEnabled;
  380. cxCheckBox1->Enabled = !bEnabled;
  381. cxCheckBox2->Enabled = !bEnabled;
  382. BtnLinkAdd->Enabled = !bEnabled;
  383. BtnLinkDel->Enabled = !bEnabled;
  384. }
  385. //---------------------------------------------------------------------------
  386. void __fastcall TDSRM040M::BtnInsertClick(TObject *Sender)
  387. {
  388. FormInit();
  389. //신규아이디를 얻어와서 화면을 초기화한다.
  390. String sSectId;
  391. if (!MyItsDsrcOfferSectManager->GetNextOffrSectId(sSectId))
  392. {
  393. Application->MessageBox(L"새로운 제공구간 ID를 생성하지 못하였습니다.\r\n프로그램 종료후에 다시 시도해 보세요.",
  394. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  395. return;
  396. }
  397. EdRseSectId->Text = sSectId;
  398. ChangeEditMode(2);
  399. FNewDb = true;
  400. }
  401. //---------------------------------------------------------------------------
  402. void __fastcall TDSRM040M::BtnDeleteClick(TObject *Sender)
  403. {
  404. int nIdx = m_pGDC->FocusedRecordIndex;
  405. if (nIdx < 0) return;
  406. String sSectId = EdRseSectId->Text;
  407. if (sSectId.IsEmpty())
  408. {
  409. Application->MessageBox(L"삭제할 DSRC-RSE 제공구간을 목록에서 선택하세요.\r\n목록에서 더블클릭하여 선택합니다.", FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  410. return;
  411. }
  412. String sMsg;
  413. sMsg = "제공구간 ID: " + sSectId;
  414. sMsg+= "\r\n선택하신 DSRC-RSE 제공구간 정보를 삭제하시겠습니까?\r\n관련정보도 함께 삭제 됩니다.";
  415. if (Application->MessageBox(sMsg.c_str(), FTitle.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  416. TItsDsrcOfferSect *pObj = MyItsDsrcOfferSectManager->FLists.Find(sSectId);
  417. if (pObj)
  418. {
  419. if (MyItsDsrcOfferSectManager->DeleteOfferSect(pObj->OFFR_SECT_ID))
  420. {
  421. pObj->DEL_YN = "Y";
  422. UpdateList();
  423. }
  424. FUpdate = true;
  425. Application->MessageBox(L"DSRC-RSE 제공구간 정보삭제\r\nDSRC-RSE 제공구간 정보를 삭제 하였습니다.",
  426. FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  427. FormInit();
  428. ChangeEditMode(1);
  429. }
  430. }
  431. //---------------------------------------------------------------------------
  432. void __fastcall TDSRM040M::BtnSaveClick(TObject *Sender)
  433. {
  434. if (EdRseSectId->Text.IsEmpty() ||
  435. EdRseSectName->Text.Trim().IsEmpty() ||
  436. EdStartSpotNm->Text.Trim().IsEmpty() ||
  437. EdEndSpotNm->Text.Trim().IsEmpty() ||
  438. EdStartSpotId->Text.IsEmpty() ||
  439. EdEndSpotId->Text.IsEmpty() )
  440. {
  441. Application->MessageBox(L"★항목은 필수 입력 항목입니다.\r\n모두 입력후 진행해 주세요.",
  442. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  443. return;
  444. }
  445. String sSectId = EdRseSectId->Text;
  446. TItsDsrcOfferSect *pObj;
  447. if (FNewDb)
  448. pObj = new TItsDsrcOfferSect();
  449. else
  450. pObj = MyItsDsrcOfferSectManager->FLists.Find(sSectId);
  451. if (pObj)
  452. {
  453. pObj->OFFR_SECT_ID = sSectId;
  454. pObj->OFFR_DRCT_NM = EdRseSectName->Text.Trim();
  455. pObj->CNGS_BASI_SPED = VarToStr(SeCNGSSPD->Value);
  456. pObj->DELY_BASI_SPED = VarToStr(SeDELYSPD->Value);
  457. pObj->ID = EdStartSpotId->Text.Trim();
  458. pObj->OBU_ENTR_DRCT_NMBR = EdRseSectLength->Text.Trim();
  459. pObj->PRE_ID = EdEndSpotId->Text.Trim();
  460. pObj->IXR_DRCT_NUM = pObj->OBU_ENTR_DRCT_NMBR;
  461. pObj->TARGETNM = EdStartSpotNm->Text;
  462. pObj->PRENM = EdEndSpotNm->Text;
  463. pObj->DEL_YN = "N";
  464. pObj->Completed = true;
  465. pObj->MEM_DEL = "N";
  466. pObj->FSectLists.RemoveAll();
  467. try {
  468. TvLink->BeginUpdate();
  469. for (int ii = 0; ii < TvLink->DataController->RecordCount; ii++)
  470. {
  471. String sLinkId = TvLink->DataController->Values[ii][ColLink2->Index];
  472. TItsDsrcOfferSectInfr *pSectObj = new TItsDsrcOfferSectInfr();
  473. pSectObj->OFFR_SECT_ID = pObj->OFFR_SECT_ID;
  474. pSectObj->IFSC_ID = sLinkId;
  475. pSectObj->ORD = String(ii+1);
  476. pSectObj->DEL_YN = "N";
  477. pObj->FSectLists.Push(pSectObj->ORD, pSectObj);
  478. }
  479. }
  480. __finally
  481. {
  482. TvLink->EndUpdate();
  483. }
  484. bool bResult;
  485. bResult = MyItsDsrcOfferSectManager->SaveOfferSect(pObj);
  486. if (bResult)
  487. {
  488. Application->MessageBox(L"DSRC-RSE 제공구간 정보저장\r\nDSRC-RSE 제공구간 정보를 저장 하였습니다.",
  489. FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  490. if (FNewDb)
  491. {
  492. MyItsDsrcOfferSectManager->FLists.Push(pObj->OFFR_SECT_ID, pObj);
  493. }
  494. FUpdate = true;
  495. UpdateList();
  496. CMM_SetGridRow(CxList, TvList, sSectId, Column01->Index);
  497. #if 0
  498. DisplayInfo(pObj);
  499. #else
  500. int nRow = TvList->DataController->FocusedRecordIndex;
  501. if( nRow <= -1 )
  502. return;
  503. int nMemPtr = TvList->DataController->Values[nRow][Column99->Index];
  504. TItsDsrcOfferSect* pObj = (TItsDsrcOfferSect*)nMemPtr;
  505. DisplayInfo(pObj);
  506. #endif
  507. }
  508. }
  509. }
  510. //---------------------------------------------------------------------------
  511. void __fastcall TDSRM040M::TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  512. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  513. {
  514. if (!ACellViewInfo) return;
  515. int nRow = TvList->DataController->FocusedRecordIndex;
  516. if( nRow <= -1 )
  517. return;
  518. int nMemPtr = TvList->DataController->Values[nRow][Column99->Index];
  519. TItsDsrcOfferSect* pObj = (TItsDsrcOfferSect*)nMemPtr;
  520. DisplayInfo(pObj);
  521. }
  522. //---------------------------------------------------------------------------
  523. void __fastcall TDSRM040M::FRAMEDsrcList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  524. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  525. {
  526. if (!ACellViewInfo) return;
  527. int nRow = FRAMEDsrcList1->TvList->DataController->FocusedRecordIndex;
  528. if( nRow <= -1 )
  529. return;
  530. int nMemPtr = FRAMEDsrcList1->TvList->DataController->Values[nRow][FRAMEDsrcList1->Column99->Index];
  531. TItsDsrc* pObj = (TItsDsrc*)nMemPtr;
  532. FRAMEGisMap1->SelectObjectByPos(StrToFloatDef(pObj->LCTN_X, 0), StrToFloatDef(pObj->LCTN_Y, 0), true);
  533. }
  534. //---------------------------------------------------------------------------
  535. void __fastcall TDSRM040M::cxCheckBox1Click(TObject *Sender)
  536. {
  537. if (cxCheckBox1->Checked)
  538. {
  539. if (cxCheckBox2->Checked) cxCheckBox2->Checked = false;
  540. FRAMEGisMap1->xclntMap->MapOperation = OnSelect;
  541. }
  542. else
  543. {
  544. FRAMEGisMap1->xclntMap->MapOperation = OnPanSt;
  545. }
  546. }
  547. //---------------------------------------------------------------------------
  548. void __fastcall TDSRM040M::cxCheckBox2Click(TObject *Sender)
  549. {
  550. if (cxCheckBox2->Checked)
  551. {
  552. if (cxCheckBox1->Checked) cxCheckBox1->Checked = false;
  553. FRAMEGisMap1->xclntMap->MapOperation = OnSelect;
  554. }
  555. else
  556. {
  557. FRAMEGisMap1->xclntMap->MapOperation = OnPanSt;
  558. }
  559. }
  560. //---------------------------------------------------------------------------
  561. void __fastcall TDSRM040M::FRAMEGisMap1xclntMapCCTVClick(TMouseButton Button, TShiftState Shift, int CNT, TArr_CCTV_Rec INFO)
  562. {
  563. if (FRAMEGisMap1->xclntMap->MapOperation != OnSelect) return;
  564. if (Button != mbLeft) return;
  565. if (CNT < 1) return;
  566. TCCTV_REC info = INFO[0];
  567. if (cxCheckBox1->Checked)
  568. {
  569. EdStartSpotId->Text = info.fID;
  570. EdStartSpotNm->Text = info.fAttr;
  571. int nAutoNum;
  572. if (MyItsDsrcOfferSectManager->GetAutoRseDrctNum(EdStartSpotId->Text, nAutoNum))
  573. {
  574. EdRseSectLength->Text = String(nAutoNum);
  575. }
  576. }
  577. else
  578. if (cxCheckBox2->Checked)
  579. {
  580. EdEndSpotId->Text = info.fID;
  581. EdEndSpotNm->Text = info.fAttr;
  582. }
  583. }
  584. //---------------------------------------------------------------------------
  585. void __fastcall TDSRM040M::FRAMEGisMap1xclntMapMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
  586. {
  587. if (EdRseSectName->Properties->ReadOnly) return;
  588. FRAMEGisMap1->xclntMap->ClearUserDrawPolyGon();
  589. FRAMEGisMap1->xclntMap->ReDraw();
  590. if (FRAMEGisMap1->xclntMap->MapOperation != OnSelect) return;
  591. if (Button != mbLeft) return;
  592. String sLinkId;
  593. int nLayerIdx = FRAMEGisMap1->GetLayerIndex();
  594. if (nLayerIdx >= 0)
  595. {
  596. TXiMapUtil::SelectLinkByPos(FRAMEGisMap1->xsrvrMap, FRAMEGisMap1->xclntMap, nLayerIdx, X, Y, sLinkId);
  597. if (!sLinkId.IsEmpty())
  598. {
  599. EdLinkId->Text = sLinkId;
  600. if (BtnLinkAdd->Enabled)
  601. {
  602. if (Shift.Contains(ssCtrl))
  603. {
  604. BtnLinkAddClick((TObject*)BtnLinkAdd);
  605. }
  606. }
  607. }
  608. }
  609. return;
  610. if (FRAMEGisMap1->SelectLinkByPos(X, Y, sLinkId))
  611. {
  612. EdLinkId->Text = sLinkId;
  613. int nLayerIdx = FRAMEGisMap1->GetLayerIndex();
  614. if (nLayerIdx >= 0)
  615. {
  616. TXiMapUtil::SelectLinkByPos2(FRAMEGisMap1->xsrvrMap, FRAMEGisMap1->xclntMap, nLayerIdx, X, Y);
  617. }
  618. }
  619. }
  620. //---------------------------------------------------------------------------
  621. void __fastcall TDSRM040M::RefreshSectLink()
  622. {
  623. FRAMEGisMap1->xclntMap->ClearPathInfo();
  624. FRAMEGisMap1->xclntMap->ReDraw();
  625. int nLayerIdx = FRAMEGisMap1->GetLayerIndex();
  626. if (nLayerIdx < 0) return;
  627. try
  628. {
  629. int nRow;
  630. TcxDataController *pGDC = TvLink->DataController;
  631. TvLink->BeginUpdate();
  632. try
  633. {
  634. for (int ii = 0; ii < pGDC->RecordCount; ii++)
  635. {
  636. String sLinkId = pGDC->Values[ii][ColLink2->Index];
  637. TXiMapUtil::SelectLinkById(FRAMEGisMap1->xsrvrMap, FRAMEGisMap1->xclntMap, nLayerIdx, sLinkId);
  638. }
  639. }
  640. catch(...)
  641. {
  642. }
  643. }
  644. __finally
  645. {
  646. TvLink->EndUpdate();
  647. }
  648. FRAMEGisMap1->xclntMap->ReDraw();
  649. }
  650. //---------------------------------------------------------------------------
  651. void __fastcall TDSRM040M::BtnLinkDelClick(TObject *Sender)
  652. {
  653. int nSelRows = TvLink->Controller->SelectedRowCount;
  654. if (nSelRows <= 0)
  655. {
  656. Application->MessageBox(L"삭제를 원하는 서비스구간을 목록에서 선택하세요.",
  657. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  658. return;
  659. }
  660. TvLink->Controller->DeleteSelection();
  661. RefreshSectLink();
  662. }
  663. //---------------------------------------------------------------------------
  664. void __fastcall TDSRM040M::BtnLinkAddClick(TObject *Sender)
  665. {
  666. if (EdLinkId->Text.IsEmpty()) return;
  667. String sNewId = EdLinkId->Text;
  668. bool bFound = false;
  669. try
  670. {
  671. int nRow;
  672. TcxDataController *pGDC = TvLink->DataController;
  673. TvLink->BeginUpdate();
  674. for (int ii = 0; ii < pGDC->RecordCount; ii++)
  675. {
  676. String sLinkId = pGDC->Values[ii][ColLink2->Index];
  677. if (sNewId == sLinkId)
  678. {
  679. bFound = true;
  680. break;
  681. }
  682. }
  683. if (bFound)
  684. {
  685. Application->MessageBox(L"이미 등록되어 있는 서비스구간 입니다.\r\n서비스 구간은 중복해서 등록 할 수 없습니다.",
  686. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  687. return;
  688. }
  689. TItsServiceLink *pLink = ItsServiceLinkManager->FLists.Find(sNewId);
  690. if (pLink)
  691. {
  692. nRow = pGDC->AppendRecord();
  693. pGDC->Values[nRow][ColLink2->Index] = sNewId;
  694. TItsNode *pNode;
  695. pGDC->Values[nRow][ColLink3->Index] = pLink->F_NODE_ID;
  696. pGDC->Values[nRow][ColLink5->Index] = pLink->T_NODE_ID;
  697. pNode = ItsNodeManager->FLists.Find(pLink->F_NODE_ID);
  698. if (pNode)
  699. {
  700. pGDC->Values[nRow][ColLink4->Index] = pNode->NODE_NAME;
  701. }
  702. pNode = ItsNodeManager->FLists.Find(pLink->T_NODE_ID);
  703. if (pNode)
  704. {
  705. pGDC->Values[nRow][ColLink6->Index] = pNode->NODE_NAME;
  706. }
  707. }
  708. else
  709. {
  710. Application->MessageBox(L"데이터베이스에 등록되어 있지 않는 서비스구간 입니다.\r\n데이터베이스의 정보를 확인하세요.",
  711. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  712. return;
  713. }
  714. }
  715. __finally
  716. {
  717. TvLink->EndUpdate();
  718. }
  719. RefreshSectLink();
  720. }
  721. //---------------------------------------------------------------------------
  722. void __fastcall TDSRM040M::DisplaySectLink(TItsDsrcOfferSect* AObj)
  723. {
  724. if (!AObj) return;
  725. CMM_ClearGridTableView(TvLink);
  726. try
  727. {
  728. int nRow;
  729. TcxDataController *pGDC = TvLink->DataController;
  730. TvLink->BeginUpdate();
  731. FOR_STL(TItsDsrcOfferSectInfr *, pObj, AObj->FSectLists)
  732. {
  733. String sLinkId = pObj->IFSC_ID;
  734. nRow = pGDC->AppendRecord();
  735. pGDC->Values[nRow][ColLink2->Index] = sLinkId;
  736. TItsServiceLink *pLink = ItsServiceLinkManager->FLists.Find(sLinkId);
  737. if (pLink)
  738. {
  739. TItsNode *pNode;
  740. pGDC->Values[nRow][ColLink3->Index] = pLink->F_NODE_ID;
  741. pGDC->Values[nRow][ColLink5->Index] = pLink->T_NODE_ID;
  742. pNode = ItsNodeManager->FLists.Find(pLink->F_NODE_ID);
  743. if (pNode)
  744. {
  745. pGDC->Values[nRow][ColLink4->Index] = pNode->NODE_NAME;
  746. }
  747. pNode = ItsNodeManager->FLists.Find(pLink->T_NODE_ID);
  748. if (pNode)
  749. {
  750. pGDC->Values[nRow][ColLink6->Index] = pNode->NODE_NAME;
  751. }
  752. }
  753. }
  754. }
  755. __finally
  756. {
  757. TvLink->EndUpdate();
  758. }
  759. RefreshSectLink();
  760. }
  761. //---------------------------------------------------------------------------
  762. void __fastcall TDSRM040M::TvLinkCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  763. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  764. {
  765. if (!ACellViewInfo) return;
  766. int nRow = TvLink->DataController->FocusedRecordIndex;
  767. if( nRow <= -1 )
  768. return;
  769. String sLinkId = TvLink->DataController->Values[nRow][ColLink2->Index];
  770. TXiMapUtil::MoveServiceLink(FRAMEGisMap1->xclntMap, sLinkId);
  771. }
  772. //---------------------------------------------------------------------------
  773. void __fastcall TDSRM040M::ChkGisZoomClick(TObject *Sender)
  774. {
  775. cxGroupBox1->Visible = !ChkGisZoom->Checked;
  776. }
  777. //---------------------------------------------------------------------------