ITS0000MF.cpp 87 KB

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