VMSM810MF.cpp 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  1. /****************************************************************************
  2. * @source :
  3. * @description :
  4. ****************************************************************************
  5. * DATE AUTHOR DESCRIPTION
  6. * --------------------------------------------------------------------------
  7. * 2016/07/10 shjung 최초작성
  8. *
  9. ****************************************************************************/
  10. //---------------------------------------------------------------------------
  11. #include <vcl.h>
  12. #include "ITSSkinF.h"
  13. #include "ITSUtilF.h"
  14. #include "AppGlobalF.h"
  15. #include "CDSVmsIfscF.h"
  16. #pragma hdrstop
  17. #include "VMSM810MF.h"
  18. //---------------------------------------------------------------------------
  19. #pragma package(smart_init)
  20. #pragma link "cxButtons"
  21. #pragma link "cxCalendar"
  22. #pragma link "cxContainer"
  23. #pragma link "cxControls"
  24. #pragma link "cxDropDownEdit"
  25. #pragma link "cxEdit"
  26. #pragma link "cxGraphics"
  27. #pragma link "cxGroupBox"
  28. #pragma link "cxLabel"
  29. #pragma link "cxLookAndFeelPainters"
  30. #pragma link "cxLookAndFeels"
  31. #pragma link "cxMaskEdit"
  32. #pragma link "cxPC"
  33. #pragma link "cxPCdxBarPopupMenu"
  34. #pragma link "cxSpinEdit"
  35. #pragma link "cxSplitter"
  36. #pragma link "cxTextEdit"
  37. #pragma link "cxTimeEdit"
  38. #pragma link "dxSkinBlack"
  39. #pragma link "dxSkinBlue"
  40. #pragma link "dxSkinCaramel"
  41. #pragma link "dxSkinCoffee"
  42. #pragma link "dxSkinDarkRoom"
  43. #pragma link "dxSkinDarkSide"
  44. #pragma link "dxSkinFoggy"
  45. #pragma link "dxSkinGlassOceans"
  46. #pragma link "dxSkiniMaginary"
  47. #pragma link "dxSkinLilian"
  48. #pragma link "dxSkinLiquidSky"
  49. #pragma link "dxSkinLondonLiquidSky"
  50. #pragma link "dxSkinMcSkin"
  51. #pragma link "dxSkinMoneyTwins"
  52. #pragma link "dxSkinOffice2007Black"
  53. #pragma link "dxSkinOffice2007Blue"
  54. #pragma link "dxSkinOffice2007Green"
  55. #pragma link "dxSkinOffice2007Pink"
  56. #pragma link "dxSkinOffice2007Silver"
  57. #pragma link "dxSkinOffice2010Black"
  58. #pragma link "dxSkinOffice2010Blue"
  59. #pragma link "dxSkinOffice2010Silver"
  60. #pragma link "dxSkinsCore"
  61. #pragma link "dxSkinscxPCPainter"
  62. #pragma link "dxSkinSeven"
  63. #pragma link "dxSkinSharp"
  64. #pragma link "dxSkinSilver"
  65. #pragma link "dxSkinStardust"
  66. #pragma link "cxRadioGroup"
  67. #pragma link "cxClasses"
  68. #pragma link "cxCustomData"
  69. #pragma link "cxData"
  70. #pragma link "cxDataStorage"
  71. #pragma link "cxDBData"
  72. #pragma link "cxFilter"
  73. #pragma link "cxGrid"
  74. #pragma link "cxGridCustomTableView"
  75. #pragma link "cxGridCustomView"
  76. #pragma link "cxGridDBTableView"
  77. #pragma link "cxGridLevel"
  78. #pragma link "cxGridTableView"
  79. #pragma link "cxStyles"
  80. #pragma link "cxCheckBox"
  81. #pragma link "cxImage"
  82. #pragma link "cxButtonEdit"
  83. #pragma link "cxBlobEdit"
  84. #pragma link "VmsDesignerF"
  85. #pragma link "cxColorComboBox"
  86. #pragma link "cxCalc"
  87. #pragma resource "*.dfm"
  88. TVMSM810M *VMSM810M = NULL;
  89. //---------------------------------------------------------------------------
  90. __fastcall TVMSM810M::TVMSM810M(TComponent* Owner)
  91. : TForm(Owner)
  92. {
  93. ITSSkin_Load(this);
  94. //CMM_LoadForm(g_sFormsDir, this);
  95. FSelected = false;
  96. FUpdate= false;
  97. FTitle = "VMS 교통상황 폼 관리";
  98. APP_InitDisplayColor();
  99. }
  100. //---------------------------------------------------------------------------
  101. /*
  102. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  103. * Form과 DataModule class를 delete시킨다.
  104. * arguments
  105. *
  106. * return
  107. * void
  108. */
  109. void __fastcall TVMSM810M::CommClose()
  110. {
  111. try
  112. {
  113. if (m_pEdtDesigner)
  114. {
  115. delete m_pEdtDesigner;
  116. m_pEdtDesigner = NULL;
  117. }
  118. //CMM_SaveForm(g_sFormsDir, this);
  119. }
  120. catch(...)
  121. {
  122. }
  123. }
  124. //---------------------------------------------------------------------------
  125. void __fastcall TVMSM810M::FormCreate(TObject *Sender)
  126. {
  127. m_pEdtDesigner = new TVmsFormDesigner(PnlEditForm);
  128. }
  129. //---------------------------------------------------------------------------
  130. void __fastcall TVMSM810M::FormShow(TObject *Sender)
  131. {
  132. Refresh();
  133. FormInit();
  134. PnlEdtBack->Width = FVmsWidth+4;
  135. PnlEdtBack->Height= FVmsHeight+4;
  136. LoadVmsIfsc(FVmsNmbr);
  137. TmrShow->Enabled = true;
  138. }
  139. //---------------------------------------------------------------------------
  140. void __fastcall TVMSM810M::FormInit()
  141. {
  142. TvObjList->OptionsView->NoDataToDisplayInfoText = "<등록되어 있는 객체 정보가 없습니다>";
  143. m_pEdtDesigner->ApplicationHandle = (long)Handle;
  144. FNewDb = false;
  145. }
  146. //---------------------------------------------------------------------------
  147. void __fastcall TVMSM810M::LoadVmsIfsc(String AVmsNmbr)
  148. {
  149. CMM_ClearGridTableView(TvAxis);
  150. String sQry;
  151. TADOQuery *pADO = NULL;
  152. sQry = "SELECT C.VMS_CTLR_NMBR, C.VMS_CTLR_ID, C.VMS_NM, \r\n"
  153. " A.VMS_IFSC_ID, A.VMS_IFSC_NM, \r\n"
  154. " A.DSPL_STRT_NODE_NM, A.DSPL_END_NODE_NM, \r\n"
  155. " A.AXIS_YN \r\n"
  156. " FROM TB_VMS_IFSC A, \r\n"
  157. " TB_VMS_IFSC_RLTN B, \r\n"
  158. " (SELECT VMS_CTLR_NMBR, \r\n"
  159. " VMS_CTLR_ID, \r\n"
  160. " VMS_NM \r\n"
  161. " FROM TB_VMS_CTLR \r\n"
  162. " WHERE VMS_CTLR_NMBR = :p01) C \r\n"
  163. " WHERE A.EDTN_CD != 'EDI2' \r\n"
  164. " AND A.VMS_IFSC_ID = B.VMS_IFSC_ID \r\n"
  165. " AND B.VMS_CTLR_NMBR = C.VMS_CTLR_NMBR \r\n";
  166. try
  167. {
  168. int nRow;
  169. TcxDataController *pGDC = TvAxis->DataController;
  170. TvAxis->BeginUpdate();
  171. try
  172. {
  173. pADO = new TADOQuery(NULL);
  174. pADO->Close();
  175. pADO->Connection = ITSDb_GetConnection();
  176. ITSDb_SQLText(pADO, sQry);
  177. ITSDb_SQLBind(pADO, "p01", AVmsNmbr);
  178. ITSDb_SQLOpen(pADO);
  179. for( ; !pADO->Eof; pADO->Next())
  180. {
  181. nRow = pGDC->AppendRecord();
  182. pGDC->Values[nRow][Col00->Index] = pADO->FieldByName("VMS_CTLR_ID")->AsString;
  183. pGDC->Values[nRow][Col01->Index] = pADO->FieldByName("VMS_IFSC_ID")->AsString;
  184. pGDC->Values[nRow][Col02->Index] = pADO->FieldByName("VMS_IFSC_NM")->AsString;
  185. pGDC->Values[nRow][Col03->Index] = pADO->FieldByName("DSPL_STRT_NODE_NM")->AsString;
  186. pGDC->Values[nRow][Col04->Index] = pADO->FieldByName("DSPL_END_NODE_NM")->AsString;
  187. pGDC->Values[nRow][Col05->Index] = pADO->FieldByName("AXIS_YN")->AsString;
  188. }
  189. }
  190. catch(EDatabaseError &E)
  191. {
  192. DBERRORMSG("VMS제공구간정보조회", String(E.ClassName()), E.Message, sQry);
  193. throw Exception(String(E.ClassName()) + E.Message);
  194. }
  195. catch(Exception &e)
  196. {
  197. DBERRORMSG("VMS제공구간정보조회", String(e.ClassName()), e.Message, sQry);
  198. throw Exception(String(e.ClassName()) + e.Message);
  199. }
  200. }
  201. __finally
  202. {
  203. if (pADO)
  204. {
  205. pADO->Close();
  206. delete pADO;
  207. }
  208. TvAxis->EndUpdate();
  209. CMM_ExpandCollapseChk(TvAxis, true);
  210. }
  211. }
  212. //---------------------------------------------------------------------------
  213. void __fastcall TVMSM810M::TmrShowTimer(TObject *Sender)
  214. {
  215. TmrShow->Enabled = false;
  216. BtnSearchClick(NULL);
  217. }
  218. //---------------------------------------------------------------------------
  219. void __fastcall TVMSM810M::BtnSearchClick(TObject *Sender)
  220. {
  221. RefreshData();
  222. EdFocus->SetFocus();
  223. }
  224. //---------------------------------------------------------------------------
  225. void __fastcall TVMSM810M::RefreshData()
  226. {
  227. // 검색조건에 의한 링크 데이터 조회
  228. FormClear();
  229. m_pEdtDesigner->Clear();
  230. m_pEdtDesigner->SizeType = FVmsTypeCd;
  231. m_pEdtDesigner->SetSize(FVmsWidth, FVmsHeight);
  232. m_pEdtDesigner->SetPos(0, 0);
  233. m_pEdtDesigner->BkColorCode = FFormColor;//m_pDesigner->BkColorCode;
  234. m_pEdtDesigner->EditMode = true;
  235. m_pEdtDesigner->Show();
  236. InitObjectList();
  237. LoadFormObjectInfo(FFormId, m_pEdtDesigner);
  238. DispObjectListData();
  239. }
  240. //---------------------------------------------------------------------------
  241. void __fastcall TVMSM810M::AddTrafficTypeObject(int ARow, String AIfscId)
  242. {
  243. TVmsIfsc *pObj;
  244. TcxGridDataController *pGDC = TvObjList->DataController;
  245. pGDC->Values[ARow][ColIfscId->Index] = AIfscId;
  246. pObj = VmsIfscManager->FLists.Find(FIfscId[0].ToIntDef(0));
  247. if (!pObj) return;
  248. pGDC->Values[ARow][ColIfscNm->Index] = pObj->VMS_IFSC_NM;
  249. pGDC->Values[ARow][ColIfscStr->Index] = pObj->DSPL_STRT_NODE_NM;
  250. pGDC->Values[ARow][ColIfscEnd->Index] = pObj->DSPL_END_NODE_NM;
  251. }
  252. //---------------------------------------------------------------------------
  253. void __fastcall TVMSM810M::InitObjectList()
  254. {
  255. CMM_ClearGridTableView(TvObjList);
  256. TcxGridDataController *pGDC = TvObjList->DataController;
  257. ColObj03->Visible = false;
  258. ColObj04->Visible = false;
  259. try
  260. {
  261. TvObjList->BeginUpdate();
  262. pGDC->BeginUpdate();
  263. int nRow;
  264. switch(FFormType)
  265. {
  266. case 11:// ' 소통상황(1단)
  267. nRow = pGDC->AppendRecord();
  268. pGDC->Values[nRow][ColObj01->Index] = "11";
  269. pGDC->Values[nRow][ColObj02->Index] = "1단 소통정보";
  270. AddTrafficTypeObject(nRow, FIfscId[0]);
  271. break;
  272. case 12:// ' 소통상황(2단)
  273. nRow = pGDC->AppendRecord();
  274. pGDC->Values[nRow][ColObj01->Index] = "11";
  275. pGDC->Values[nRow][ColObj02->Index] = "1단 소통정보";
  276. AddTrafficTypeObject(nRow, FIfscId[0]);
  277. nRow = pGDC->AppendRecord();
  278. pGDC->Values[nRow][ColObj01->Index] = "12";
  279. pGDC->Values[nRow][ColObj02->Index] = "2단 소통정보";
  280. AddTrafficTypeObject(nRow, FIfscId[1]);
  281. break;
  282. case 13:// ' 소통상황(3단)
  283. nRow = pGDC->AppendRecord();
  284. pGDC->Values[nRow][ColObj01->Index] = "11";
  285. pGDC->Values[nRow][ColObj02->Index] = "1단 소통정보";
  286. AddTrafficTypeObject(nRow, FIfscId[0]);
  287. nRow = pGDC->AppendRecord();
  288. pGDC->Values[nRow][ColObj01->Index] = "12";
  289. pGDC->Values[nRow][ColObj02->Index] = "2단 소통정보";
  290. AddTrafficTypeObject(nRow, FIfscId[1]);
  291. nRow = pGDC->AppendRecord();
  292. pGDC->Values[nRow][ColObj01->Index] = "13";
  293. pGDC->Values[nRow][ColObj02->Index] = "3단 소통정보";
  294. AddTrafficTypeObject(nRow, FIfscId[2]);
  295. break;
  296. case 14:// ' 소통상황(4단)
  297. nRow = pGDC->AppendRecord();
  298. pGDC->Values[nRow][ColObj01->Index] = "11";
  299. pGDC->Values[nRow][ColObj02->Index] = "1단 소통정보";
  300. AddTrafficTypeObject(nRow, FIfscId[0]);
  301. nRow = pGDC->AppendRecord();
  302. pGDC->Values[nRow][ColObj01->Index] = "12";
  303. pGDC->Values[nRow][ColObj02->Index] = "2단 소통정보";
  304. AddTrafficTypeObject(nRow, FIfscId[1]);
  305. nRow = pGDC->AppendRecord();
  306. pGDC->Values[nRow][ColObj01->Index] = "13";
  307. pGDC->Values[nRow][ColObj02->Index] = "3단 소통정보";
  308. AddTrafficTypeObject(nRow, FIfscId[2]);
  309. nRow = pGDC->AppendRecord();
  310. pGDC->Values[nRow][ColObj01->Index] = "14";
  311. pGDC->Values[nRow][ColObj02->Index] = "4단 소통정보";
  312. AddTrafficTypeObject(nRow, FIfscId[2]);
  313. break;
  314. case 15:// ' 소통상황(도형식)
  315. ColObj03->Visible = true;
  316. break;
  317. default:
  318. break;
  319. }
  320. }
  321. __finally
  322. {
  323. pGDC->EndUpdate();
  324. TvObjList->EndUpdate();
  325. }
  326. }
  327. //---------------------------------------------------------------------------
  328. void __fastcall TVMSM810M::BtnClosexClick(TObject *Sender)
  329. {
  330. FSelected = false;
  331. Close();
  332. }
  333. //---------------------------------------------------------------------------
  334. void __fastcall TVMSM810M::FormClose(TObject *Sender, TCloseAction &Action)
  335. {
  336. CommClose();
  337. VMSM810M = NULL;
  338. //Action = caFree;
  339. }
  340. //---------------------------------------------------------------------------
  341. void __fastcall TVMSM810M::LoadFormObjectInfo(String AFormId, TVmsFormDesigner *ADesigner)
  342. {
  343. ADesigner->Clear();
  344. String sQry;
  345. TADOQuery *pADO = NULL;
  346. sQry = "SELECT A.*, \r\n"
  347. " C.VMS_FONT_SHPE_NM, \r\n"
  348. " B.IMAG_DATA AS SYMB_IMG, \r\n"
  349. " B.SYMB_EXPL AS SYMB_IMG_NM \r\n"
  350. " FROM TB_VMS_FORM_OBJECT A, \r\n"
  351. " TB_VMS_SYMB_LIB B, \r\n"
  352. " TB_VMS_FONT_SHPE C, \r\n"
  353. " TB_VMS_FORM D \r\n"
  354. " WHERE D.VMS_FORM_ID = :p01 \r\n"
  355. " AND D.VMS_FORM_ID = A.VMS_FORM_ID \r\n"
  356. " AND A.SYMBLIB_NMBR = B.SYMBLIB_NMBR(+) \r\n"
  357. " AND A.VMS_FONT_TYPE_CD = C.VMS_FONT_SHPE_CD(+) \r\n"
  358. " ORDER BY A.FORM_OBJECT_ID ASC \r\n";
  359. try
  360. {
  361. try
  362. {
  363. pADO = new TADOQuery(NULL);
  364. pADO->Close();
  365. pADO->Connection = ITSDb_GetConnection();
  366. ITSDb_SQLText(pADO, sQry);
  367. ITSDb_SQLBind(pADO, "p01", AFormId);
  368. ITSDb_SQLOpen(pADO);
  369. int nDrawType;
  370. String sObjKind;
  371. for( ; !pADO->Eof; pADO->Next())
  372. {
  373. int nFormId = pADO->FieldByName("VMS_FORM_ID")->AsInteger;
  374. int nObjId = pADO->FieldByName("FORM_OBJECT_ID")->AsInteger;
  375. int nObjType = pADO->FieldByName("VMS_FORM_OBJECT_TYPE_CD")->AsInteger;
  376. if (nObjType == 1 || //이미지 심볼
  377. nObjType == 2 || //소통정보이미지
  378. nObjType == 3 || //파일이미지
  379. nObjType == 17 || //방향이미지1
  380. nObjType == 27 || //방향이미지2
  381. nObjType == 37 || //방향이미지3
  382. nObjType == 47 ) //방향이미지4
  383. {
  384. if (nObjType == 1) sObjKind = OBJKIND_IMAGEID; //Image Id
  385. else sObjKind = OBJKIND_IMAGE; //Image
  386. nDrawType = 1; //이미지그리기
  387. }
  388. else
  389. {
  390. sObjKind = OBJKIND_TEXT; //문자열
  391. nDrawType = 0; //문자열그리기
  392. }
  393. //실재 맵핑된 구간의 정보를 표출하도록 한다.
  394. int nBlinking = pADO->FieldByName("VMS_DSPL_BLINKING")->AsInteger;
  395. int nPosX = pADO->FieldByName("VMS_DSPL_XCRDN")->AsInteger;
  396. int nPosY = pADO->FieldByName("VMS_DSPL_YCRDN")->AsInteger;
  397. TVmsFormObject *pObj = ADesigner->AddObject((VmsObjectDrawType)nDrawType);
  398. if (!pObj) continue;
  399. //11 , ' @구간명
  400. //12 , ' @시점명
  401. //13 , ' @종점명
  402. //14 , ' @소통상황
  403. //15 , ' @통행시간
  404. //16 , ' @통행속도
  405. //17 , ' @방향
  406. pObj->Text = pADO->FieldByName("VMS_DSPL_TXT")->AsString.Trim();
  407. pObj->RunText = pObj->Text;
  408. String sIfscId = "";
  409. if (nObjType >= 11 && nObjType <= 17)
  410. sIfscId = FIfscId[0];
  411. else
  412. if (nObjType >= 21 && nObjType <= 27)
  413. sIfscId = FIfscId[1];
  414. else
  415. if (nObjType >= 31 && nObjType <= 37)
  416. sIfscId = FIfscId[2];
  417. else
  418. if (nObjType >= 41 && nObjType <= 47)
  419. sIfscId = FIfscId[3];
  420. if (sIfscId != "")
  421. {
  422. TVmsIfsc *pIfscObj;
  423. pIfscObj = VmsIfscManager->FLists.Find(sIfscId.ToIntDef(0));
  424. if (pIfscObj)
  425. {
  426. switch(nObjType)
  427. {
  428. case 11: case 21: case 31: case 41:
  429. pObj->RunText = pIfscObj->VMS_IFSC_NM;
  430. break;
  431. case 12: case 22: case 32: case 42:
  432. pObj->RunText = pIfscObj->DSPL_STRT_NODE_NM;
  433. break;
  434. case 13: case 23: case 33: case 43:
  435. pObj->RunText = pIfscObj->DSPL_END_NODE_NM;
  436. break;
  437. }
  438. }
  439. }
  440. pObj->ObjSeq = nObjId;
  441. pObj->ObjId = nObjId;
  442. pObj->ObjKind = sObjKind;
  443. pObj->Tag = pADO->FieldByName("VMS_IFSC_ID")->AsString;
  444. pObj->ObjType = pADO->FieldByName("VMS_FORM_OBJECT_TYPE_CD")->AsString;
  445. pObj->ObjSize = pADO->FieldByName("VMS_DSPL_SIZE")->AsInteger;
  446. pObj->BkColorCode = pADO->FieldByName("VMS_DSPL_BKCOLOR")->AsString;
  447. pObj->Blink = nBlinking == 1 ? true : false;
  448. pObj->ImageId = pADO->FieldByName("SYMBLIB_NMBR")->AsString;
  449. if (pObj->ObjKind == OBJKIND_TEXT) // 문자열
  450. {
  451. int nFontBold = pADO->FieldByName("VMS_FONT_STYL_CD")->AsInteger;
  452. pObj->FontName = pADO->FieldByName("VMS_FONT_SHPE_NM")->AsString;
  453. pObj->FontNameCode = pADO->FieldByName("VMS_FONT_TYPE_CD")->AsString;
  454. pObj->FontColorCode = pADO->FieldByName("VMS_FONT_HUE_CD")->AsString;
  455. pObj->FontSize = pADO->FieldByName("VMS_FONT_SIZE")->AsInteger;
  456. pObj->FontBold = nFontBold == 1 ? true : false;
  457. pObj->TextAlign = pADO->FieldByName("VMS_FONT_ALIGN")->AsInteger;
  458. pObj->SetSize(pADO->FieldByName("VMS_DSPL_WIDTH")->AsInteger, pADO->FieldByName("VMS_DSPL_HEIGHT")->AsInteger);
  459. pObj->SetRuntimeText(pObj->RunText);
  460. }
  461. else //if (sObjKind == "1" || sObjKind == "2") // 이미지(1), 이미지 ID(2)
  462. {
  463. if (pObj->ObjKind == OBJKIND_IMAGEID)
  464. {
  465. pObj->Text = pADO->FieldByName("SYMBLIB_NMBR")->AsString;
  466. }
  467. TStream *pStream = NULL;
  468. pStream = pADO->CreateBlobStream(pADO->FieldByName("VMS_DSPL_FIGR"), bmRead);
  469. try
  470. {
  471. if (pStream && pStream->Size > 0)
  472. {
  473. Graphics::TBitmap *Bitmap = pObj->GetBitmap();
  474. pStream->Position = 0;
  475. Bitmap->LoadFromStream(pStream);
  476. pObj->SetSize(Bitmap->Width, Bitmap->Height);
  477. }
  478. }
  479. __finally
  480. {
  481. SAFE_DELETE(pStream);
  482. }
  483. }
  484. pObj->SetPos(nPosX, nPosY);
  485. pObj->Show();
  486. pObj->BringToFront();
  487. }
  488. }
  489. catch(EDatabaseError &E)
  490. {
  491. DBERRORMSG("VMS폼객체조회", String(E.ClassName()), E.Message, sQry);
  492. throw Exception(String(E.ClassName()) + E.Message);
  493. }
  494. catch(Exception &exception)
  495. {
  496. DBERRORMSG("VMS폼객체조회", String(exception.ClassName()), exception.Message, sQry);
  497. throw Exception(String(exception.ClassName()) + exception.Message);
  498. }
  499. }
  500. __finally
  501. {
  502. if (pADO)
  503. {
  504. pADO->Close();
  505. delete pADO;
  506. }
  507. }
  508. }
  509. //---------------------------------------------------------------------------
  510. void __fastcall TVMSM810M::FormClear()
  511. {
  512. FSelIdx = -1;
  513. EdFormId->Clear();
  514. EdObjId->Clear();
  515. FNewDb = false;
  516. }
  517. //---------------------------------------------------------------------------
  518. void __fastcall TVMSM810M::DispObjectListData()
  519. {
  520. TcxGridDataController *pGDC = TvObjList->DataController;
  521. int nRow;
  522. TVmsFormObject *pObj;
  523. int nObjCnt = m_pEdtDesigner->GetObjectCount();
  524. for(int ii = 0; ii < nObjCnt; ii++)
  525. {
  526. pObj = m_pEdtDesigner->GetObject(ii);
  527. if (pObj)
  528. {
  529. if (pObj->ObjType.ToIntDef(0) == 91) //@축통행시간(고정)
  530. {
  531. nRow = pGDC->AppendRecord();
  532. pGDC->Values[nRow][ColObj01->Index] = "15";
  533. pGDC->Values[nRow][ColObj02->Index] = "축통생시간(고정)";
  534. pGDC->Values[nRow][ColObj03->Index] = String(pObj->ObjSeq);
  535. AddTrafficTypeObject(nRow, pObj->Tag);
  536. }
  537. else
  538. if (pObj->ObjType.ToIntDef(0) == 92) //@축소통상황(고정)
  539. {
  540. nRow = pGDC->AppendRecord();
  541. pGDC->Values[nRow][ColObj01->Index] = "15";
  542. pGDC->Values[nRow][ColObj02->Index] = "소통상황(고정)";
  543. pGDC->Values[nRow][ColObj03->Index] = String(pObj->ObjSeq);
  544. AddTrafficTypeObject(nRow, pObj->Tag);
  545. }
  546. }
  547. }
  548. }
  549. //---------------------------------------------------------------------------
  550. void __fastcall TVMSM810M::TvObjListFocusedRecordChanged(TcxCustomGridTableView *Sender,
  551. TcxCustomGridRecord *APrevFocusedRecord, TcxCustomGridRecord *AFocusedRecord,
  552. bool ANewItemRecordFocusingChanged)
  553. {
  554. if (TvObjList->ViewData->RecordCount <= 0) return;
  555. if (TvObjList->DataController->FocusedRowIndex < 0) return;
  556. m_pEdtDesigner->SelectedObjectAll(false);
  557. TcxDataController *pGDC = TvObjList->DataController;
  558. int nIndex = pGDC->FocusedRecordIndex;
  559. String sFormType = pGDC->Values[nIndex][ColObj01->Index];
  560. int nFormType = sFormType.ToIntDef(0);
  561. if (nFormType == 11 || nFormType == 12 || nFormType == 13 || nFormType == 14)
  562. {
  563. BtnListAdd->Enabled = true;
  564. BtnListDelete->Enabled = true;
  565. }
  566. else
  567. {
  568. BtnListAdd->Enabled = true;
  569. BtnListDelete->Enabled = true;
  570. }
  571. if (nFormType == 15)
  572. {
  573. int nObjSeq = VarToStr(pGDC->Values[nIndex][ColObj03->Index]).ToIntDef(0);
  574. m_pEdtDesigner->SelectObject(nObjSeq);
  575. return;
  576. }
  577. TVmsFormObject *pObj;
  578. int nObjCnt = m_pEdtDesigner->GetObjectCount();
  579. for(int ii = 0; ii < nObjCnt; ii++)
  580. {
  581. pObj = m_pEdtDesigner->GetObject(ii);
  582. if (!pObj) continue;
  583. int nObjType = pObj->ObjType.ToIntDef(0);
  584. switch(nFormType)
  585. {
  586. case 11:// ' 소통상황(1단)
  587. //@구간명, @시점명, @종점명
  588. if (nObjType >= 11 && nObjType <= 17)
  589. {
  590. m_pEdtDesigner->SelectObject(pObj->ObjSeq, true);
  591. }
  592. break;
  593. case 12:// ' 소통상황(2단)
  594. if (nObjType >= 21 && nObjType <= 27)
  595. {
  596. m_pEdtDesigner->SelectObject(pObj->ObjSeq, true);
  597. }
  598. break;
  599. case 13:// ' 소통상황(3단)
  600. if (nObjType >= 31 && nObjType <= 37)
  601. {
  602. m_pEdtDesigner->SelectObject(pObj->ObjSeq, true);
  603. }
  604. break;
  605. case 14:// ' 소통상황(4단)
  606. if (nObjType >= 41 && nObjType <= 47)
  607. {
  608. m_pEdtDesigner->SelectObject(pObj->ObjSeq, true);
  609. }
  610. break;
  611. default:
  612. break;
  613. }
  614. }
  615. }
  616. //---------------------------------------------------------------------------
  617. void __fastcall TVMSM810M::BtnListAddClick(TObject *Sender)
  618. {
  619. int nCellIdx = CMM_GetRecordIndex(TvObjList);
  620. if (nCellIdx < 0) return;
  621. int nIfscIdx = CMM_GetRecordIndex(TvAxis);
  622. if (nIfscIdx < 0) return;
  623. TcxGridDataController *pDcCell = TvObjList->DataController;
  624. TcxGridDataController *pDcIfsc = TvAxis->DataController;
  625. pDcCell->Values[nCellIdx][ColIfscId->Index] = pDcIfsc->Values[nIfscIdx][Col01->Index];
  626. pDcCell->Values[nCellIdx][ColIfscNm->Index] = pDcIfsc->Values[nIfscIdx][Col02->Index];
  627. pDcCell->Values[nCellIdx][ColIfscStr->Index] = pDcIfsc->Values[nIfscIdx][Col03->Index];
  628. pDcCell->Values[nCellIdx][ColIfscEnd->Index] = pDcIfsc->Values[nIfscIdx][Col04->Index];
  629. TVmsFormObject *pObj;
  630. int nObjCnt = m_pEdtDesigner->GetObjectCount();
  631. for(int ii = 0; ii < nObjCnt; ii++)
  632. {
  633. pObj = m_pEdtDesigner->GetObject(ii);
  634. if (!pObj) continue;
  635. if (!pObj->Selected) continue;
  636. int nObjType = pObj->ObjType.ToIntDef(0);
  637. switch(nObjType)
  638. {
  639. case 11: case 21: case 31: case 41:
  640. pObj->RunText = VarToStr(pDcCell->Values[nCellIdx][ColIfscNm->Index]);
  641. pObj->SetRuntimeText(pObj->RunText);
  642. break;
  643. case 12: case 22: case 32: case 42:
  644. pObj->RunText = VarToStr(pDcCell->Values[nCellIdx][ColIfscStr->Index]);
  645. pObj->SetRuntimeText(pObj->RunText);
  646. break;
  647. case 13: case 23: case 33: case 43:
  648. pObj->RunText = VarToStr(pDcCell->Values[nCellIdx][ColIfscEnd->Index]);
  649. pObj->SetRuntimeText(pObj->RunText);
  650. break;
  651. }
  652. }
  653. }
  654. //---------------------------------------------------------------------------
  655. void __fastcall TVMSM810M::BtnListDeleteClick(TObject *Sender)
  656. {
  657. int nCellIdx = CMM_GetRecordIndex(TvObjList);
  658. if (nCellIdx < 0) return;
  659. TcxGridDataController *pDcCell = TvObjList->DataController;
  660. pDcCell->Values[nCellIdx][ColIfscId->Index] = "";
  661. pDcCell->Values[nCellIdx][ColIfscNm->Index] = "";
  662. pDcCell->Values[nCellIdx][ColIfscStr->Index] = "";
  663. pDcCell->Values[nCellIdx][ColIfscEnd->Index] = "";
  664. TVmsFormObject *pObj;
  665. int nObjCnt = m_pEdtDesigner->GetObjectCount();
  666. for(int ii = 0; ii < nObjCnt; ii++)
  667. {
  668. pObj = m_pEdtDesigner->GetObject(ii);
  669. if (!pObj) continue;
  670. if (!pObj->Selected) continue;
  671. int nObjType = pObj->ObjType.ToIntDef(0);
  672. switch(nObjType)
  673. {
  674. case 11: case 21: case 31: case 41:
  675. pObj->SetRuntimeText(pObj->Text);
  676. break;
  677. case 12: case 22: case 32: case 42:
  678. pObj->SetRuntimeText(pObj->Text);
  679. break;
  680. case 13: case 23: case 33: case 43:
  681. pObj->SetRuntimeText(pObj->Text);
  682. break;
  683. }
  684. }
  685. }
  686. //---------------------------------------------------------------------------
  687. void __fastcall TVMSM810M::BtnSaveClick(TObject *Sender)
  688. {
  689. TcxDataController *pGDC = TvObjList->DataController;
  690. #if 0
  691. FIfscId[0] = "";
  692. FIfscId[1] = "";
  693. FIfscId[2] = "";
  694. FIfscId[3] = "";
  695. #endif
  696. try
  697. {
  698. TvObjList->BeginUpdate();
  699. pGDC->BeginUpdate();
  700. int nRows = pGDC->RecordCount;
  701. try
  702. {
  703. for (int ii = 0; ii < nRows; ii++)
  704. {
  705. int nFormType = VarToStr(pGDC->Values[ii][ColObj01->Index]).ToIntDef(0);
  706. switch(nFormType)
  707. {
  708. case 11:// ' 소통상황(1단)
  709. FIfscId[0] = VarToStr(pGDC->Values[ii][ColIfscId->Index]);
  710. break;
  711. case 12:// ' 소통상황(2단)
  712. FIfscId[1] = VarToStr(pGDC->Values[ii][ColIfscId->Index]);
  713. break;
  714. case 13:// ' 소통상황(3단)
  715. FIfscId[2] = VarToStr(pGDC->Values[ii][ColIfscId->Index]);
  716. break;
  717. case 14:// ' 소통상황(4단)
  718. FIfscId[3] = VarToStr(pGDC->Values[ii][ColIfscId->Index]);
  719. break;
  720. }
  721. }
  722. }
  723. catch(Exception &e)
  724. {
  725. }
  726. }
  727. __finally
  728. {
  729. pGDC->EndUpdate();
  730. TvObjList->EndUpdate();
  731. }
  732. m_pEdtDesigner->GetVmsFormImage(ImgForm);
  733. FSelected = true;
  734. Close();
  735. }
  736. //---------------------------------------------------------------------------