FRAME_RepeatCongestListF.cpp 10 KB

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