FRAME_RepeatCongestListF.cpp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "FrmResourceF.h"
  6. #include "ITSLangTransF.h"
  7. #pragma hdrstop
  8. #include "FRAME_RepeatCongestListF.h"
  9. #include "CDSNodeF.h"
  10. #include "CDSLinkF.h"
  11. #include "CDSIfscF.h"
  12. //---------------------------------------------------------------------------
  13. #pragma package(smart_init)
  14. #pragma link "cxCalc"
  15. #pragma link "cxCheckBox"
  16. #pragma link "cxClasses"
  17. #pragma link "cxControls"
  18. #pragma link "cxCustomData"
  19. #pragma link "cxData"
  20. #pragma link "cxDataStorage"
  21. #pragma link "cxEdit"
  22. #pragma link "cxFilter"
  23. #pragma link "cxGraphics"
  24. #pragma link "cxGrid"
  25. #pragma link "cxGridCustomTableView"
  26. #pragma link "cxGridCustomView"
  27. #pragma link "cxGridLevel"
  28. #pragma link "cxGridTableView"
  29. #pragma link "cxLabel"
  30. #pragma link "cxLookAndFeelPainters"
  31. #pragma link "cxLookAndFeels"
  32. #pragma link "cxStyles"
  33. #pragma link "cxTextEdit"
  34. #pragma link "dxSkinBlack"
  35. #pragma link "dxSkinBlue"
  36. #pragma link "dxSkinsCore"
  37. #pragma link "dxSkinscxPCPainter"
  38. #pragma link "dxSkinMcSkin"
  39. #pragma resource "*.dfm"
  40. //TFRAMERepeatCongestList *FRAMERepeatCongestList;
  41. //---------------------------------------------------------------------------
  42. __fastcall TFRAMERepeatCongestList::TFRAMERepeatCongestList(TComponent* Owner)
  43. : TFrame(Owner)
  44. {
  45. LangTrans->Translate(this, ITSDb_GetConnection());
  46. m_pGDC = TvList->DataController;
  47. TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<현재 확정된 반복 정체구간이 없습니다>";
  48. FCodeRCS = ItsCodeManager->FLists.Find("RCS");
  49. FCodeDTW = ItsCodeManager->FLists.Find("DTW");
  50. FCodeLTC = ItsCodeManager->FLists.Find("LTC");
  51. FCodeIFD = ItsCodeManager->FLists.Find("IFD");
  52. }
  53. //---------------------------------------------------------------------------
  54. void __fastcall TFRAMERepeatCongestList::UpdateList()
  55. {
  56. TCDSTraffic *pTraf;
  57. TItsIfsc *pIfsc;
  58. TItsSubCode *pSubCode;
  59. CMM_ClearGridTableView(TvList);
  60. int nRow = 0;
  61. try
  62. {
  63. TvList->BeginUpdate();
  64. try
  65. {
  66. ItsRepeatCongestManager->FListsCnfm.Lock();
  67. FOR_STL(TItsRepeatCongest*, pRpLink, ItsRepeatCongestManager->FListsCnfm)
  68. {
  69. //링크기본정보
  70. pIfsc = ItsIfscManager->FLists.Find(pRpLink->IFSC_ID);
  71. if (!pIfsc) continue; //기본정보가 없는 것은 보여줄 필요가 없다.
  72. String sCurrAnsTm = "-";
  73. String sCurrSpeed = "-";
  74. String sCurrTrvTm = "-";
  75. //현재소통정보
  76. pTraf = pIfsc->TRAF;
  77. if (pTraf)
  78. {
  79. if (pTraf->MISSING != "Y")
  80. {
  81. sCurrAnsTm = pTraf->PRCN_DT;
  82. sCurrSpeed = pTraf->SPED;
  83. sCurrTrvTm = pTraf->TRVL_HH;
  84. }
  85. }
  86. #if 0
  87. String sDTW = "[" + pRpLink->DAY_TYPE_CD + "] "; //요일 유형 코드
  88. if (FCodeDTW)
  89. {
  90. pSubCode = FCodeDTW->FSubLists.Find(pRpLink->DAY_TYPE_CD);
  91. if (pSubCode) sDTW = sDTW + pSubCode->CMMN_CD_KOR_NM;
  92. }
  93. #endif
  94. #if 0
  95. String sRCS = "[" + pRpLink->REPT_CNGS_SECT_ORGN_CD + "] "; //반복 정체 구간 원본 코드
  96. if (FCodeRCS)
  97. {
  98. pSubCode = FCodeRCS->FSubLists.Find(pRpLink->REPT_CNGS_SECT_ORGN_CD);
  99. if (pSubCode) sRCS = sRCS + pSubCode->CMMN_CD_KOR_NM;
  100. }
  101. if (pRpLink->REPT_CNGS_SECT_ORGN_CD == "") sRCS = "";
  102. #endif
  103. if (sCurrAnsTm != "")
  104. sCurrAnsTm = ITSUtil_StrToTime(sCurrAnsTm);
  105. String sIFD = "[" + pIfsc->DRCT_CD + "] ";
  106. if (FCodeIFD)
  107. {
  108. pSubCode = FCodeIFD->FSubLists.Find(pIfsc->DRCT_CD); // 방향코드
  109. if (pSubCode) sIFD = sIFD + pSubCode->CMMN_CD_KOR_NM;
  110. }
  111. nRow = m_pGDC->AppendRecord();
  112. m_pGDC->Values[nRow][Column01->Index] = pIfsc->IFSC_ID; //'정보제공구간ID';
  113. m_pGDC->Values[nRow][Column02->Index] = pIfsc->IFSC_NM; //'정보제공구간 명'
  114. m_pGDC->Values[nRow][Column03->Index] = sIFD; //'방향 코드'
  115. m_pGDC->Values[nRow][Column04->Index] = pIfsc->STRT_NM; //'시점 명'
  116. m_pGDC->Values[nRow][Column05->Index] = pIfsc->END_NM; //'종점 명'
  117. m_pGDC->Values[nRow][Column06->Index] = pRpLink->AVRG_SPED; //'확정 평균통행속도';
  118. m_pGDC->Values[nRow][Column07->Index] = pRpLink->AVRG_TRVL_HH; //'확정 평균통행시간';
  119. m_pGDC->Values[nRow][Column08->Index] = sCurrAnsTm; //'소통정보가공시각';
  120. m_pGDC->Values[nRow][Column09->Index] = sCurrSpeed; //'현재 통행속도';
  121. m_pGDC->Values[nRow][Column10->Index] = sCurrTrvTm; //'현재 통행시간';
  122. m_pGDC->Values[nRow][Column20->Index] = FrmLang->lblRcTp0->Caption;//"평시";
  123. }
  124. }
  125. __finally
  126. {
  127. ItsRepeatCongestManager->FListsCnfm.UnLock();
  128. }
  129. }
  130. __finally
  131. {
  132. TvList->EndUpdate();
  133. TvList->DataController->GotoFirst();
  134. TvList->DataController->FocusedRecordIndex = 0;
  135. //CxList->SetFocus();
  136. }
  137. UpdateListWthr();
  138. }
  139. //---------------------------------------------------------------------------
  140. void __fastcall TFRAMERepeatCongestList::UpdateListWthr()
  141. {
  142. TCDSTraffic *pTraf;
  143. TItsIfsc *pIfsc;
  144. TItsSubCode *pSubCode;
  145. //CMM_ClearGridTableView(TvList);
  146. int nRow = 0;
  147. try
  148. {
  149. TvList->BeginUpdate();
  150. try
  151. {
  152. ItsRepeatCongestManager->FListsCnfmWthr.Lock();
  153. Column20->Visible = ItsRepeatCongestManager->FListsCnfmWthr.Size() > 0 ? true : false;
  154. FOR_STL(TItsRepeatCongestWthr*, pRpLink, ItsRepeatCongestManager->FListsCnfmWthr)
  155. {
  156. //링크기본정보
  157. pIfsc = ItsIfscManager->FLists.Find(pRpLink->IFSC_ID);
  158. if (!pIfsc) continue; //기본정보가 없는 것은 보여줄 필요가 없다.
  159. String sCurrAnsTm = "-";
  160. String sCurrSpeed = "-";
  161. String sCurrTrvTm = "-";
  162. //현재소통정보
  163. pTraf = pIfsc->TRAF;
  164. if (pTraf)
  165. {
  166. if (pTraf->MISSING != "Y")
  167. {
  168. sCurrAnsTm = pTraf->PRCN_DT;
  169. sCurrSpeed = pTraf->SPED;
  170. sCurrTrvTm = pTraf->TRVL_HH;
  171. }
  172. }
  173. #if 0
  174. String sDTW = "[" + pRpLink->DAY_TYPE_CD + "] "; //요일 유형 코드
  175. if (FCodeDTW)
  176. {
  177. pSubCode = FCodeDTW->FSubLists.Find(pRpLink->DAY_TYPE_CD);
  178. if (pSubCode) sDTW = sDTW + pSubCode->CMMN_CD_KOR_NM;
  179. }
  180. #endif
  181. #if 0
  182. String sRCS = "[" + pRpLink->REPT_CNGS_SECT_ORGN_CD + "] "; //반복 정체 구간 원본 코드
  183. if (FCodeRCS)
  184. {
  185. pSubCode = FCodeRCS->FSubLists.Find(pRpLink->REPT_CNGS_SECT_ORGN_CD);
  186. if (pSubCode) sRCS = sRCS + pSubCode->CMMN_CD_KOR_NM;
  187. }
  188. if (pRpLink->REPT_CNGS_SECT_ORGN_CD == "") sRCS = "";
  189. #endif
  190. if (sCurrAnsTm != "")
  191. sCurrAnsTm = ITSUtil_StrToTime(sCurrAnsTm);
  192. String sIFD = "[" + pIfsc->DRCT_CD + "] ";
  193. if (FCodeIFD)
  194. {
  195. pSubCode = FCodeIFD->FSubLists.Find(pIfsc->DRCT_CD); // 방향코드
  196. if (pSubCode) sIFD = sIFD + pSubCode->CMMN_CD_KOR_NM;
  197. }
  198. nRow = m_pGDC->AppendRecord();
  199. m_pGDC->Values[nRow][Column01->Index] = pIfsc->IFSC_ID; //'정보제공구간ID';
  200. m_pGDC->Values[nRow][Column02->Index] = pIfsc->IFSC_NM; //'정보제공구간 명'
  201. m_pGDC->Values[nRow][Column03->Index] = sIFD; //'방향 코드'
  202. m_pGDC->Values[nRow][Column04->Index] = pIfsc->STRT_NM; //'시점 명'
  203. m_pGDC->Values[nRow][Column05->Index] = pIfsc->END_NM; //'종점 명'
  204. m_pGDC->Values[nRow][Column06->Index] = pRpLink->AVRG_SPED; //'확정 평균통행속도';
  205. m_pGDC->Values[nRow][Column07->Index] = pRpLink->AVRG_TRVL_HH; //'확정 평균통행시간';
  206. m_pGDC->Values[nRow][Column08->Index] = sCurrAnsTm; //'소통정보가공시각';
  207. m_pGDC->Values[nRow][Column09->Index] = sCurrSpeed; //'현재 통행속도';
  208. m_pGDC->Values[nRow][Column10->Index] = sCurrTrvTm; //'현재 통행시간';
  209. m_pGDC->Values[nRow][Column20->Index] = FrmLang->lblRcTp1->Caption;//"기상";
  210. }
  211. }
  212. __finally
  213. {
  214. ItsRepeatCongestManager->FListsCnfmWthr.UnLock();
  215. }
  216. }
  217. __finally
  218. {
  219. TvList->EndUpdate();
  220. TvList->DataController->GotoFirst();
  221. TvList->DataController->FocusedRecordIndex = 0;
  222. //CxList->SetFocus();
  223. }
  224. }
  225. //---------------------------------------------------------------------------
  226. int __fastcall TFRAMERepeatCongestList::GetSelLinkIds(String &ALinkIds)
  227. {
  228. return 0;
  229. }
  230. //---------------------------------------------------------------------------
  231. void __fastcall TFRAMERepeatCongestList::Column20CustomDrawCell(TcxCustomGridTableView *Sender,
  232. TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  233. bool &ADone)
  234. {
  235. if (Column20->Visible == false) return;
  236. TColor tColor = ACanvas->Brush->Color;
  237. try
  238. {
  239. if (!VarIsNull(AViewInfo->Value))
  240. {
  241. String sValue = AViewInfo->Value;
  242. if (sValue == FrmLang->lblRcTp1->Caption)//"기상")
  243. {
  244. tColor = clFuchsia;
  245. }
  246. }
  247. ACanvas->Font->Color = clBlack;
  248. ACanvas->SetBrushColor(tColor);
  249. }
  250. catch(...)
  251. {
  252. }
  253. }
  254. //---------------------------------------------------------------------------