ITS0000MF.cpp 84 KB

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