ITS0000MF.cpp 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "WindowMsgF.h"
  6. #include "CDSFacilityF.h"
  7. #include "CDSIncidentF.h"
  8. #include "FrmMainF.h"
  9. #include "ITSLangTransF.h"
  10. #include "ITSMapF.h"
  11. #include "CDSLayerF.h"
  12. #include "CDSNodeF.h"
  13. #include "CDSLinkF.h"
  14. #include "CDSIfscF.h"
  15. #include "CDSRoadF.h"
  16. #include "FrmCctvImgF.h"
  17. #include "FrmVmsMsgF.h"
  18. #include "FrmLinkInfoF.h"
  19. #include "FrmGisSearchF.h"
  20. #include "FrmStreamPlayerF.h"
  21. #include "FrmLinkInfoF.h"
  22. #include "FrmParkMsgF.h"
  23. #pragma hdrstop
  24. #include "ITS0000MF.h"
  25. //---------------------------------------------------------------------------
  26. #pragma package(smart_init)
  27. #pragma link "FRAME_FacilityStatusListF"
  28. #pragma link "FRAME_ProcessStatusListF"
  29. #pragma link "FRAME_IncidentListF"
  30. #pragma link "FRAME_RepeatCongestListF"
  31. #pragma link "FRAME_TrafficMissLinkListF"
  32. #pragma link "FRAME_IncidentAutoListF"
  33. #pragma link "cxClasses"
  34. #pragma link "cxContainer"
  35. #pragma link "cxControls"
  36. #pragma link "cxCustomData"
  37. #pragma link "cxData"
  38. #pragma link "cxDataStorage"
  39. #pragma link "cxEdit"
  40. #pragma link "cxFilter"
  41. #pragma link "cxGraphics"
  42. #pragma link "cxGrid"
  43. #pragma link "cxGridCustomTableView"
  44. #pragma link "cxGridCustomView"
  45. #pragma link "cxGridLevel"
  46. #pragma link "cxGridTableView"
  47. #pragma link "cxGroupBox"
  48. #pragma link "cxLabel"
  49. #pragma link "cxLookAndFeelPainters"
  50. #pragma link "cxLookAndFeels"
  51. #pragma link "cxPC"
  52. #pragma link "cxPCdxBarPopupMenu"
  53. #pragma link "cxSplitter"
  54. #pragma link "cxStyles"
  55. #pragma link "dxSkinBlack"
  56. #pragma link "dxSkinBlue"
  57. #pragma link "dxSkinsCore"
  58. #pragma link "dxSkinscxPCPainter"
  59. #pragma link "FRAME_DatabaseStatusF"
  60. #pragma link "FRAME_OpenMapF"
  61. #pragma link "cxButtons"
  62. #pragma link "cxCheckBox"
  63. #pragma link "cxTextEdit"
  64. #pragma link "cxProgressBar"
  65. #pragma link "dxGDIPlusClasses"
  66. #pragma link "FRAME_AtmpPltnListF"
  67. #pragma link "FRAME_VilgFrcsListF"
  68. #pragma link "FRAME_VilgShprListF"
  69. #pragma resource "*.dfm"
  70. TITS0000M *ITS0000M = NULL;
  71. //---------------------------------------------------------------------------
  72. TColor g_clrStatus[5] = {
  73. clGreen,
  74. clRed,
  75. clYellow,
  76. clBlack,//clSilver,
  77. clBlack,//clSilver,
  78. };
  79. String g_strStatus[5] = {
  80. "", "", "", "", "",
  81. };
  82. String g_strIncident[6] = {
  83. "", "사고", "공사", "행사", "기상", "기타",
  84. };
  85. TColor g_clrTraffic[4] = {
  86. clGray,
  87. clLime,
  88. clYellow,
  89. clRed,
  90. };
  91. String g_strTraffic[4] = {
  92. "", "", "", "",
  93. };
  94. //---------------------------------------------------------------------------
  95. String g_sTrafficSql[] = {
  96. "0*************************************************************************\r\n",
  97. "1*************************************************************************\r\n",
  98. "SELECT A.ROAD_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
  99. " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
  100. " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
  101. " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
  102. " FROM TB_ROAD A, \r\n"
  103. " (SELECT * \r\n"
  104. " FROM TB_ROAD_TRAF \r\n"
  105. " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
  106. " ) B \r\n"
  107. " WHERE A.ROAD_ID = B.ROAD_ID(+) \r\n",
  108. "SELECT A.IFSC_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
  109. " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
  110. " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
  111. " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
  112. " FROM TB_IFSC A, \r\n"
  113. " (SELECT * \r\n"
  114. " FROM TB_IFSC_TRAF \r\n"
  115. " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
  116. " ) B \r\n"
  117. " WHERE A.IFSC_ID = B.IFSC_ID(+) \r\n",
  118. "4************************************************************************\r\n",
  119. "SELECT A.LINK_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
  120. " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
  121. " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
  122. " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
  123. " FROM TB_LINK A, \r\n"
  124. " (SELECT * \r\n"
  125. " FROM TB_LINK_TRAF \r\n"
  126. " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
  127. " ) B \r\n"
  128. " WHERE A.LINK_ID = B.LINK_ID(+) \r\n",
  129. "6************************************************************************\r\n",
  130. };
  131. void TITS0000M_MapCallback(TObject *ASender, const String AFunc, const String AArgs, const bool AFirst)
  132. {
  133. try
  134. {
  135. if (!ITS0000M) return;
  136. ITS0000M->OpenMapCallback(ASender, AFunc, AArgs, AFirst);
  137. }
  138. catch(Exception &exception)
  139. {
  140. }
  141. }
  142. //---------------------------------------------------------------------------
  143. __fastcall TITS0000M::TITS0000M(TComponent* Owner)
  144. : TForm(Owner)
  145. {
  146. LangTrans->Translate(this, ITSDb_GetConnection());
  147. ITSSkin_Load(this);
  148. LoadLocalSkin();
  149. CMM_LoadForm(g_sFormsDir, this);
  150. GrpSystem->Caption = lblSysTab->Caption + " - " + TsIncident->Caption;//"▶ 시스템 운영 정보 - " + TsIncident->Caption;
  151. FRAMEFacilityStatusList1->PnlBottom->Visible = false;
  152. FRAMETrafficMissLinkList1->Column18->Visible = false;
  153. //FrmMain->dxStatusBar->Panels->Items[isbGisPos]->Visible = true;
  154. //시스템자동돌발
  155. FRAMEIncidentAutoList1->Visible = false;
  156. TsIncidentAuto->TabVisible = false;
  157. TsIncidentAuto->Visible = false;
  158. //기상-초단기예보
  159. FRAMEVilgShprList1->Visible = false;
  160. TsVilgShpr->TabVisible = false;
  161. TsVilgShpr->Visible = false;
  162. //기상-동네예보
  163. FRAMEVilgFrcsList1->Visible = false;
  164. TsVilgFrcs->TabVisible = false;
  165. TsVilgFrcs->Visible = false;
  166. TabDebug->TabVisible = false;
  167. TabDebug->Visible = false;
  168. reMsg->Lines->Clear();
  169. PgSystem->Properties->ActivePage = TsIncident;
  170. PgSystemOpr->Properties->ActivePage = TsFacilityOpr;
  171. FRAMEOpenMap1->PnlToolbar->Visible = false;
  172. FRAMEOpenMap1->MapCallbackFunc = TITS0000M_MapCallback;
  173. #ifdef USE_PARK
  174. ChkPark->Tag = LyrTp_Park;
  175. ChkPark->Visible = true;
  176. #else
  177. ChkPark->Visible = false;
  178. #endif
  179. }
  180. //---------------------------------------------------------------------------
  181. void __fastcall TITS0000M::CommClose()
  182. {
  183. try
  184. {
  185. if (FrmMain->dxStatusBar->Panels->Items[isbGisPos]->Visible)
  186. FrmMain->dxStatusBar->Panels->Items[isbGisPos]->Visible = false;
  187. CMM_SaveForm(g_sFormsDir, this);
  188. }
  189. catch(...)
  190. {
  191. }
  192. }
  193. //---------------------------------------------------------------------------
  194. void __fastcall TITS0000M::FormCreate(TObject *Sender)
  195. {
  196. //
  197. }
  198. //---------------------------------------------------------------------------
  199. void __fastcall TITS0000M::FormShow(TObject *Sender)
  200. {
  201. Refresh();
  202. FRAMEOpenMap1->OpenMap();
  203. Application->ProcessMessages();
  204. TmrShow->Enabled = true;
  205. }
  206. //---------------------------------------------------------------------------
  207. void __fastcall TITS0000M::LoadLocalSkin()
  208. {
  209. #define MAX_VIEW 12
  210. TcxGridTableView *pView[MAX_VIEW];
  211. TcxGrid *pGrid[MAX_VIEW];
  212. for (int ii = 0; ii < MAX_VIEW; ii++)
  213. {
  214. pGrid[ii] = NULL;
  215. pView[ii] = NULL;
  216. }
  217. pGrid[ 0] = FRAMEProcessStatusList1->CxList; //프로세스상태
  218. pGrid[ 1] = FRAMEFacilityStatusList1->CxList; //시설물상태
  219. #if 0
  220. pGrid[ 2] = NULL;
  221. pGrid[ 3] = NULL;
  222. #else
  223. pGrid[ 2] = FRAMEDatabaseStatus1->CxList;//FRAMEUtisStatusList1->CxUtisRun; //UTIS현황-운영현황
  224. //pGrid[ 3] = FRAMEUtisStatusList1->CxUtisRse; //UTIS현황-RSE상태현황
  225. #endif
  226. pGrid[ 4] = FRAMEIncidentList1->CxList; //돌발
  227. pGrid[ 5] = FRAMERepeatCongestList1->CxList; //반복정체구간
  228. pGrid[ 6] = FRAMETrafficMissLinkList1->CxList; //소통정보결측구간
  229. pGrid[ 7] = FRAMEIncidentAutoList1->CxList2; //소통정보결측구간
  230. //pGrid[ 8] = FRAMEBlackBoxEventList1->CxList; //블랙박스이벤트리스트
  231. pGrid[ 9] = FRAMEVilgFrcsList1->CxList; //기상정보리스트
  232. pGrid[10] = FRAMEVilgShprList1->CxList; //기상정보리스트(초단기예보)
  233. pGrid[11] = FRAMEAtmpPltnList1->CxList; //환경정보(대기오염)
  234. pView[ 0] = FRAMEProcessStatusList1->TvList;
  235. pView[ 1] = FRAMEFacilityStatusList1->TvList;
  236. #if 0
  237. pView[ 2] = NULL;
  238. pView[ 3] = NULL;
  239. #else
  240. pView[ 2] = FRAMEDatabaseStatus1->TvList;//FRAMEUtisStatusList1->TvUtisRun;
  241. //pView[ 3] = FRAMEUtisStatusList1->TvUtisRse;
  242. #endif
  243. pView[ 4] = FRAMEIncidentList1->TvList;
  244. pView[ 5] = FRAMERepeatCongestList1->TvList;
  245. pView[ 6] = FRAMETrafficMissLinkList1->TvList;
  246. pView[ 7] = FRAMEIncidentAutoList1->TvList2;
  247. //pView[ 8] = FRAMEBlackBoxEventList1->TvList;
  248. pView[ 9] = FRAMEVilgFrcsList1->TvList;
  249. pView[10] = FRAMEVilgShprList1->TvList;
  250. pView[11] = (TcxGridTableView*)FRAMEAtmpPltnList1->TvList;
  251. for (int ii = 0; ii < MAX_VIEW; ii++)
  252. {
  253. if (!pView[ii]) continue;
  254. //pGrid[ii]->LookAndFeel->SkinName = "McSkin";
  255. pView[ii]->Styles->Inactive = NULL;
  256. pView[ii]->Styles->ContentOdd = NULL;
  257. pView[ii]->Styles->ContentEven= NULL;
  258. pView[ii]->Styles->Selection = NULL;
  259. pView[ii]->OptionsSelection->CellSelect = false;
  260. }
  261. }
  262. //---------------------------------------------------------------------------
  263. void __fastcall TITS0000M::TmrShowTimer(TObject *Sender)
  264. {
  265. TmrShow->Enabled = false;
  266. // 상태바 표출
  267. PnlProgress->Left = (this->Width - PnlProgress->Width) / 2;
  268. PnlProgress->Top = (this->Height - PnlProgress->Height) / 2;
  269. PnlProgress->Top -= 50;
  270. PnlProgress->Visible = true;
  271. PbLoadMap->Properties->Text = lblGisStep1->Caption;//"지도 로딩 중...";
  272. Application->ProcessMessages();
  273. PbLoadMap->Position = 30;
  274. // 리스트 항목을 초기화한다.
  275. InitListData();
  276. }
  277. //---------------------------------------------------------------------------
  278. void __fastcall TITS0000M::InitListData()
  279. {
  280. FIncidentCnt = 0;
  281. FRrCongestCnt = 0;
  282. FMissLinkCnt = 0;
  283. FRAMEFacilityStatusList1->UpdateList();
  284. UpdateFacilityStatusTotal();
  285. FRAMEProcessStatusList1->UpdateList();
  286. if (GrpBottomUtis->Visible)
  287. {
  288. FRAMEDatabaseStatus1->UpdateList();
  289. //FRAMEUtisStatusList1->UpdateList();
  290. }
  291. if (FRAMEIncidentList1->Visible) FRAMEIncidentList1->UpdateList();
  292. if (FRAMERepeatCongestList1->Visible) FRAMERepeatCongestList1->UpdateList();
  293. if (FRAMETrafficMissLinkList1->Visible) FRAMETrafficMissLinkList1->UpdateList();
  294. if (FRAMEIncidentAutoList1->Visible) FRAMEIncidentAutoList1->UpdateList();
  295. //FRAMEBlackBoxEventList1->UpdateList();
  296. if (FRAMEVilgFrcsList1->Visible) FRAMEVilgFrcsList1->UpdateList();
  297. if (FRAMEVilgShprList1->Visible) FRAMEVilgShprList1->UpdateList();
  298. if (FRAMEAtmpPltnList1->Visible) FRAMEAtmpPltnList1->UpdateList();
  299. UpdateAlarmStatus();
  300. UpdateClctSystStts(); // 수집/가공현황 업데이트
  301. }
  302. //---------------------------------------------------------------------------
  303. void __fastcall TITS0000M::UpdateAlarmStatus()
  304. {
  305. String sAlarmMsg = "";
  306. FIncidentCnt = FRAMEIncidentList1->TvList->DataController->RecordCount;
  307. FRrCongestCnt = FRAMERepeatCongestList1->TvList->DataController->RecordCount;
  308. FMissLinkCnt = FRAMETrafficMissLinkList1->TvList->DataController->RecordCount;
  309. FIncidentAutoCnt = FRAMEIncidentAutoList1->TvList2->DataController->RecordCount;
  310. //FBlackBoxEventCnt = FRAMEBlackBoxEventList1->TvList->DataController->RecordCount;
  311. FVilgFrcsCnt1 = FRAMEVilgFrcsList1->GetAlarmCount1();
  312. FVilgFrcsCnt2 = FRAMEVilgFrcsList1->GetAlarmCount2();
  313. FVilgFrcsCnt3 = FRAMEVilgShprList1->GetAlarmCount();
  314. FAtmpPlntCnt = FRAMEAtmpPltnList1->GetAlarmCount();
  315. if (TsIncidentAuto->TabVisible == false)
  316. {
  317. FIncidentAutoCnt = 0;
  318. }
  319. if (TsVilgShpr->TabVisible == false)
  320. {
  321. FVilgFrcsCnt3 = 0;
  322. }
  323. if (TsVilgFrcs->TabVisible == false)
  324. {
  325. FVilgFrcsCnt1 = 0;
  326. FVilgFrcsCnt2 = 0;
  327. }
  328. if (TsAtmpPltn->TabVisible == false)
  329. {
  330. FAtmpPlntCnt = 0;
  331. }
  332. if (FIncidentCnt > 0)
  333. {
  334. sAlarmMsg += TsIncident->Caption + "(" + String(FIncidentCnt) + ") ";//"돌발상황(" + String(FIncidentCnt) + ") ";
  335. TsIncident->ImageIndex = 1;
  336. }
  337. else
  338. TsIncident->ImageIndex = 2;
  339. if (FRrCongestCnt > 0)
  340. {
  341. sAlarmMsg += TsRrCongest->Caption + "(" + String(FRrCongestCnt) + ") ";//"반복정체구간(" + String(FRrCongestCnt) + ") ";
  342. TsRrCongest->ImageIndex = 1;
  343. }
  344. else
  345. TsRrCongest->ImageIndex = 2;
  346. if (FMissLinkCnt > 0)
  347. {
  348. sAlarmMsg += TsMissingLink->Caption + "(" + String(FMissLinkCnt) + ") ";//"결측구간(" + String(FMissLinkCnt) + ") ";
  349. TsMissingLink->ImageIndex = 1;
  350. }
  351. else
  352. TsMissingLink->ImageIndex = 2;
  353. if (FIncidentAutoCnt > 0)
  354. {
  355. sAlarmMsg += TsIncidentAuto->Caption + "(" + String(FIncidentAutoCnt) + ") ";//"자동돌발(" + String(FIncidentAutoCnt) + ") ";
  356. TsIncidentAuto->ImageIndex = 1;
  357. }
  358. else
  359. TsIncidentAuto->ImageIndex = 2;
  360. if ((FVilgFrcsCnt1 + FVilgFrcsCnt2) > 0)
  361. {
  362. //sAlarmMsg += TsVilgFrcs->Caption + "(" + String(FVilgFrcsCnt1 + FVilgFrcsCnt2) + ") ";
  363. sAlarmMsg += TsVilgFrcs->Caption + " ";
  364. TsVilgFrcs->ImageIndex = 1;
  365. }
  366. else
  367. TsVilgFrcs->ImageIndex = 2;
  368. if ((FVilgFrcsCnt3) > 0)
  369. {
  370. //sAlarmMsg += TsVilgShpr->Caption + "(" + String(FVilgFrcsCnt3) + ") ";
  371. sAlarmMsg += TsVilgShpr->Caption + " ";
  372. TsVilgShpr->ImageIndex = 1;
  373. }
  374. else
  375. TsVilgShpr->ImageIndex = 2;
  376. if ((FAtmpPlntCnt) > 0)
  377. {
  378. sAlarmMsg += TsAtmpPltn->Caption + "(" + String(FAtmpPlntCnt) + ") ";
  379. TsAtmpPltn->ImageIndex = 1;
  380. }
  381. else
  382. TsAtmpPltn->ImageIndex = 2;
  383. LblAlarm->Caption = sAlarmMsg;
  384. if ((FIncidentCnt+FRrCongestCnt+FMissLinkCnt+FIncidentAutoCnt+FBlackBoxEventCnt+FVilgFrcsCnt1+FVilgFrcsCnt2+FVilgFrcsCnt3+FAtmpPlntCnt) > 0)
  385. {
  386. LblAlarm->Visible = true;
  387. }
  388. else
  389. {
  390. LblAlarm->Visible = false;
  391. }
  392. }
  393. //---------------------------------------------------------------------------
  394. void __fastcall TITS0000M::PgSystemPageChanging(TObject *Sender, TcxTabSheet *NewPage, bool &AllowChange)
  395. {
  396. GrpSystem->Caption = lblSysTab->Caption + " - " + NewPage->Caption;//"▶ 시스템 운영 정보 - " + NewPage->Caption;
  397. }
  398. //---------------------------------------------------------------------------
  399. void __fastcall TITS0000M::FormClose(TObject *Sender, TCloseAction &Action)
  400. {
  401. try {
  402. CommClose();
  403. ITS0000M = NULL;
  404. Action = caFree;
  405. } catch(...) {}
  406. }
  407. //---------------------------------------------------------------------------
  408. /*
  409. * 메인폼에서 데이터를 수신시 발생하는 이벤트 핸들러
  410. * arguments
  411. *
  412. * return
  413. * void
  414. */
  415. void __fastcall TITS0000M::OnMainFormMessage(TMessage &Msg)
  416. {
  417. switch(Msg.WParam)
  418. {
  419. case WP_DB_SELECT_OK:
  420. switch(Msg.LParam)
  421. {
  422. case LP_MSG_TRAFFIC: //소통정보 조회 완료
  423. DebugMsg("교통정보 업데이트");
  424. UpdateTrafficMissLinkInfo(); // 결측구간
  425. UpdateTrafficRrCongestInfo(); // 반복정체구간
  426. UpdateGisTraffic(); // 지도 소통정보 업데이트
  427. if (BtnRefresh->Enabled == false)
  428. {
  429. BtnRefresh->Enabled = true;
  430. }
  431. UpdateClctSystStts(); // 수집/가공현황 업데이트
  432. break;
  433. case LP_MSG_PROCESS_STTS: //프로세스 상태 조회 완료
  434. DebugMsg("프로세스 상태정보 업데이트");
  435. UpdateProcessStatusInfo();
  436. break;
  437. case LP_MSG_DATABASE_STTS: //데이터베이스 상태
  438. DebugMsg("데이터베이스 상태정보 업데이트");
  439. UpdateDatabaseStatusInfo();
  440. break;
  441. case LP_MSG_FACILITY_STTS: //시설물 상태 조회 완료
  442. DebugMsg("시설물 상태정보 업데이트");
  443. UpdateFacilityStatusInfo();
  444. break;
  445. case LP_MSG_INCIDENT: //돌발정보 조회 완료
  446. DebugMsg("돌발정보 업데이트");
  447. UpdateIncidentInfo();
  448. break;
  449. case LP_MSG_16: DebugMsg("블랙박스정보 로딩"); UpdateBlackBoxEventInfo(); break;
  450. case LP_MSG_WEATHER: DebugMsg("기상정보 로딩"); UpdateVilgFrcsInfo(); break;
  451. case LP_MSG_05: DebugMsg("UTIS 정보 로딩"); UpdateUtisStatusInfo(); break;
  452. case LP_MSG_14: DebugMsg("시설물정보 로딩"); UpdateFacilityInfo(); break;
  453. case LP_MSG_09: DebugMsg("프로세스정보 로딩"); FRAMEProcessStatusList1->UpdateList(); break;
  454. case LP_MSG_VMS_DSPLMSG: DebugMsg("VMS 표출 스케쥴 로딩"); UpdateVmsMsg(1); break;
  455. }
  456. break;
  457. case WP_MSG_01: //소통등급이 변경되었다.
  458. SetGisTrafficColor();
  459. break;
  460. case WP_MSG_02: //돌발정보를 현단말에서 취소/등록/해제 하였다.
  461. UpdateIncidentInfo();
  462. break;
  463. case WP_MSG_03: //시설물 기본정보가 변경됨
  464. UpdateFacilityInfo();
  465. break;
  466. case WP_DB_SELECT_ERROR:
  467. case WP_DB_SELECT_CANCEL:
  468. break;
  469. case WP_MSG_15:
  470. if (LP_MSG_15 == Msg.LParam)
  471. {
  472. RefreshGisLink();
  473. }
  474. break;
  475. }
  476. //TmrDebugHideTimer((TObject*)TmrDebugHide);
  477. }
  478. //---------------------------------------------------------------------------
  479. void __fastcall TITS0000M::UpdateTrafficMissLinkInfo()
  480. {
  481. FMissLinkCnt = 0;
  482. FRAMETrafficMissLinkList1->UpdateList();
  483. FRAMEIncidentAutoList1->UpdateList();
  484. UpdateAlarmStatus();
  485. }
  486. //---------------------------------------------------------------------------
  487. void __fastcall TITS0000M::UpdateTrafficRrCongestInfo()
  488. {
  489. FRrCongestCnt = 0;
  490. FRAMERepeatCongestList1->UpdateList();
  491. UpdateAlarmStatus();
  492. }
  493. //---------------------------------------------------------------------------
  494. void __fastcall TITS0000M::UpdateIncidentInfo()
  495. {
  496. FIncidentCnt = 0;
  497. FRAMEIncidentList1->UpdateList();
  498. FRAMEIncidentAutoList1->UpdateList();
  499. UpdateAlarmStatus();
  500. UpdateGisIncident();
  501. }
  502. //---------------------------------------------------------------------------
  503. void __fastcall TITS0000M::UpdateFacilityStatusInfo()
  504. {
  505. //FRAMEFacilityStatusList1->UpdateList();
  506. FRAMEFacilityStatusList1->RefreshList();
  507. UpdateFacilityStatusTotal();
  508. UpdateAlarmStatus();
  509. UpdateGisFacility();
  510. }
  511. //---------------------------------------------------------------------------
  512. void __fastcall TITS0000M::UpdateProcessStatusInfo()
  513. {
  514. FRAMEProcessStatusList1->RefreshList();
  515. UpdateAlarmStatus();
  516. }
  517. //---------------------------------------------------------------------------
  518. void __fastcall TITS0000M::UpdateUtisStatusInfo()
  519. {
  520. if (GrpBottomUtis->Visible)
  521. {
  522. //FRAMEUtisStatusList1->RefreshList();
  523. }
  524. }
  525. //---------------------------------------------------------------------------
  526. void __fastcall TITS0000M::UpdateDatabaseStatusInfo()
  527. {
  528. if (GrpBottomUtis->Visible)
  529. {
  530. FRAMEDatabaseStatus1->RefreshList();
  531. }
  532. }
  533. //---------------------------------------------------------------------------
  534. void __fastcall TITS0000M::UpdateFacilityInfo()
  535. {
  536. FRAMEFacilityStatusList1->UpdateList();
  537. UpdateFacilityStatusTotal();
  538. UpdateAlarmStatus();
  539. UpdateGisFacility(); //지도 시설물 재로딩
  540. }
  541. //---------------------------------------------------------------------------
  542. void __fastcall TITS0000M::UpdateBlackBoxEventInfo()
  543. {
  544. FBlackBoxEventCnt = 0;
  545. //FRAMEBlackBoxEventList1->UpdateList();
  546. UpdateAlarmStatus();
  547. }
  548. //---------------------------------------------------------------------------
  549. void __fastcall TITS0000M::UpdateVilgFrcsInfo()
  550. {
  551. FVilgFrcsCnt1 = 0;
  552. FVilgFrcsCnt2 = 0;
  553. FVilgFrcsCnt3 = 0;
  554. FAtmpPlntCnt = 0;
  555. FRAMEVilgFrcsList1->RefreshList();
  556. FRAMEVilgShprList1->RefreshList();
  557. FRAMEAtmpPltnList1->RefreshList();
  558. UpdateAlarmStatus();
  559. }
  560. //---------------------------------------------------------------------------
  561. void __fastcall TITS0000M::FRAMEIncidentList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  562. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  563. {
  564. //돌발 클릭
  565. if (!ACellViewInfo) return;
  566. try {
  567. TcxDataController *pGDC = FRAMEIncidentList1->TvList->DataController;
  568. int nRow = pGDC->FocusedRecordIndex;
  569. if (nRow < 0) return;
  570. String sId = VarToStr(pGDC->Values[nRow][FRAMEIncidentList1->Column01->Index]);
  571. String sDx = VarToStr(pGDC->Values[nRow][FRAMEIncidentList1->Column07->Index]);
  572. String sDy = VarToStr(pGDC->Values[nRow][FRAMEIncidentList1->Column08->Index]);
  573. SelectObjectByPos(StrToFloat(sDx), StrToFloat(sDy), true);
  574. } catch(...) {}
  575. }
  576. //---------------------------------------------------------------------------
  577. void __fastcall TITS0000M::FRAMERepeatCongestList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  578. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  579. {
  580. //반복정체구간 클릭
  581. if (!ACellViewInfo) return;
  582. try {
  583. TcxDataController *pGDC = FRAMERepeatCongestList1->TvList->DataController;
  584. int nRow = pGDC->FocusedRecordIndex;
  585. if (nRow < 0) return;
  586. String sSvcLinkId = VarToStr(pGDC->Values[nRow][FRAMERepeatCongestList1->Column01->Index]);
  587. SelectLinkById(2, sSvcLinkId, true);
  588. } catch(...) {}
  589. }
  590. //---------------------------------------------------------------------------
  591. void __fastcall TITS0000M::FRAMETrafficMissLinkList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  592. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  593. {
  594. //소통정보 결측구간 클릭
  595. if (!ACellViewInfo) return;
  596. try {
  597. TcxDataController *pGDC = FRAMETrafficMissLinkList1->TvList->DataController;
  598. int nRow = pGDC->FocusedRecordIndex;
  599. if (nRow < 0) return;
  600. String sLinkId = VarToStr(pGDC->Values[nRow][FRAMETrafficMissLinkList1->Column02->Index]);
  601. SelectLinkById(1, sLinkId, true);
  602. } catch(...) {}
  603. }
  604. //---------------------------------------------------------------------------
  605. void __fastcall TITS0000M::FRAMEFacilityStatusList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  606. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  607. {
  608. //시설물 위치이동
  609. if (!ACellViewInfo) return;
  610. try {
  611. TcxDataController *pGDC = FRAMEFacilityStatusList1->TvList->DataController;
  612. int nRow = pGDC->FocusedRecordIndex;
  613. if (nRow < 0) return;
  614. String sType = VarToStr(pGDC->Values[nRow][FRAMEFacilityStatusList1->Column01->Index]);
  615. FSelId = VarToStr(pGDC->Values[nRow][FRAMEFacilityStatusList1->Column02->Index]);
  616. if (sType == "CRSSVR") return;
  617. MoveGisFacility(sType, FSelId);
  618. } catch(...) {}
  619. }
  620. //---------------------------------------------------------------------------
  621. void __fastcall TITS0000M::MoveGisFacility(String AType, String AId)
  622. {
  623. if (!FRAMEOpenMap1->MapStart) return;
  624. int nLayerIdx = ItsLayerManager->GetLayerIndex(AType);
  625. if (nLayerIdx < 0) return;
  626. TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
  627. if (pFacility)
  628. {
  629. if (pFacility->Object)
  630. {
  631. sJs.printf(L"selectLayerObject(%d, '%s', %d)", nLayerIdx, pFacility->Object->CTLR_NMBR.c_str(), FRAMEOpenMap1->MapZoom);
  632. FRAMEOpenMap1->ExecScript(sJs);
  633. }
  634. }
  635. }
  636. //---------------------------------------------------------------------------
  637. void __fastcall TITS0000M::FRAMEFacilityStatusList1TvListCellClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  638. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  639. {
  640. if (AButton != mbRight) return;
  641. if (!ACellViewInfo) return;
  642. try {
  643. TcxDataController *pGDC = FRAMEFacilityStatusList1->TvList->DataController;
  644. int nRow = pGDC->FocusedRecordIndex;
  645. if (nRow < 0) return;
  646. String sType = VarToStr(pGDC->Values[nRow][FRAMEFacilityStatusList1->Column01->Index]);
  647. FSelId = VarToStr(pGDC->Values[nRow][FRAMEFacilityStatusList1->Column02->Index]);
  648. if (sType == "CRSSVR") return;
  649. int nLayerIndex = ItsLayerManager->GetLayerIndex(sType);
  650. OnMapPopupMenu(nLayerIndex, FSelId, true);
  651. } catch(...) {}
  652. }
  653. //---------------------------------------------------------------------------
  654. void __fastcall TITS0000M::pmuFacilityPopup(TObject *Sender)
  655. {
  656. TPopupMenu *pPopup = (TPopupMenu*)Sender;
  657. FSelMenuTag = pPopup->Tag;
  658. String sLayerType = ItsLayerManager->GetLayerType(FSelMenuTag);
  659. if (sLayerType == "") return;
  660. TItsFacility *pFacility = ItsFacilityManager->FLists.Find(FSelId);
  661. if (!pFacility) return;
  662. TCDSObject *pObj = pFacility->Object;
  663. if (!pObj) return;
  664. pPopup->Items->Items[0]->Caption = "[" + sLayerType + "] " + pObj->NAME;
  665. #if 0
  666. switch(pPopup->Tag)
  667. {
  668. case LyrTp_Cctv:
  669. break;
  670. case LyrTp_Vms:
  671. break;
  672. case LyrTp_Vds:
  673. break;
  674. case LyrTp_VdsDet:
  675. break;
  676. case LyrTp_VdsR:
  677. case LyrTp_VdsRDet:
  678. case LyrTp_VdsC:
  679. case LyrTp_VdsCDet:
  680. case LyrTp_Avi:
  681. case LyrTp_Rse:
  682. case LyrTp_Dsrc:
  683. case LyrTp_Park:
  684. case LyrTp_PVms:
  685. case LyrTp_Bit:
  686. case LyrTp_Sig:
  687. case LyrTp_SigDet:
  688. break;
  689. case LyrTp_WCam:
  690. break;
  691. case LyrTp_CCam:
  692. break;
  693. case LyrTp_Event:
  694. case LyrTp_Wthr:
  695. case LyrTp_Atmp:
  696. case LyrTp_Incd:
  697. break;
  698. }
  699. #endif
  700. }
  701. //---------------------------------------------------------------------------
  702. void __fastcall TITS0000M::mnuFacilityMoveClick(TObject *Sender)
  703. {
  704. TMenuItem *pMenu = (TMenuItem*)Sender;
  705. Application->ProcessMessages();
  706. String sLayerType = ItsLayerManager->GetLayerType(FSelMenuTag);
  707. if (sLayerType != "")
  708. {
  709. MoveGisFacility(sLayerType, FSelId);
  710. }
  711. }
  712. //---------------------------------------------------------------------------
  713. void __fastcall TITS0000M::mnuFacilityPingClick(TObject *Sender)
  714. {
  715. TMenuItem *pMenu = (TMenuItem*)Sender;
  716. Application->ProcessMessages();
  717. String sIp = "";
  718. TItsFacility *pFacility = ItsFacilityManager->FLists.Find(FSelId);
  719. if (!pFacility) return;
  720. TCDSObject *pObj = pFacility->Object;
  721. if (!pObj) return;
  722. if (pMenu->Tag == 21) //제어기 핑 테스트
  723. {
  724. sIp = pObj->CTLR_IP;
  725. }
  726. else
  727. if (pMenu->Tag == 22 && FSelMenuTag == LyrTp_Vms)
  728. {
  729. TVmsCtlr *pObj = (TVmsCtlr*)pObj;
  730. sIp = pObj->WEB_CMRA_IP;
  731. }
  732. if (sIp.IsEmpty())
  733. {
  734. Application->MessageBox(Label2->Caption.c_str(),//L"IP Address 정보가 없습니다.\r\nIP Address 정보를 확인하세요.",
  735. Label1->Caption.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  736. return;
  737. }
  738. else
  739. {
  740. ITSUtil_NetworkPing(sIp);
  741. }
  742. }
  743. //---------------------------------------------------------------------------
  744. void __fastcall TITS0000M::mnuStopImageClick(TObject *Sender)
  745. {
  746. Application->ProcessMessages();
  747. TPoint pt;
  748. GetCursorPos(&pt);
  749. pt = ScreenToClient(pt);
  750. ShowCctvStopImage(FSelId, pt);
  751. }
  752. //---------------------------------------------------------------------------
  753. void __fastcall TITS0000M::ShowCctvStopImage(String AId, TPoint pt)
  754. {
  755. TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
  756. if (!pFacility) return;
  757. TCctvCtlr *pObj = (TCctvCtlr*)pFacility->Object;
  758. if (!pObj) return;
  759. try {
  760. if (pObj->FData1)
  761. {
  762. TFrmCctvImg *pForm = (TFrmCctvImg *)pObj->FData1;
  763. pForm->SetFocus();
  764. pForm->LoadStopImage();
  765. }
  766. else
  767. {
  768. TFrmCctvImg *pForm = new TFrmCctvImg(ITS0000M);
  769. pForm->Parent = ITS0000M;
  770. if ((pt.x + pForm->Width + 5) > this->Width)
  771. {
  772. pt.x = this->Width - pForm->Width - 5;
  773. }
  774. if ((pt.y + pForm->Height + 5) > this->Height)
  775. {
  776. pt.y = this->Height - pForm->Height - 5;
  777. }
  778. pForm->Left = Left + pt.x;
  779. pForm->Top = Top + pt.y;
  780. pForm->FObj = pObj;
  781. pObj->FData2 = (void*)pForm;
  782. pForm->Show();
  783. }
  784. } catch(...) {}
  785. }
  786. //---------------------------------------------------------------------------
  787. void __fastcall TITS0000M::mnuCctvCamClick(TObject *Sender)
  788. {
  789. Application->ProcessMessages();
  790. TPoint pt;
  791. GetCursorPos(&pt);
  792. pt = ITS0000M->ScreenToClient(pt);
  793. ShowCctvCamera(FSelId, pt);
  794. }
  795. //---------------------------------------------------------------------------
  796. void __fastcall TITS0000M::ShowCctvCamera(String AId, TPoint pt)
  797. {
  798. TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
  799. if (!pFacility) return;
  800. TCctvCtlr *pObj = (TCctvCtlr*)pFacility->Object;
  801. if (!pObj) return;
  802. try {
  803. if (pObj->FData1)
  804. {
  805. TFrmStreamPlayer *pForm = (TFrmStreamPlayer *)pObj->FData1;
  806. pForm->SetFocus();
  807. }
  808. else
  809. {
  810. TFrmStreamPlayer *pForm = new TFrmStreamPlayer(ITS0000M);
  811. pForm->FObj.IsCctv = true;
  812. pForm->FObj.ID = pObj->CCTV_CTLR_ID;
  813. pForm->FObj.NAME = pObj->CCTV_NM;
  814. pForm->FObj.RTSP_ADDR = pObj->STRM_SESN_NM;
  815. pForm->FObj.Data = (TCDSObject*)pObj;
  816. pForm->FObj.Installed = true;
  817. pForm->Parent = ITS0000M;
  818. if ((pt.x + pForm->Width + 5) > this->Width)
  819. {
  820. pt.x = this->Width - pForm->Width - 5;
  821. }
  822. if ((pt.y + pForm->Height + 5) > this->Height)
  823. {
  824. pt.y = this->Height - pForm->Height - 5;
  825. }
  826. pForm->Left = Left + pt.x;
  827. pForm->Top = Top + pt.y;
  828. pObj->FData1 = (void*)pForm;
  829. pForm->Show();
  830. }
  831. } catch(...) {}
  832. }
  833. //---------------------------------------------------------------------------
  834. void __fastcall TITS0000M::mnuVmsMsgClick(TObject *Sender)
  835. {
  836. Application->ProcessMessages();
  837. TPoint pt;
  838. GetCursorPos(&pt);
  839. pt = ITS0000M->ScreenToClient(pt);
  840. ShowVmsMessage(FSelId, pt);
  841. }
  842. //---------------------------------------------------------------------------
  843. void __fastcall TITS0000M::UpdateVmsMsg(int AType)
  844. {
  845. try
  846. {
  847. FOR_STL(TVmsCtlr*, pObj, VmsCtlrManager->FLists)
  848. {
  849. if (pObj->DEL_YN == "Y") continue;
  850. if (pObj->FData2)
  851. {
  852. TFrmVmsMsg *pForm = (TFrmVmsMsg *)pObj->FData2;
  853. if (AType == 1)
  854. pForm->VmsFormReload();
  855. else
  856. pForm->VmsFormReload();
  857. }
  858. }
  859. }
  860. catch(Exception &e)
  861. {
  862. }
  863. }
  864. //---------------------------------------------------------------------------
  865. void __fastcall TITS0000M::ShowVmsMessage(String AId, TPoint pt)
  866. {
  867. TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
  868. if (!pFacility) return;
  869. TVmsCtlr *pObj = (TVmsCtlr*)pFacility->Object;
  870. if (!pObj) return;
  871. try {
  872. if (pObj->FData2)
  873. {
  874. TFrmVmsMsg *pForm = (TFrmVmsMsg *)pObj->FData2;
  875. pForm->SetFocus();
  876. }
  877. else
  878. {
  879. TFrmVmsMsg *pForm = new TFrmVmsMsg(ITS0000M, pObj);
  880. pForm->Parent = ITS0000M;
  881. int nHG = pForm->ClientHeight - pForm->PnlVmsMsgDisp->Height;
  882. int nWG = pForm->ClientWidth - pForm->PnlVmsMsgDisp->Width;
  883. #if 0
  884. pForm->ClientHeight = nHG + pObj->Height;
  885. pForm->ClientWidth = nWG + pObj->Width;
  886. #endif
  887. if ((pt.x + pForm->Width + 5) > this->Width)
  888. {
  889. pt.x = this->Width - pForm->Width - 5;
  890. }
  891. if ((pt.y + pForm->Height + 5) > this->Height)
  892. {
  893. pt.y = this->Height - pForm->Height - 5;
  894. }
  895. pForm->Left = Left + pt.x;
  896. pForm->Top = Top + pt.y;
  897. pObj->FData2 = (void*)pForm;
  898. pForm->Show();
  899. }
  900. } catch(...) {}
  901. }
  902. //---------------------------------------------------------------------------
  903. void __fastcall TITS0000M::mnuVmsCamClick(TObject *Sender)
  904. {
  905. Application->ProcessMessages();
  906. TPoint pt;
  907. GetCursorPos(&pt);
  908. pt = ITS0000M->ScreenToClient(pt);
  909. ShowVmsCamera(FSelId, pt);
  910. }
  911. //---------------------------------------------------------------------------
  912. void __fastcall TITS0000M::ShowVmsCamera(String AId, TPoint pt)
  913. {
  914. TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
  915. if (!pFacility) return;
  916. TVmsCtlr *pObj = (TVmsCtlr*)pFacility->Object;
  917. if (!pObj) return;
  918. try {
  919. if (pObj->FData1)
  920. {
  921. TFrmStreamPlayer *pForm = (TFrmStreamPlayer *)pObj->FData1;
  922. pForm->SetFocus();
  923. }
  924. else
  925. {
  926. TFrmStreamPlayer *pForm = new TFrmStreamPlayer(ITS0000M);
  927. pForm->FObj.IsCctv = false;
  928. pForm->FObj.ID = pObj->VMS_CTLR_ID;
  929. pForm->FObj.NAME = pObj->VMS_NM;
  930. pForm->FObj.RTSP_ADDR = pObj->STRM_SESN_NM;
  931. pForm->FObj.Data = (TCDSObject*)pObj;
  932. pForm->FObj.Installed = true;
  933. pForm->Parent = ITS0000M;
  934. if ((pt.x + pForm->Width + 5) > this->Width)
  935. {
  936. pt.x = this->Width - pForm->Width - 5;
  937. }
  938. if ((pt.y + pForm->Height + 5) > this->Height)
  939. {
  940. pt.y = this->Height - pForm->Height - 5;
  941. }
  942. pForm->Left = Left + pt.x;
  943. pForm->Top = Top + pt.y;
  944. pObj->FData1 = (void*)pForm;
  945. pForm->Show();
  946. }
  947. } catch(...) {}
  948. }
  949. //---------------------------------------------------------------------------
  950. void __fastcall TITS0000M::MnuWebCamClick(TObject *Sender)
  951. {
  952. Application->ProcessMessages();
  953. TPoint pt;
  954. GetCursorPos(&pt);
  955. pt = ITS0000M->ScreenToClient(pt);
  956. ShowWebCamera(FSelId, pt);
  957. }
  958. //---------------------------------------------------------------------------
  959. void __fastcall TITS0000M::ShowWebCamera(String AId, TPoint pt)
  960. {
  961. TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
  962. if (!pFacility) return;
  963. TWCamCtlr *pObj = (TWCamCtlr*)pFacility->Object;
  964. if (!pObj) return;
  965. try {
  966. if (pObj->FData1)
  967. {
  968. TFrmStreamPlayer *pForm = (TFrmStreamPlayer *)pObj->FData1;
  969. pForm->SetFocus();
  970. }
  971. else
  972. {
  973. TFrmStreamPlayer *pForm = new TFrmStreamPlayer(ITS0000M);
  974. pForm->FObj.IsCctv = false;
  975. pForm->FObj.ID = pObj->WCAM_CTLR_ID;
  976. pForm->FObj.NAME = pObj->WCAM_NM;
  977. pForm->FObj.RTSP_ADDR = pObj->STRM_SESN_NM;
  978. pForm->FObj.Data = (TCDSObject*)pObj;
  979. pForm->FObj.Installed = true;
  980. pForm->Parent = ITS0000M;
  981. if ((pt.x + pForm->Width + 5) > this->Width)
  982. {
  983. pt.x = this->Width - pForm->Width - 5;
  984. }
  985. if ((pt.y + pForm->Height + 5) > this->Height)
  986. {
  987. pt.y = this->Height - pForm->Height - 5;
  988. }
  989. pForm->Left = Left + pt.x;
  990. pForm->Top = Top + pt.y;
  991. pObj->FData1 = (void*)pForm;
  992. pForm->Show();
  993. }
  994. } catch(...) {}
  995. }
  996. //---------------------------------------------------------------------------
  997. void __fastcall TITS0000M::MnuCrsCamClick(TObject *Sender)
  998. {
  999. Application->ProcessMessages();
  1000. TPoint pt;
  1001. GetCursorPos(&pt);
  1002. pt = ITS0000M->ScreenToClient(pt);
  1003. ShowCrsCamera(FSelId, pt);
  1004. }
  1005. //---------------------------------------------------------------------------
  1006. void __fastcall TITS0000M::ShowCrsCamera(String AId, TPoint pt)
  1007. {
  1008. TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
  1009. if (!pFacility) return;
  1010. TCCamCtlr *pObj = (TCCamCtlr*)pFacility->Object;
  1011. if (!pObj) return;
  1012. try {
  1013. if (pObj->FData1)
  1014. {
  1015. TFrmStreamPlayer *pForm = (TFrmStreamPlayer *)pObj->FData1;
  1016. pForm->SetFocus();
  1017. }
  1018. else
  1019. {
  1020. TFrmStreamPlayer *pForm = new TFrmStreamPlayer(ITS0000M);
  1021. pForm->FObj.IsCctv = false;
  1022. pForm->FObj.ID = pObj->CCAM_CTLR_ID;
  1023. pForm->FObj.NAME = pObj->CCAM_NM;
  1024. pForm->FObj.RTSP_ADDR = pObj->STRM_SESN_NM;
  1025. pForm->FObj.Data = (TCDSObject*)pObj;
  1026. pForm->FObj.Installed = true;
  1027. pForm->Parent = ITS0000M;
  1028. if ((pt.x + pForm->Width + 5) > this->Width)
  1029. {
  1030. pt.x = this->Width - pForm->Width - 5;
  1031. }
  1032. if ((pt.y + pForm->Height + 5) > this->Height)
  1033. {
  1034. pt.y = this->Height - pForm->Height - 5;
  1035. }
  1036. pForm->Left = Left + pt.x;
  1037. pForm->Top = Top + pt.y;
  1038. pObj->FData1 = (void*)pForm;
  1039. pForm->Show();
  1040. }
  1041. } catch(...) {}
  1042. }
  1043. //---------------------------------------------------------------------------
  1044. void __fastcall TITS0000M::FRAMEIncidentAutoList1TvList2CellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  1045. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  1046. {
  1047. //소통정보 결측구간 클릭
  1048. if (!ACellViewInfo) return;
  1049. try {
  1050. TcxDataController *pGDC = FRAMEIncidentAutoList1->TvList2->DataController;
  1051. int nRow = pGDC->FocusedRecordIndex;
  1052. if (nRow < 0) return;
  1053. String sLinkId = VarToStr(pGDC->Values[nRow][FRAMEIncidentAutoList1->ColumnA01->Index]);
  1054. SelectLinkById(1, sLinkId, true);
  1055. } catch(...) {}
  1056. }
  1057. //---------------------------------------------------------------------------
  1058. void __fastcall TITS0000M::UpdateFacilityStatusTotal()
  1059. {
  1060. int nRow = 0;
  1061. try
  1062. {
  1063. CMM_ClearGridTableView(TvStatus);
  1064. TcxDataController *pGDC = TvStatus->DataController;
  1065. TvStatus->BeginUpdate();
  1066. ItsFacilityManager->FListStatus.Lock();
  1067. try
  1068. {
  1069. FOR_STL(TFacilityStatus*, pStatus, ItsFacilityManager->FListStatus)
  1070. {
  1071. nRow = pGDC->AppendRecord();
  1072. if (pStatus->Type == "CCAM")
  1073. pGDC->Values[nRow][ColName->Index] = "교차로감시";
  1074. else
  1075. if (pStatus->Type == "WCAM")
  1076. pGDC->Values[nRow][ColName->Index] = "CCTV(웹카메라)";
  1077. else
  1078. if (pStatus->Type == "CRSSVR")
  1079. {
  1080. pGDC->Values[nRow][ColName->Index] = "교차로분석서버";
  1081. }
  1082. else
  1083. if (pStatus->Type == "PARK")
  1084. {
  1085. pGDC->Values[nRow][ColName->Index] = "주차장";
  1086. }
  1087. else
  1088. pGDC->Values[nRow][ColName->Index] = pStatus->Type;
  1089. pGDC->Values[nRow][ColTotal->Index] = pStatus->Total;
  1090. pGDC->Values[nRow][ColNormal->Index] = pStatus->Total - pStatus->Error;
  1091. pGDC->Values[nRow][ColFail->Index] = pStatus->Error;
  1092. if (pStatus->Type == "VDS" || pStatus->Type == "AVI" || pStatus->Type == "DSRC")
  1093. pGDC->Values[nRow][ColModule->Index] = pStatus->Collect;//Module;
  1094. else
  1095. pGDC->Values[nRow][ColModule->Index] = "-";
  1096. }
  1097. }
  1098. catch(Exception &exception)
  1099. {
  1100. }
  1101. }
  1102. __finally
  1103. {
  1104. ItsFacilityManager->FListStatus.UnLock();
  1105. TvStatus->EndUpdate();
  1106. }
  1107. }
  1108. //---------------------------------------------------------------------------
  1109. void __fastcall TITS0000M::UpdateClctSystStts()
  1110. {
  1111. int nRow = 0;
  1112. CMM_ClearGridTableView(TvClctStts);
  1113. TcxDataController *pGDC = TvClctStts->DataController;
  1114. TvClctStts->BeginUpdate();
  1115. ItsLinkManager->FClctSystStts.Lock();
  1116. try
  1117. {
  1118. try
  1119. {
  1120. FOR_STL(TClctSystStts*, pObj, ItsLinkManager->FClctSystStts)
  1121. {
  1122. nRow = pGDC->AppendRecord();
  1123. pGDC->Values[nRow][Column1->Index] = pObj->CLCT_SYST_NM;
  1124. pGDC->Values[nRow][Column2->Index] = ITSUtil_FormatStr(pObj->PRCN_DT, STR_DATETIME);
  1125. if (pObj->IsCollected)
  1126. {
  1127. pGDC->Values[nRow][Column3->Index] = FormatFloat("##,##0", pObj->CLCT_NUM);
  1128. pGDC->Values[nRow][Column4->Index] = FormatFloat("##,##0", pObj->FLTR_NUM);
  1129. pGDC->Values[nRow][Column5->Index] = FormatFloat("##,##0", pObj->FUSN_NUM);
  1130. }
  1131. else
  1132. {
  1133. pGDC->Values[nRow][Column3->Index] = "-";
  1134. pGDC->Values[nRow][Column4->Index] = "-";
  1135. pGDC->Values[nRow][Column5->Index] = "-";
  1136. }
  1137. }
  1138. }
  1139. catch(Exception &exception)
  1140. {
  1141. }
  1142. }
  1143. __finally
  1144. {
  1145. ItsLinkManager->FClctSystStts.UnLock();
  1146. TvClctStts->EndUpdate();
  1147. }
  1148. }
  1149. //---------------------------------------------------------------------------
  1150. void __fastcall TITS0000M::ColNameCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas,
  1151. TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone)
  1152. {
  1153. // 장비명
  1154. if (AViewInfo->GridRecord->RecordIndex < 0) return;
  1155. ACanvas->Font->Style = TFontStyles() << fsBold;
  1156. }
  1157. //---------------------------------------------------------------------------
  1158. void __fastcall TITS0000M::ColTotalCustomDrawCell(TcxCustomGridTableView *Sender,
  1159. TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  1160. bool &ADone)
  1161. {
  1162. // 전체
  1163. if (AViewInfo->GridRecord->RecordIndex < 0) return;
  1164. ACanvas->Font->Style = TFontStyles() << fsBold;
  1165. }
  1166. //---------------------------------------------------------------------------
  1167. void __fastcall TITS0000M::ColNormalCustomDrawCell(TcxCustomGridTableView *Sender,
  1168. TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  1169. bool &ADone)
  1170. {
  1171. // 정상
  1172. if (AViewInfo->GridRecord->RecordIndex < 0) return;
  1173. ACanvas->Font->Style = TFontStyles() << fsBold;
  1174. }
  1175. //---------------------------------------------------------------------------
  1176. void __fastcall TITS0000M::ColFailCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas,
  1177. TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone)
  1178. {
  1179. // 이상
  1180. if (AViewInfo->GridRecord->RecordIndex < 0) return;
  1181. ACanvas->Font->Style = TFontStyles() << fsBold;
  1182. if (!VarIsNull(AViewInfo->GridRecord->DisplayTexts[ColFail->Index]))
  1183. {
  1184. String sErr = AViewInfo->GridRecord->DisplayTexts[ColFail->Index];
  1185. if (sErr != "0")
  1186. {
  1187. ACanvas->Font->Color = clRed;
  1188. }
  1189. }
  1190. }
  1191. //---------------------------------------------------------------------------
  1192. void __fastcall TITS0000M::ColModuleCustomDrawCell(TcxCustomGridTableView *Sender,
  1193. TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  1194. bool &ADone)
  1195. {
  1196. // 이상
  1197. if (AViewInfo->GridRecord->RecordIndex < 0) return;
  1198. ACanvas->Font->Style = TFontStyles() << fsBold;
  1199. if (!VarIsNull(AViewInfo->GridRecord->DisplayTexts[ColModule->Index]))
  1200. {
  1201. String sErr = AViewInfo->GridRecord->DisplayTexts[ColModule->Index];
  1202. if (sErr.Trim() == "-")
  1203. return;
  1204. if (sErr != "0")
  1205. {
  1206. ACanvas->Font->Color = clRed;
  1207. }
  1208. }
  1209. }
  1210. //---------------------------------------------------------------------------
  1211. void __fastcall TITS0000M::TvStatusCustomDrawCell(TcxCustomGridTableView *Sender,
  1212. TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  1213. bool &ADone)
  1214. {
  1215. if (AViewInfo->GridRecord->Selected)
  1216. {
  1217. //ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentColor();
  1218. //ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
  1219. if (AViewInfo->GridRecord->Index % 2 == 0)
  1220. {
  1221. ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentEvenColor();
  1222. ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
  1223. }
  1224. else
  1225. {
  1226. ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentOddColor();
  1227. ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
  1228. }
  1229. }
  1230. }
  1231. //---------------------------------------------------------------------------
  1232. void __fastcall TITS0000M::BtnMapToJpgClick(TObject *Sender)
  1233. {
  1234. FRAMEOpenMap1->BtnMapToJpgClick(Sender);
  1235. }
  1236. //---------------------------------------------------------------------------
  1237. void __fastcall TITS0000M::BtnMoveDefBoundsClick(TObject *Sender)
  1238. {
  1239. FRAMEOpenMap1->BtnMoveDefBoundsClick(Sender);
  1240. }
  1241. //---------------------------------------------------------------------------
  1242. void __fastcall TITS0000M::BtnZoomInClick(TObject *Sender)
  1243. {
  1244. FRAMEOpenMap1->BtnZoomInClick(Sender);
  1245. }
  1246. //---------------------------------------------------------------------------
  1247. void __fastcall TITS0000M::BtnZoomOutClick(TObject *Sender)
  1248. {
  1249. FRAMEOpenMap1->BtnZoomOutClick(Sender);
  1250. }
  1251. //---------------------------------------------------------------------------
  1252. void __fastcall TITS0000M::BtnMapSelectClick(TObject *Sender)
  1253. {
  1254. if (FRAMEOpenMap1->MapStart)
  1255. {
  1256. sJs.printf(L"selectMode(%d)", BtnMapSelect->Down ? 1 : 0);
  1257. FRAMEOpenMap1->ExecScript(sJs);
  1258. sJs.printf(L"setMouseClick(%d)", (BtnMapSelect->Down) ? 1: 0);
  1259. FRAMEOpenMap1->ExecScript(sJs);
  1260. }
  1261. }
  1262. //---------------------------------------------------------------------------
  1263. void __fastcall TITS0000M::BtnRefreshClick(TObject *Sender)
  1264. {
  1265. if (FRAMEOpenMap1->MapStart)
  1266. {
  1267. FrmMain->FPollStatus01.Reset(); // 시설물상태정보
  1268. FrmMain->FPollStatus02.Reset(); // 프로세스상태정보
  1269. FrmMain->FPollStatus03.Reset(); // 돌발정보
  1270. FrmMain->FPollTraffic00.Reset(); // 링크소통정보(전체)
  1271. FrmMain->FPollTraffic05.Reset(); // UTIS운영정보
  1272. FrmMain->FPollDatabase.Reset(); // 데이터베이스 상태
  1273. FrmMain->FPollEvent01.Reset(); // 블랙박스이벤트
  1274. FrmMain->FPollVilgFrcs.Reset(); // 기상정보
  1275. BtnRefresh->Enabled = false;
  1276. //TmrRefresh->Enabled = true;
  1277. }
  1278. }
  1279. //---------------------------------------------------------------------------
  1280. void __fastcall TITS0000M::TmrRefreshTimer(TObject *Sender)
  1281. {
  1282. TmrRefresh->Enabled = false;
  1283. BtnRefresh->Enabled = true;
  1284. }
  1285. //---------------------------------------------------------------------------
  1286. void __fastcall TITS0000M::UpdateGisIncident()
  1287. {
  1288. if (!FRAMEOpenMap1->MapStart) return;
  1289. sJs.printf(L"removeLayerObject(%d)", LyrTp_Incd);
  1290. FRAMEOpenMap1->ExecScript(sJs);
  1291. int nStatus;
  1292. String ROAD_NAME = " ";
  1293. String arrObj = "";
  1294. String sTemp;
  1295. try
  1296. {
  1297. ItsIncidentManager->FLists.Lock();
  1298. FOR_STL(TItsIncident *, pObj, ItsIncidentManager->FLists)
  1299. {
  1300. if (pObj->DISP_INCD == "N") continue;
  1301. if (pObj->INCD_PRGR_STEP_CD == "ISS2")
  1302. {
  1303. ROAD_NAME = "";
  1304. TItsLink *pLink = ItsLinkManager->FLists.Find(pObj->LINK_ID);
  1305. if (pLink)
  1306. {
  1307. ROAD_NAME = pLink->ROAD_NAME;
  1308. }
  1309. nStatus = pObj->INCD_TYPE_CLSF_CD.ToIntDef(1);
  1310. if (nStatus > 4 || nStatus < 1) nStatus = 1;
  1311. if (arrObj != "") arrObj += "|";
  1312. sTemp.printf(L"%s,%s,%s,%s,%s,%s,%s,%s,%d,%s,%s,%s,%s",
  1313. pObj->INCD_OCRR_ID.c_str(),
  1314. pObj->X_CRDN.c_str(),
  1315. pObj->Y_CRDN.c_str(),
  1316. ITSUtil_StrToTime(pObj->RGST_DT).c_str(),
  1317. ITSUtil_StrToTime(pObj->INCD_STRT_DT).c_str(),
  1318. ITSUtil_StrToTime(pObj->INCD_END_PRAR_DT).c_str(),
  1319. ROAD_NAME.c_str(),
  1320. pObj->INCD_TITL.c_str(),
  1321. nStatus,
  1322. g_strIncident[nStatus].c_str(),
  1323. pObj->OCRR_LCTN_NM.c_str(),
  1324. pObj->INCD_EXPL.c_str(),
  1325. pObj->LINK_ID.c_str());
  1326. arrObj += sTemp;
  1327. }
  1328. }
  1329. }
  1330. __finally
  1331. {
  1332. ItsIncidentManager->FLists.UnLock();
  1333. }
  1334. if (arrObj != "")
  1335. {
  1336. sJs.printf(L"addIncident('%s')", arrObj.c_str());
  1337. FRAMEOpenMap1->ExecScript(sJs);
  1338. }
  1339. }
  1340. //---------------------------------------------------------------------------
  1341. void __fastcall TITS0000M::UpdateGisFacility()
  1342. {
  1343. if (!FRAMEOpenMap1->MapStart) return;
  1344. FOR_STL(TLayerIdx*, pLayer, ItsLayerManager->FFacilityLayers)
  1345. {
  1346. pLayer->arrObj = "";
  1347. }
  1348. String sTemp;
  1349. TCDSObject *pObj;
  1350. TLayerIdx *pLayer;
  1351. ItsFacilityManager->FLists.Lock();
  1352. try
  1353. {
  1354. FOR_STL(TItsFacility*, pFacility, ItsFacilityManager->FLists)
  1355. {
  1356. if (pFacility->FOldComm == pFacility->FComm)
  1357. continue;
  1358. pObj = pFacility->Object;
  1359. if (pObj == NULL)
  1360. {
  1361. continue;
  1362. }
  1363. if (pFacility->FCLT_TYPE == "VDS" && pFacility->FCLT_KIND == "C")
  1364. {
  1365. continue;
  1366. }
  1367. pLayer = ItsLayerManager->FFacilityLayers.Find(pFacility->FCLT_TYPE);
  1368. if (pLayer)
  1369. {
  1370. if (pLayer->arrObj != "") pLayer->arrObj += "|";
  1371. sTemp.printf(L"%s,%d", pObj->CTLR_NMBR.c_str(), pFacility->FComm.ToIntDef(2));
  1372. pLayer->arrObj += sTemp;
  1373. }
  1374. pFacility->FOldComm = pFacility->FComm;
  1375. }
  1376. }
  1377. __finally
  1378. {
  1379. ItsFacilityManager->FLists.UnLock();
  1380. }
  1381. FOR_STL(TLayerIdx*, pLayer, ItsLayerManager->FFacilityLayers)
  1382. {
  1383. if (pLayer->arrObj != "")
  1384. {
  1385. sJs.printf(L"updateFacility(%d, '%s')", pLayer->Index, pLayer->arrObj.c_str());
  1386. FRAMEOpenMap1->ExecScript(sJs);
  1387. pLayer->arrObj = "";
  1388. }
  1389. }
  1390. }
  1391. //---------------------------------------------------------------------------
  1392. void __fastcall TITS0000M::InitGisFacility()
  1393. {
  1394. if (!FRAMEOpenMap1->MapStart) return;
  1395. FOR_STL(TLayerIdx*, pLayer, ItsLayerManager->FFacilityLayers)
  1396. {
  1397. pLayer->arrObj = "";
  1398. sJs.printf(L"removeLayerObject(%d)", pLayer->Index);
  1399. FRAMEOpenMap1->ExecScript(sJs);
  1400. }
  1401. String sTemp;
  1402. TCDSObject *pObj;
  1403. TLayerIdx *pLayer;
  1404. ItsFacilityManager->FLists.Lock();
  1405. try
  1406. {
  1407. FOR_STL(TItsFacility*, pFacility, ItsFacilityManager->FLists)
  1408. {
  1409. pObj = pFacility->Object;
  1410. if (pObj == NULL)
  1411. {
  1412. continue;
  1413. }
  1414. if (pFacility->FCLT_TYPE == "VDS" && pFacility->FCLT_KIND == "C")
  1415. {
  1416. continue;
  1417. }
  1418. pLayer = ItsLayerManager->FFacilityLayers.Find(pFacility->FCLT_TYPE);
  1419. if (pLayer)
  1420. {
  1421. if (pLayer->arrObj != "") pLayer->arrObj += "|";
  1422. sTemp.printf(L"%s,%s,%s,%.6f,%.6f,%d,0,0,0", pObj->CTLR_NMBR.c_str(), pObj->CTLR_ID.c_str(), pObj->NAME.c_str(), pObj->X_CRDN, pObj->Y_CRDN, pFacility->FComm.ToIntDef(2));
  1423. pLayer->arrObj += sTemp;
  1424. }
  1425. pFacility->FOldComm = pFacility->FComm;
  1426. }
  1427. }
  1428. __finally
  1429. {
  1430. ItsFacilityManager->FLists.UnLock();
  1431. }
  1432. FOR_STL(TLayerIdx*, pLayer, ItsLayerManager->FFacilityLayers)
  1433. {
  1434. if (pLayer->arrObj != "")
  1435. {
  1436. sJs.printf(L"addFacility(%d, '%s')", pLayer->Index, pLayer->arrObj.c_str());
  1437. FRAMEOpenMap1->ExecScript(sJs);
  1438. pLayer->arrObj = "";
  1439. }
  1440. if (pLayer->Visible == 0)
  1441. {
  1442. sJs.printf(L"showLayer(%d, 0)", pLayer->Index);
  1443. FRAMEOpenMap1->ExecScript(sJs);
  1444. }
  1445. }
  1446. }
  1447. //---------------------------------------------------------------------------
  1448. void __fastcall TITS0000M::UpdateGisTraffic()
  1449. {
  1450. if (!FRAMEOpenMap1->MapStart) return;
  1451. TItsVrtx* pVrtx;
  1452. TItsNode* pNode;
  1453. String STRT_NM;
  1454. String END_NM;
  1455. int nLinks, nIfscs, nRoads;
  1456. nLinks = nIfscs = nRoads = 0;
  1457. ItsLinkManager->FLists.Lock();
  1458. try
  1459. {
  1460. FOR_STL(TItsLink*, pLink, ItsLinkManager->FLists)
  1461. {
  1462. if (pLink->DEL_YN == "Y") continue;
  1463. if (pLink->IsVertex && pLink->TRAF && (pLink->SPED != pLink->TRAF->SPED || pLink->TRAF_GRAD != pLink->TRAF->TRAF_GRAD))
  1464. {
  1465. sJs.printf(L"updateLink('%s', '%d', %d)",
  1466. pLink->LINK_ID.c_str(),
  1467. pLink->TRAF->SPED,
  1468. pLink->TRAF->TRAF_GRAD);
  1469. FRAMEOpenMap1->ExecScript(sJs);
  1470. pLink->SPED = pLink->TRAF->SPED;
  1471. pLink->TRAF_GRAD = pLink->TRAF->TRAF_GRAD;
  1472. nLinks++;
  1473. }
  1474. }
  1475. }
  1476. __finally
  1477. {
  1478. ItsLinkManager->FLists.UnLock();
  1479. }
  1480. ItsIfscManager->FLists.Lock();
  1481. try
  1482. {
  1483. FOR_STL(TItsIfsc*, pIfsc, ItsIfscManager->FLists)
  1484. {
  1485. if (pIfsc->DEL_YN == "Y") continue;
  1486. if (pIfsc->IsVertex && pIfsc->TRAF && (pIfsc->SPED != pIfsc->TRAF->SPED || pIfsc->TRAF_GRAD != pIfsc->TRAF->TRAF_GRAD))
  1487. {
  1488. sJs.printf(L"updateIfsc('%s', '%d', %d)",
  1489. pIfsc->IFSC_ID.c_str(),
  1490. pIfsc->TRAF->SPED,
  1491. pIfsc->TRAF->TRAF_GRAD);
  1492. FRAMEOpenMap1->ExecScript(sJs);
  1493. pIfsc->SPED = pIfsc->TRAF->SPED;
  1494. pIfsc->TRAF_GRAD = pIfsc->TRAF->TRAF_GRAD;
  1495. nIfscs++;
  1496. }
  1497. }
  1498. }
  1499. __finally
  1500. {
  1501. ItsIfscManager->FLists.UnLock();
  1502. }
  1503. ItsRoadManager->FLists.Lock();
  1504. try
  1505. {
  1506. FOR_STL(TItsRoad*, pRoad, ItsRoadManager->FLists)
  1507. {
  1508. if (pRoad->DEL_YN == "Y") continue;
  1509. if (pRoad->IsVertex && pRoad->TRAF && (pRoad->SPED != pRoad->TRAF->SPED || pRoad->TRAF_GRAD != pRoad->TRAF->TRAF_GRAD))
  1510. {
  1511. sJs.printf(L"updateRoad('%s', '%d', %d)",
  1512. pRoad->ROAD_ID.c_str(),
  1513. pRoad->TRAF->SPED,
  1514. pRoad->TRAF->TRAF_GRAD);
  1515. FRAMEOpenMap1->ExecScript(sJs);
  1516. pRoad->SPED = pRoad->TRAF->SPED;
  1517. pRoad->TRAF_GRAD = pRoad->TRAF->TRAF_GRAD;
  1518. nRoads++;
  1519. }
  1520. }
  1521. }
  1522. __finally
  1523. {
  1524. ItsRoadManager->FLists.UnLock();
  1525. }
  1526. try
  1527. {
  1528. if (FrmLinkInfo)
  1529. {
  1530. FrmLinkInfo->RefreshLinkInfo();
  1531. }
  1532. }
  1533. catch(...)
  1534. {
  1535. }
  1536. String sMsg;
  1537. sMsg.printf(L"GIS Traffic Update: %d, %d, %d", nLinks, nIfscs, nRoads);
  1538. DebugLog(sMsg);
  1539. }
  1540. //---------------------------------------------------------------------------
  1541. void __fastcall TITS0000M::InitGisTraffic()
  1542. {
  1543. if (!FRAMEOpenMap1->MapStart) return;
  1544. TItsVrtx* pVrtx;
  1545. TItsNode* pNode;
  1546. String STRT_NM;
  1547. String END_NM;
  1548. FLayerIdx = LyrTp_Node;
  1549. sJs.printf(L"removeLayerObject(%d)", FLayerIdx);
  1550. FRAMEOpenMap1->ExecScript(sJs);
  1551. String arrObj = "";
  1552. String sTemp;
  1553. int cnt = 0;
  1554. ItsNodeManager->FLists.Lock();
  1555. try
  1556. {
  1557. FOR_STL(TItsNode*, pObj, ItsNodeManager->FLists)
  1558. {
  1559. if (arrObj != "") arrObj += "|";
  1560. if (cnt == 0)
  1561. {
  1562. sTemp.printf(L"%s,%s,%s,%.6f,%.6f,0,0,0,0", pObj->NODE_ID.c_str(), pObj->NODE_ID.c_str(), pObj->NODE_NAME.c_str(), pObj->X_CRDN, pObj->Y_CRDN);
  1563. arrObj += sTemp;
  1564. sJs.printf(L"addFacility(%d, '%s')", FLayerIdx, arrObj.c_str());
  1565. FRAMEOpenMap1->ExecScript(sJs);
  1566. }
  1567. else
  1568. {
  1569. sTemp.printf(L"%s,%s,%s,%.6f,%.6f,0,0,0,0", pObj->NODE_ID.c_str(), pObj->NODE_ID.c_str(), pObj->NODE_NAME.c_str(), pObj->X_CRDN, pObj->Y_CRDN);
  1570. sJs.printf(L"addFacilityObject(%d, '%s')", FLayerIdx, sTemp.c_str());
  1571. FRAMEOpenMap1->ExecScript(sJs);
  1572. }
  1573. cnt++;
  1574. }
  1575. }
  1576. __finally
  1577. {
  1578. ItsNodeManager->FLists.UnLock();
  1579. sJs.printf(L"showLayer(%d, 0)", FLayerIdx);
  1580. FRAMEOpenMap1->ExecScript(sJs);
  1581. }
  1582. FRAMEOpenMap1->ExecScript("initTrafficLayer()");
  1583. ItsLinkManager->FLists.Lock();
  1584. try
  1585. {
  1586. FOR_STL(TItsLink*, pLink, ItsLinkManager->FLists)
  1587. {
  1588. if (pLink->DEL_YN == "Y") continue;
  1589. if (pLink->IsVertex && pLink->TRAF)
  1590. {
  1591. pNode = ItsNodeManager->FLists.Find(pLink->F_NODE_ID);
  1592. if (pNode) STRT_NM = pNode->NODE_NAME; else STRT_NM = " ";
  1593. pNode = ItsNodeManager->FLists.Find(pLink->T_NODE_ID);
  1594. if (pNode) END_NM = pNode->NODE_NAME; else END_NM = " ";
  1595. sJs.printf(L"addLink('%s', '%s', '%s', '%s', '%s', '%d', %d, '%s', '%s')",
  1596. pLink->LINK_ID.c_str(),
  1597. pLink->ROAD_NAME.c_str(),
  1598. STRT_NM.c_str(),
  1599. END_NM.c_str(),
  1600. pLink->LINK_LENG.c_str(),
  1601. pLink->TRAF->SPED,
  1602. pLink->TRAF->TRAF_GRAD,
  1603. pLink->X_CRDN_ARR.c_str(),
  1604. pLink->Y_CRDN_ARR.c_str());
  1605. FRAMEOpenMap1->ExecScript(sJs);
  1606. pLink->SPED = pLink->TRAF->SPED;
  1607. pLink->TRAF_GRAD = pLink->TRAF->TRAF_GRAD;
  1608. }
  1609. }
  1610. }
  1611. __finally
  1612. {
  1613. ItsLinkManager->FLists.UnLock();
  1614. }
  1615. ItsIfscManager->FLists.Lock();
  1616. try
  1617. {
  1618. FOR_STL(TItsIfsc*, pIfsc, ItsIfscManager->FLists)
  1619. {
  1620. if (pIfsc->DEL_YN == "Y") continue;
  1621. if (pIfsc->IsVertex && pIfsc->TRAF)
  1622. {
  1623. sJs.printf(L"addIfsc('%s', '%s', '%s', '%s', '%s', '%d', %d, '%s', '%s')",
  1624. pIfsc->IFSC_ID.c_str(),
  1625. pIfsc->IFSC_NM.c_str(),
  1626. pIfsc->STRT_NM.c_str(),
  1627. pIfsc->END_NM.c_str(),
  1628. pIfsc->SECT_LNGT.c_str(),
  1629. pIfsc->TRAF->SPED,
  1630. pIfsc->TRAF->TRAF_GRAD,
  1631. pIfsc->X_CRDN_ARR.c_str(),
  1632. pIfsc->Y_CRDN_ARR.c_str());
  1633. FRAMEOpenMap1->ExecScript(sJs);
  1634. pIfsc->SPED = pIfsc->TRAF->SPED;
  1635. pIfsc->TRAF_GRAD = pIfsc->TRAF->TRAF_GRAD;
  1636. }
  1637. }
  1638. }
  1639. __finally
  1640. {
  1641. ItsIfscManager->FLists.UnLock();
  1642. }
  1643. ItsRoadManager->FLists.Lock();
  1644. try
  1645. {
  1646. FOR_STL(TItsRoad*, pRoad, ItsRoadManager->FLists)
  1647. {
  1648. if (pRoad->DEL_YN == "Y") continue;
  1649. if (pRoad->IsVertex && pRoad->TRAF)
  1650. {
  1651. sJs.printf(L"addRoad('%s', '%s', '%s', '%s', '%s', '%d', %d, '%s', '%s')",
  1652. pRoad->ROAD_ID.c_str(),
  1653. pRoad->ROAD_NM.c_str(),
  1654. pRoad->STRT_NM.c_str(),
  1655. pRoad->END_NM.c_str(),
  1656. pRoad->SECT_LNGT.c_str(),
  1657. pRoad->TRAF->SPED,
  1658. pRoad->TRAF->TRAF_GRAD,
  1659. pRoad->X_CRDN_ARR.c_str(),
  1660. pRoad->Y_CRDN_ARR.c_str());
  1661. FRAMEOpenMap1->ExecScript(sJs);
  1662. pRoad->SPED = pRoad->TRAF->SPED;
  1663. pRoad->TRAF_GRAD = pRoad->TRAF->TRAF_GRAD;
  1664. }
  1665. }
  1666. }
  1667. __finally
  1668. {
  1669. ItsRoadManager->FLists.UnLock();
  1670. }
  1671. FRAMEOpenMap1->ExecScript("makeTrafficLayer()");
  1672. }
  1673. //---------------------------------------------------------------------------
  1674. void __fastcall TITS0000M::OnMapPopupMenu(int ALayerType, String AFID, bool AOnList)
  1675. {
  1676. FSelId = AFID;
  1677. #if 0
  1678. TItsFacility *pFacility = ItsFacilityManager->FLists.Find(FSelId);
  1679. if (!pFacility) return;
  1680. TCDSObject *pObj = pFacility->Object;
  1681. if (!pObj) return;
  1682. #endif
  1683. POINT p;
  1684. GetCursorPos(&p);
  1685. switch(ALayerType)
  1686. {
  1687. case LyrTp_Cctv:
  1688. N1->Visible = AOnList;
  1689. mnuMoveCctv->Visible = AOnList;
  1690. pmuCctv->Popup(p.x, p.y);
  1691. break;
  1692. case LyrTp_Vms:
  1693. N2->Visible = AOnList;
  1694. mnuMoveVms->Visible = AOnList;
  1695. pmuVms->Popup(p.x, p.y);
  1696. break;
  1697. case LyrTp_Vds:
  1698. MenuItem6->Visible = AOnList;
  1699. MenuItem7->Visible = AOnList;
  1700. pmuVds->Popup(p.x, p.y);
  1701. break;
  1702. case LyrTp_VdsDet:
  1703. case LyrTp_VdsR:
  1704. case LyrTp_VdsRDet:
  1705. case LyrTp_VdsC:
  1706. case LyrTp_VdsCDet:
  1707. break;
  1708. case LyrTp_Avi:
  1709. MenuItem11->Visible = AOnList;
  1710. MenuItem12->Visible = AOnList;
  1711. pmuAvi->Popup(p.x, p.y);
  1712. break;
  1713. case LyrTp_Rse:
  1714. N5->Visible = AOnList;
  1715. mnuMoveRse->Visible = AOnList;
  1716. pmuRse->Popup(p.x, p.y);
  1717. break;
  1718. case LyrTp_Dsrc:
  1719. MenuItem16->Visible = AOnList;
  1720. MenuItem17->Visible = AOnList;
  1721. pmuDsrc->Popup(p.x, p.y);
  1722. break;
  1723. case LyrTp_Park:
  1724. MenuItem28->Visible = AOnList;
  1725. MenuItem29->Visible = AOnList;
  1726. pmuPark->Popup(p.x, p.y);
  1727. break;
  1728. case LyrTp_PVms:
  1729. MenuItem24->Visible = AOnList;
  1730. MenuItem25->Visible = AOnList;
  1731. pmuPVms->Popup(p.x, p.y);
  1732. break;
  1733. case LyrTp_Bit:
  1734. MenuItem18->Visible = AOnList;
  1735. mnuMoveBit->Visible = AOnList;
  1736. pmuBit->Popup(p.x, p.y);
  1737. break;
  1738. case LyrTp_Sig:
  1739. MenuItem22->Visible = AOnList;
  1740. mnuMoveSig->Visible = AOnList;
  1741. pmuSig->Popup(p.x, p.y);
  1742. break;
  1743. case LyrTp_SigDet:
  1744. MenuItem23->Visible = AOnList;
  1745. mnuMoveSigDet->Visible = AOnList;
  1746. pmuSigDet->Popup(p.x, p.y);
  1747. break;
  1748. case LyrTp_WCam:
  1749. N7->Visible = AOnList;
  1750. mnuMoveVmsWebCam->Visible = AOnList;
  1751. pmuWCam->Popup(p.x, p.y);
  1752. break;
  1753. case LyrTp_CCam:
  1754. N18->Visible = AOnList;
  1755. mnuMoveCrsCam->Visible = AOnList;
  1756. pmuCCam->Popup(p.x, p.y);
  1757. break;
  1758. case LyrTp_Event:
  1759. case LyrTp_Wthr:
  1760. case LyrTp_Atmp:
  1761. break;
  1762. case LyrTp_Incd:
  1763. break;
  1764. }
  1765. }
  1766. //---------------------------------------------------------------------------
  1767. void __fastcall TITS0000M::SelectObjectByPos(double dPosX, double dPosY, bool bArrow/*=false*/)
  1768. {
  1769. FRAMEOpenMap1->SelectObjectByPos(dPosX, dPosY, bArrow);
  1770. }
  1771. //---------------------------------------------------------------------------
  1772. void __fastcall TITS0000M::ShowLinkDetailInfo(String ALinkId, int ALinkLevel)
  1773. {
  1774. try
  1775. {
  1776. if (FrmLinkInfo == NULL)
  1777. {
  1778. FrmLinkInfo = new TFrmLinkInfo(Application);
  1779. }
  1780. FrmLinkInfo->Show();
  1781. FrmLinkInfo->ShowLinkInfo(ALinkId, ALinkLevel);
  1782. }
  1783. catch(...)
  1784. {
  1785. }
  1786. }
  1787. //---------------------------------------------------------------------------
  1788. void __fastcall TITS0000M::MapZoomChanged(int AMapZoom)
  1789. {
  1790. String sLevl = ", L ";
  1791. switch(AMapZoom)
  1792. {
  1793. case 12: case 13: sLevl = ", R "; break;
  1794. case 14: case 15: sLevl = ", I "; break;
  1795. }
  1796. LblZoom->Caption = "Zoom: " + String(FRAMEOpenMap1->MapZoom) + sLevl;
  1797. }
  1798. //---------------------------------------------------------------------------
  1799. void __fastcall TITS0000M::OpenMapCallback(TObject *ASender, const String AFunc, const String AArgs, const bool AFirst)
  1800. {
  1801. try
  1802. {
  1803. DebugLog(AFunc + " " + AArgs + (AFirst ? ", First" : ""));
  1804. if (AFirst)
  1805. {
  1806. MapZoomChanged(FRAMEOpenMap1->MapZoom);
  1807. Application->ProcessMessages();
  1808. TmrInitGis->Enabled = true;
  1809. return;
  1810. }
  1811. if (FRAMEOpenMap1->MapStart)
  1812. {
  1813. MapZoomChanged(FRAMEOpenMap1->MapZoom);
  1814. }
  1815. if (AFunc.Pos("onlinkclick"))
  1816. {
  1817. if (BtnMapSelect->Down)
  1818. {
  1819. String sLyrType = "";
  1820. String sLinkId = "";
  1821. TStringList *pStringList = new TStringList;
  1822. pStringList->CommaText = AArgs;
  1823. try
  1824. {
  1825. sLyrType = pStringList->Strings[0];
  1826. sLinkId = pStringList->Strings[1];
  1827. }
  1828. catch(Exception &e)
  1829. {
  1830. }
  1831. delete pStringList;
  1832. if (sLinkId != "")
  1833. {
  1834. ShowLinkDetailInfo(sLinkId, sLyrType.ToIntDef(1));
  1835. }
  1836. }
  1837. return;
  1838. }
  1839. if (AFunc.Pos("onfacilityrightclick"))
  1840. {
  1841. int nLyrType;
  1842. String sFID;
  1843. //int X, Y;
  1844. TStringList *pStringList = new TStringList;
  1845. pStringList->CommaText = AArgs;
  1846. try
  1847. {
  1848. nLyrType = pStringList->Strings[0].ToIntDef(0);
  1849. sFID = pStringList->Strings[1];
  1850. //X = pStringList->Strings[4].ToIntDef(0);
  1851. //Y = pStringList->Strings[5].ToIntDef(0);
  1852. if (nLyrType != LyrTp_Vds) OnMapPopupMenu(nLyrType, sFID, false);
  1853. }
  1854. catch(Exception &e)
  1855. {
  1856. }
  1857. delete pStringList;
  1858. }
  1859. }
  1860. catch(Exception &exception)
  1861. {
  1862. }
  1863. }
  1864. //---------------------------------------------------------------------------
  1865. void __fastcall TITS0000M::SetGisTrafficColor()
  1866. {
  1867. #if 0
  1868. //TODO
  1869. //소통등급별 색상을 던지는 것을 여기에 추가한다.
  1870. TUTISLinkGrade UtisLinkColor;
  1871. GetGisTrafficColor(UtisLinkColor);
  1872. // 소통정보를 표출할 스레드 생성
  1873. for (int ii = 0; ii < MAX_LAYERS; ii++)
  1874. {
  1875. if (m_pLinkSpeedUpdate[ii] == NULL) continue;
  1876. m_pLinkSpeedUpdate[ii]->SetUTISLinkColor(UtisLinkColor);
  1877. }
  1878. #endif
  1879. }
  1880. //---------------------------------------------------------------------------
  1881. bool __fastcall TITS0000M::SelectLinkById(int ALinkLevel, String AId, bool AHide/*=false*/)
  1882. {
  1883. if (!FRAMEOpenMap1->MapStart) return false;
  1884. int nMapZoom = FRAMEOpenMap1->MapZoom;
  1885. switch(ALinkLevel)
  1886. {
  1887. case 0:
  1888. FLayerIdx = LyrTp_Node;
  1889. break;
  1890. case 1:
  1891. FLayerIdx = LyrTp_Link;
  1892. if (nMapZoom > 20 || nMapZoom < 16) nMapZoom = 17;
  1893. break;
  1894. case 2:
  1895. FLayerIdx = LyrTp_Ifsc;
  1896. if (nMapZoom > 15 || nMapZoom < 14) nMapZoom = 15;
  1897. break;
  1898. case 3:
  1899. FLayerIdx = LyrTp_Road;
  1900. if (nMapZoom > 13 || nMapZoom < 12) nMapZoom = 13;
  1901. break;
  1902. }
  1903. sJs.printf(L"selectLayerObject(%d, '%s', %d)", FLayerIdx, AId.c_str(), nMapZoom);
  1904. FRAMEOpenMap1->ExecScript(sJs);
  1905. return true;
  1906. }
  1907. //---------------------------------------------------------------------------
  1908. void __fastcall TITS0000M::RefreshGisLink()
  1909. {
  1910. SelectLinkById(g_SelLink.Level, g_SelLink.Id, true);
  1911. }
  1912. //---------------------------------------------------------------------------
  1913. void __fastcall TITS0000M::SelGisItem(int AType, String AId)
  1914. {
  1915. SelectLinkById(AType, AId);
  1916. }
  1917. //---------------------------------------------------------------------------
  1918. void __fastcall TITS0000M::TmrInitGisTimer(TObject *Sender)
  1919. {
  1920. TmrInitGis->Enabled = false;
  1921. if (!FRAMEOpenMap1->MapStart) return;
  1922. PbLoadMap->Properties->Text = lblGisStep2->Caption;//"시설물 로딩 중...";
  1923. PbLoadMap->Position = 60;
  1924. Application->ProcessMessages();
  1925. InitGisFacility();
  1926. PbLoadMap->Properties->Text = lblGisStep3->Caption;//"소통정보 로딩 중...";
  1927. PbLoadMap->Position = 80;
  1928. Application->ProcessMessages();
  1929. InitGisTraffic();
  1930. PbLoadMap->Properties->Text = lblGisStep4->Caption;//"돌발정보 로딩 중...";
  1931. PbLoadMap->Position = 100;
  1932. Application->ProcessMessages();
  1933. UpdateGisIncident();
  1934. //여기부분은 모든 레이어를 생성한 후에 실행해야 한다.
  1935. //ChkTrafficClick((TObject*)ChkTraffic);
  1936. ChkTrafficTooltipClick((TObject*)ChkTrafficTooltip);
  1937. PnlProgress->Visible = false;
  1938. PnlToolbar->Enabled = true;
  1939. }
  1940. //---------------------------------------------------------------------------
  1941. void __fastcall TITS0000M::ChkFacilityLayerShowHideClick(TObject *Sender)
  1942. {
  1943. if (!FRAMEOpenMap1->MapStart) return;
  1944. TcxCheckBox *pCheck = (TcxCheckBox*)Sender;
  1945. sJs.printf(L"showLayer(%d, %d)", pCheck->Tag, pCheck->Checked ? 1 : 0);
  1946. FRAMEOpenMap1->ExecScript(sJs);
  1947. }
  1948. //---------------------------------------------------------------------------
  1949. void __fastcall TITS0000M::ChkTrafficClick(TObject *Sender)
  1950. {
  1951. if (!FRAMEOpenMap1->MapStart) return;
  1952. TcxCheckBox *pCheck = (TcxCheckBox*)Sender;
  1953. sJs.printf(L"showTrafficLayer(%d)", pCheck->Checked ? 1 : 0);
  1954. FRAMEOpenMap1->ExecScript(sJs);
  1955. }
  1956. //---------------------------------------------------------------------------
  1957. void __fastcall TITS0000M::ChkTrafficTooltipClick(TObject *Sender)
  1958. {
  1959. if (!FRAMEOpenMap1->MapStart) return;
  1960. TcxCheckBox *pCheck = (TcxCheckBox*)Sender;
  1961. sJs.printf(L"showTrafficTooltip(%d)", pCheck->Checked ? 1 : 0);
  1962. FRAMEOpenMap1->ExecScript(sJs);
  1963. }
  1964. //---------------------------------------------------------------------------
  1965. void __fastcall TITS0000M::LblZoomDblClick(TObject *Sender)
  1966. {
  1967. FRAMEOpenMap1->reMsg->Visible = !FRAMEOpenMap1->reMsg->Visible;
  1968. }
  1969. //---------------------------------------------------------------------------
  1970. void __fastcall TITS0000M::ChkGisSearchClick(TObject *Sender)
  1971. {
  1972. try
  1973. {
  1974. if (ChkGisSearch->Checked)
  1975. {
  1976. if (FrmGisSearch == NULL)
  1977. {
  1978. FrmGisSearch = new TFrmGisSearch(this);
  1979. //FrmGisSearch->Parent = this;
  1980. }
  1981. FrmGisSearch->Show();
  1982. }
  1983. else
  1984. {
  1985. if (FrmGisSearch)
  1986. {
  1987. if (FrmGisSearch->m_bClose == false)
  1988. {
  1989. FrmGisSearch->Close();
  1990. }
  1991. }
  1992. }
  1993. }
  1994. catch(...)
  1995. {
  1996. }
  1997. }
  1998. //---------------------------------------------------------------------------
  1999. void __fastcall TITS0000M::FormCloseQuery(TObject *Sender, bool &CanClose)
  2000. {
  2001. FRAMEOpenMap1->OnCloseQuery(CanClose);
  2002. }
  2003. //---------------------------------------------------------------------------
  2004. void __fastcall TITS0000M::DebugMsg(String AMsg)
  2005. {
  2006. LblMsg->Caption = AMsg;
  2007. LblMsg->Refresh();
  2008. if (LblMsg->Visible == false) LblMsg->Visible = true;
  2009. TmrDebugHide->Enabled = false;
  2010. TmrDebugHide->Enabled = true;
  2011. DebugLog(AMsg);
  2012. }
  2013. //---------------------------------------------------------------------------
  2014. void __fastcall TITS0000M::DebugLog(String AMsg)
  2015. {
  2016. if (TabDebug->Visible)
  2017. {
  2018. reMsg->Lines->Add(Now().FormatString("HH:NN:SS.ZZZ") + ": " + AMsg);
  2019. }
  2020. }
  2021. //---------------------------------------------------------------------------
  2022. void __fastcall TITS0000M::TmrDebugHideTimer(TObject *Sender)
  2023. {
  2024. LblMsg->Visible = false;
  2025. TmrDebugHide->Enabled = false;
  2026. }
  2027. //---------------------------------------------------------------------------
  2028. void __fastcall TITS0000M::reMsgDblClick(TObject *Sender)
  2029. {
  2030. reMsg->Lines->Clear();
  2031. }
  2032. //---------------------------------------------------------------------------
  2033. void __fastcall TITS0000M::FRAMEAtmpPltnList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  2034. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  2035. {
  2036. if (!ACellViewInfo) return;
  2037. try {
  2038. TcxDataController *pGDC = FRAMEAtmpPltnList1->TvList->DataController;
  2039. int nRow = pGDC->FocusedRecordIndex;
  2040. if (nRow < 0) return;
  2041. String sId = VarToStr(pGDC->Values[nRow][FRAMEAtmpPltnList1->Col00->Index]);
  2042. String sDx = VarToStr(pGDC->Values[nRow][FRAMEAtmpPltnList1->Col30->Index]);
  2043. String sDy = VarToStr(pGDC->Values[nRow][FRAMEAtmpPltnList1->Col31->Index]);
  2044. SelectObjectByPos(StrToFloat(sDx), StrToFloat(sDy), true);
  2045. } catch(...) {}
  2046. }
  2047. //---------------------------------------------------------------------------
  2048. void __fastcall TITS0000M::FRAMEVilgShprList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  2049. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  2050. {
  2051. if (!ACellViewInfo) return;
  2052. try {
  2053. TcxDataController *pGDC = FRAMEVilgShprList1->TvList->DataController;
  2054. int nRow = pGDC->FocusedRecordIndex;
  2055. if (nRow < 0) return;
  2056. String sId = VarToStr(pGDC->Values[nRow][FRAMEVilgShprList1->Col00->Index]);
  2057. String sDx = VarToStr(pGDC->Values[nRow][FRAMEVilgShprList1->Col20->Index]);
  2058. String sDy = VarToStr(pGDC->Values[nRow][FRAMEVilgShprList1->Col21->Index]);
  2059. SelectObjectByPos(StrToFloat(sDx), StrToFloat(sDy), true);
  2060. } catch(...) {}
  2061. }
  2062. //---------------------------------------------------------------------------
  2063. void __fastcall TITS0000M::FRAMEVilgFrcsList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  2064. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  2065. {
  2066. if (!ACellViewInfo) return;
  2067. try {
  2068. TcxDataController *pGDC = FRAMEVilgFrcsList1->TvList->DataController;
  2069. int nRow = pGDC->FocusedRecordIndex;
  2070. if (nRow < 0) return;
  2071. String sId = VarToStr(pGDC->Values[nRow][FRAMEVilgFrcsList1->Col00->Index]);
  2072. String sDx = VarToStr(pGDC->Values[nRow][FRAMEVilgFrcsList1->Col20->Index]);
  2073. String sDy = VarToStr(pGDC->Values[nRow][FRAMEVilgFrcsList1->Col21->Index]);
  2074. SelectObjectByPos(StrToFloat(sDx), StrToFloat(sDy), true);
  2075. } catch(...) {}
  2076. }
  2077. //---------------------------------------------------------------------------
  2078. void __fastcall TITS0000M::PnlFacilityDblClick(TObject *Sender)
  2079. {
  2080. FRAMEOpenMap1->ExecScript("getMapExtent()");
  2081. }
  2082. //---------------------------------------------------------------------------
  2083. void __fastcall TITS0000M::mnuParkMsgClick(TObject *Sender)
  2084. {
  2085. Application->ProcessMessages();
  2086. TPoint pt;
  2087. GetCursorPos(&pt);
  2088. pt = ITS0000M->ScreenToClient(pt);
  2089. ShowParkingLotInfo(FSelId, pt);
  2090. }
  2091. //---------------------------------------------------------------------------
  2092. void __fastcall TITS0000M::ShowParkingLotInfo(String AId, TPoint pt)
  2093. {
  2094. TItsFacility *pFacility = ItsFacilityManager->FLists.Find(AId);
  2095. if (!pFacility) return;
  2096. TPrltCtlr *pObj = (TPrltCtlr*)pFacility->Object;
  2097. if (!pObj) return;
  2098. try {
  2099. if (pObj->FData1)
  2100. {
  2101. TFrmParkMsg *pForm = (TFrmParkMsg *)pObj->FData1;
  2102. pForm->SetFocus();
  2103. }
  2104. else
  2105. {
  2106. TFrmParkMsg *pForm = new TFrmParkMsg(ITS0000M, pObj);
  2107. pForm->Parent = ITS0000M;
  2108. if ((pt.x + pForm->Width + 5) > this->Width)
  2109. {
  2110. pt.x = this->Width - pForm->Width - 5;
  2111. }
  2112. if ((pt.y + pForm->Height + 5) > this->Height)
  2113. {
  2114. pt.y = this->Height - pForm->Height - 5;
  2115. }
  2116. pForm->Left = Left + pt.x;
  2117. pForm->Top = Top + pt.y;
  2118. pObj->FData1 = (void*)pForm;
  2119. pForm->Show();
  2120. }
  2121. } catch(...) {}
  2122. }
  2123. //---------------------------------------------------------------------------