ITS00MAPF.cpp 102 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272
  1. //---------------------------------------------------------------------------
  2. #include "FrmVmsCamF.h"
  3. #include "FrmWebCamF.h"
  4. #include <vcl.h>
  5. #include "ITSSkinF.h"
  6. #include "ITSUtilF.h"
  7. #include "XiMapUtilF.h"
  8. #include "CDSTrafficGradeF.h"
  9. #include "CDSFacilityF.h"
  10. #include "CDSIncidentF.h"
  11. #pragma hdrstop
  12. #include <OleCtrls.hpp>
  13. #include "ITS00MAPF.h"
  14. #include "ITS0000MF.h"
  15. #include "FrmCctvImgF.h"
  16. #include "FrmCctvCamF.h"
  17. #include "FrmVmsMsgF.h"
  18. #include "FrmLinkInfoF.h"
  19. #include "FrmGisSearchF.h"
  20. #include "FrmMainF.h"
  21. //---------------------------------------------------------------------------
  22. #pragma package(smart_init)
  23. #pragma link "cxCheckBox"
  24. #pragma link "cxContainer"
  25. #pragma link "cxControls"
  26. #pragma link "cxEdit"
  27. #pragma link "cxGraphics"
  28. #pragma link "cxGroupBox"
  29. #pragma link "cxLabel"
  30. #pragma link "cxLookAndFeelPainters"
  31. #pragma link "cxLookAndFeels"
  32. #pragma link "cxMaskEdit"
  33. #pragma link "cxProgressBar"
  34. #pragma link "cxSpinEdit"
  35. #pragma link "cxTextEdit"
  36. #pragma link "dxGDIPlusClasses"
  37. #pragma link "dxSkinBlack"
  38. #pragma link "dxSkinBlue"
  39. #pragma link "dxSkinCaramel"
  40. #pragma link "dxSkinCoffee"
  41. #pragma link "dxSkinDarkRoom"
  42. #pragma link "dxSkinDarkSide"
  43. #pragma link "dxSkinFoggy"
  44. #pragma link "dxSkinGlassOceans"
  45. #pragma link "dxSkiniMaginary"
  46. #pragma link "dxSkinLilian"
  47. #pragma link "dxSkinLiquidSky"
  48. #pragma link "dxSkinLondonLiquidSky"
  49. #pragma link "dxSkinMcSkin"
  50. #pragma link "dxSkinMoneyTwins"
  51. #pragma link "dxSkinOffice2007Black"
  52. #pragma link "dxSkinOffice2007Blue"
  53. #pragma link "dxSkinOffice2007Green"
  54. #pragma link "dxSkinOffice2007Pink"
  55. #pragma link "dxSkinOffice2007Silver"
  56. #pragma link "dxSkinOffice2010Black"
  57. #pragma link "dxSkinOffice2010Blue"
  58. #pragma link "dxSkinOffice2010Silver"
  59. #pragma link "dxSkinsCore"
  60. #pragma link "dxSkinSeven"
  61. #pragma link "dxSkinSharp"
  62. #pragma link "dxSkinSilver"
  63. #pragma link "dxSkinStardust"
  64. #pragma resource "*.dfm"
  65. //---------------------------------------------------------------------------
  66. TITS00MAP *ITS00MAP = NULL;
  67. const String LEVEL1_LINK_LAYER_NAME = "GD_LINK_LV7.dvf";
  68. const String LEVEL2_LINK_LAYER_NAME = "GD_LINK_LV6.dvf";
  69. const String LEVEL3_LINK_LAYER_NAME = "GD_LINK_LV5.dvf";
  70. const String LEVEL1_NODE_LAYER_NAME = "GD_NODE_LV7.dvf";
  71. const String LEVEL2_NODE_LAYER_NAME = "GD_NODE_LV6.dvf";
  72. const String LEVEL3_NODE_LAYER_NAME = "GD_NODE_LV5.dvf";
  73. const String LEVEL1_TRAFFIC_SQL =
  74. "SELECT A.LINK_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
  75. " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
  76. " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
  77. " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
  78. " FROM TB_LINK A, \r\n"
  79. " (SELECT * \r\n"
  80. " FROM TB_LINK_TRAF \r\n"
  81. " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
  82. " ) B \r\n"
  83. " WHERE A.LINK_ID = B.LINK_ID(+) \r\n";
  84. const String LEVEL2_TRAFFIC_SQL =
  85. "SELECT A.IFSC_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
  86. " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
  87. " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
  88. " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
  89. " FROM TB_IFSC A, \r\n"
  90. " (SELECT * \r\n"
  91. " FROM TB_IFSC_TRAF \r\n"
  92. " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
  93. " ) B \r\n"
  94. " WHERE A.IFSC_ID = B.IFSC_ID(+) \r\n";
  95. const String LEVEL3_TRAFFIC_SQL =
  96. "SELECT A.ROAD_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
  97. " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
  98. " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
  99. " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
  100. " FROM TB_ROAD A, \r\n"
  101. " (SELECT * \r\n"
  102. " FROM TB_ROAD_TRAF \r\n"
  103. " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
  104. " ) B \r\n"
  105. " WHERE A.ROAD_ID = B.ROAD_ID(+) \r\n";
  106. String g_sLinkLyrName[MAX_LAYERS] = {
  107. "",//LEVEL3_LINK_LAYER_NAME,
  108. "",//LEVEL3_LINK_LAYER_NAME,
  109. "",//LEVEL3_LINK_LAYER_NAME,
  110. "",//LEVEL2_LINK_LAYER_NAME,
  111. "",//LEVEL2_LINK_LAYER_NAME,
  112. "",//LEVEL1_LINK_LAYER_NAME,
  113. "",//LEVEL1_LINK_LAYER_NAME,
  114. };
  115. String g_sNodeLyrName[MAX_LAYERS] = {
  116. "",//LEVEL3_NODE_LAYER_NAME,
  117. "",//LEVEL3_NODE_LAYER_NAME,
  118. "",//LEVEL3_NODE_LAYER_NAME,
  119. "",//LEVEL2_NODE_LAYER_NAME,
  120. "",//LEVEL2_NODE_LAYER_NAME,
  121. "",//LEVEL1_NODE_LAYER_NAME,
  122. "",//LEVEL1_NODE_LAYER_NAME,
  123. };
  124. int g_nLinkLyrLevel[MAX_LAYERS] = {
  125. 0,
  126. 0,
  127. 0,
  128. 0,
  129. 0,
  130. 0,
  131. 0,
  132. };
  133. //아래거는 사용안함
  134. #if 0
  135. bool g_bLinkLyrLoad[MAX_LAYERS] = {
  136. false,
  137. false,
  138. true,
  139. true,
  140. false,
  141. true,
  142. false,
  143. };
  144. String g_sTrafficSql[MAX_LAYERS] = {
  145. "0************************************************************************\r\n",
  146. "1************************************************************************\r\n",
  147. "SELECT A.ROAD_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
  148. " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
  149. " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
  150. " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
  151. " FROM TB_ROAD A, \r\n"
  152. " (SELECT * \r\n"
  153. " FROM TB_ROAD_TRAF \r\n"
  154. " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
  155. " ) B \r\n"
  156. " WHERE A.ROAD_ID = B.ROAD_ID(+) \r\n",
  157. "SELECT A.IFSC_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
  158. " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
  159. " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
  160. " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
  161. " FROM TB_IFSC A, \r\n"
  162. " (SELECT * \r\n"
  163. " FROM TB_IFSC_TRAF \r\n"
  164. " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
  165. " ) B \r\n"
  166. " WHERE A.IFSC_ID = B.IFSC_ID(+) \r\n",
  167. "4************************************************************************\r\n",
  168. "SELECT A.LINK_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
  169. " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
  170. " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
  171. " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
  172. " FROM TB_LINK A, \r\n"
  173. " (SELECT * \r\n"
  174. " FROM TB_LINK_TRAF \r\n"
  175. " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
  176. " ) B \r\n"
  177. " WHERE A.LINK_ID = B.LINK_ID(+) \r\n",
  178. "6************************************************************************\r\n",
  179. };
  180. #endif
  181. //---------------------------------------------------------------------------
  182. __fastcall TITS00MAP::TITS00MAP(TComponent* Owner, TForm *ParentForm)
  183. : TForm(Owner)
  184. {
  185. ::CoInitialize(NULL);
  186. ITSSkin_Load(this);
  187. LoadLocalSkin();
  188. panRemark->Visible = false;
  189. m_objToolTip = NULL;
  190. m_slToolTip = new TStringList();
  191. m_slFldName = new TStringList();
  192. m_slFldValue = new TStringList();
  193. m_slLinkFldName = new TStringList();
  194. m_slLinkFldValue = new TStringList();
  195. m_nMapLevel = 1;
  196. //마우스 제어 플래그 초기화
  197. m_bMouseDown = false;
  198. m_bMoveCenter = false;
  199. m_bCalcMode = false;
  200. m_bCalcCont = false;
  201. m_ptDown.x = m_ptDown.y = 0;
  202. //체크박스
  203. ChkDrawVds->Checked = false;
  204. ChkDrawAvi->Checked = false;
  205. ChkDrawDsrc->Checked = false;
  206. ChkDrawRse->Checked = false;
  207. ChkWebCam->Checked = false;
  208. ChkDrawVds->Visible = false;
  209. ChkDrawAvi->Visible = false;
  210. ChkDrawDsrc->Visible = false;
  211. ChkDrawRse->Visible = false;
  212. ChkWebCam->Visible = false;
  213. GrpFacility->Width = 124;
  214. //범례
  215. GrpRse->Visible = false;
  216. GrpWeb->Visible = false;
  217. GrpVds->Visible = false;
  218. GrpAvi->Visible = false;
  219. GrpDsrc->Visible = false;
  220. panRemark->Height = 198;
  221. LoadConfig();
  222. CreateToolTip();
  223. }
  224. //---------------------------------------------------------------------------
  225. /*
  226. * 환경설정정보 로딩
  227. *
  228. * arguments
  229. *
  230. * return
  231. * void
  232. */
  233. void __fastcall TITS00MAP::LoadConfig()
  234. {
  235. #if 0
  236. TIniFile *pIniFile = NULL;
  237. String sIniFile = ChangeFileExt(ExtractFileName(Application->ExeName), ".ini");
  238. String sCfgFile = ExtractFilePath(Application->ExeName) + "\\cfg\\" + sIniFile;
  239. try
  240. {
  241. try
  242. {
  243. pIniFile = new TIniFile(sCfgFile);
  244. // 표출이미지 로딩
  245. //LoadImageFile(pIniFile->ReadString("IMAGE", "CENTER", ""), ImgOffice);
  246. LoadImageFile(pIniFile->ReadString("IMAGE", "RSE_N", ""), ImgRseN);
  247. LoadImageFile(pIniFile->ReadString("IMAGE", "RSE_C", ""), ImgRseC);
  248. LoadImageFile(pIniFile->ReadString("IMAGE", "CCTV_N", ""), ImgCctvN);
  249. LoadImageFile(pIniFile->ReadString("IMAGE", "CCTV_C", ""), ImgCctvC);
  250. LoadImageFile(pIniFile->ReadString("IMAGE", "CCTV_M", ""), ImgCctvM);
  251. LoadImageFile(pIniFile->ReadString("IMAGE", "VMS_N", ""), ImgVmsN);
  252. LoadImageFile(pIniFile->ReadString("IMAGE", "VMS_C", ""), ImgVmsC);
  253. LoadImageFile(pIniFile->ReadString("IMAGE", "VMS_M", ""), ImgVmsM);
  254. LoadImageFile(pIniFile->ReadString("IMAGE", "INC_01", ""), ImgInc01);
  255. LoadImageFile(pIniFile->ReadString("IMAGE", "INC_02", ""), ImgInc02);
  256. LoadImageFile(pIniFile->ReadString("IMAGE", "INC_03", ""), ImgInc03);
  257. LoadImageFile(pIniFile->ReadString("IMAGE", "INC_04", ""), ImgInc04);
  258. }
  259. __finally
  260. {
  261. if (pIniFile) delete pIniFile;
  262. pIniFile = NULL;
  263. }
  264. }
  265. catch(...)
  266. {
  267. }
  268. #endif
  269. }
  270. //---------------------------------------------------------------------------
  271. void __fastcall TITS00MAP::CreateToolTip()
  272. {
  273. if (NULL == m_objToolTip)
  274. {
  275. m_objToolTip = new TzHintWindow(this);
  276. m_objToolTip->FHint->Font->Name = "돋움체";
  277. m_objToolTip->FHint->Font->Size = 9;
  278. //xclntMap->ToolTipFont->Size = 9;
  279. xclntMap->SetDisplayFontSize(9);
  280. m_objToolTip->DoubleBuffered = true;
  281. }
  282. }
  283. //---------------------------------------------------------------------------
  284. void __fastcall TITS00MAP::ClearToolTip()
  285. {
  286. if (m_objToolTip)
  287. {
  288. if (m_objToolTip->HandleAllocated())
  289. m_objToolTip->ReleaseHandle();
  290. m_objToolTip->FHint->ColorArrowBackground = (TColor)0x41CAFF;
  291. }
  292. }
  293. //---------------------------------------------------------------------------
  294. void __fastcall TITS00MAP::LoadImageFile(String sImgFile, TImage *pImage)
  295. {
  296. if (sImgFile.Trim() == "") return;
  297. try
  298. {
  299. ImgTemp->Picture->Assign(NULL);
  300. ImgTemp->Picture->LoadFromFile(sImgFile);
  301. pImage->Picture->Assign(pImage->Picture);
  302. ImgTemp->Picture->Assign(NULL);
  303. }
  304. catch(...)
  305. {
  306. }
  307. }
  308. //---------------------------------------------------------------------------
  309. /*
  310. * 메인화면 FormDestroy시 호출되는 Method
  311. * Form의 자원이 해제 되기 이전에 반드시 이 Method가 호출된다.
  312. * 그러므로 최종적으로 자원을 해제 하고자 한다면 이곳에서 처리하는게 확실함.
  313. * parameter
  314. * Sender : Event를 보낸 객체
  315. * return
  316. * None
  317. */
  318. void __fastcall TITS00MAP::FormDestroy(TObject *Sender)
  319. {
  320. try
  321. {
  322. for (int ii = 0; ii < MAX_LAYERS; ii++)
  323. {
  324. if (m_pLinkSpeedUpdate[ii] == NULL) continue;
  325. try {
  326. m_pLinkSpeedUpdate[ii]->isRuning = false;
  327. m_pLinkSpeedUpdate[ii]->Terminate();
  328. //free(m_pLinkSpeedUpdate[ii]);
  329. } catch(...) {}
  330. }
  331. if (m_slLinkFldName != NULL) delete m_slLinkFldName;
  332. if (m_slLinkFldValue != NULL) delete m_slLinkFldValue;
  333. if (m_slFldName != NULL) delete m_slFldName;
  334. if (m_slFldValue != NULL) delete m_slFldValue;
  335. if (m_slToolTip != NULL) delete m_slToolTip;
  336. if (m_objToolTip != NULL) delete m_objToolTip;
  337. if (xclntMap->Active) xclntMap->Active = false;
  338. if (xsrvrMap->Active) xsrvrMap->Active = false;
  339. }
  340. catch (...)
  341. {
  342. }
  343. ::CoUninitialize();
  344. }
  345. //---------------------------------------------------------------------------
  346. /*
  347. * form을 보여줄때 호출되는 event 메서드이다.
  348. * arguments
  349. * Sender : event handler 객체
  350. * return
  351. * void
  352. */
  353. void __fastcall TITS00MAP::FormShow(TObject *Sender)
  354. {
  355. Refresh();
  356. FormInit();
  357. Application->ProcessMessages();
  358. TmrShow->Enabled = true;
  359. }
  360. //---------------------------------------------------------------------------
  361. /*
  362. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  363. * Form과 DataModule class를 delete시킨다.
  364. * arguments
  365. *
  366. * return
  367. * void
  368. */
  369. void __fastcall TITS00MAP::CommClose()
  370. {
  371. //ITS00MAP = NULL;
  372. //::CoUninitialize();
  373. }
  374. //---------------------------------------------------------------------------
  375. /*
  376. * Form의 초기화 작업을 수행한다.
  377. * arguments
  378. * void
  379. * return
  380. * void
  381. */
  382. bool __fastcall TITS00MAP::FormInit()
  383. {
  384. memset((char*)&m_PrevExt, 0x00, sizeof(m_PrevExt));
  385. memset((char*)&m_ExtQ, 0x00, sizeof(m_ExtQ));
  386. m_ExtQ.bExtent = true;
  387. m_ExtQ.userIdx = 0;
  388. m_ExtQ.currIdx = 0;
  389. return true;
  390. }
  391. //---------------------------------------------------------------------------
  392. /*
  393. * Form의 Skin 초기화 작업을 수행한다.
  394. * arguments
  395. * void
  396. * return
  397. * void
  398. */
  399. void __fastcall TITS00MAP::LoadLocalSkin()
  400. {
  401. //PnlMenu->ParentColor = false;
  402. //PnlMenu->Color = 0x00FF9D62;
  403. PnlTrf00->ParentColor = false;
  404. PnlTrf00->Color = clSilver;
  405. PnlTrf01->ParentColor = false;
  406. PnlTrf01->Color = clLime;
  407. PnlTrf02->ParentColor = false;
  408. PnlTrf02->Color = clYellow;
  409. PnlTrf03->ParentColor = false;
  410. PnlTrf03->Color = clRed;
  411. /*
  412. * GIS Command button skin
  413. */
  414. TImage *pImgZoomIn_n;
  415. TImage *pImgZoomIn_c;
  416. TImage *pImgCenter_n;
  417. TImage *pImgCenter_c;
  418. TImage *pImgPrev_c;
  419. TImage *pImgPrev_n;
  420. TImage *pImgSel_n;
  421. TImage *pImgSel_c;
  422. TImage *pImgDist_n;
  423. TImage *pImgCircle_c;
  424. TImage *pImgCircle_n;
  425. TImage *pImgDist_c;
  426. TImage *pImgStnd_n;
  427. TImage *pImgSave_c;
  428. TImage *pImgSave_n;
  429. TImage *pImgStnd_c;
  430. TImage *pImgZoomOut_n;
  431. TImage *pImgZoomOut_c;
  432. TImage *pImgPan_c;
  433. TImage *pImgPan_n;
  434. TImage *pImgNext_n;
  435. TImage *pImgNext_c;
  436. TImage *pImgBoundary_c;
  437. TImage *pImgBoundary_n;
  438. TImage *pImgSquare_n;
  439. TImage *pImgSquare_c;
  440. TImage *pImgFull_c;
  441. TImage *pImgFull_n;
  442. TImage *pImgRefresh_n;
  443. TImage *pImgRefresh_c;
  444. TImage *pImgPrint_c;
  445. TImage *pImgPrint_n;
  446. int nSkin = 1;
  447. switch (nSkin)
  448. {
  449. case 10:
  450. pImgZoomIn_n = ImgZoomIn_c;
  451. pImgZoomIn_c = ImgZoomIn_n;
  452. pImgZoomOut_n = ImgZoomOut_c;
  453. pImgZoomOut_c = ImgZoomOut_n;
  454. pImgCenter_n = ImgCenter_c;
  455. pImgCenter_c = ImgCenter_n;
  456. pImgPan_c = ImgPan_n;
  457. pImgPan_n = ImgPan_c;
  458. pImgPrev_c = ImgPrev_n;
  459. pImgPrev_n = ImgPrev_c;
  460. pImgNext_n = ImgNext_c;
  461. pImgNext_c = ImgNext_n;
  462. pImgBoundary_c = ImgBoundary_n;
  463. pImgBoundary_n = ImgBoundary_c;
  464. pImgSel_n = ImgSel_c;
  465. pImgSel_c = ImgSel_n;
  466. pImgDist_n = ImgDist_c;
  467. pImgDist_c = ImgDist_n;
  468. pImgSquare_n = ImgSquare_c;
  469. pImgSquare_c = ImgSquare_n;
  470. pImgCircle_c = ImgCircle_n;
  471. pImgCircle_n = ImgCircle_c;
  472. pImgFull_c = ImgFull_n;
  473. pImgFull_n = ImgFull_c;
  474. pImgStnd_n = ImgStnd_c;
  475. pImgStnd_c = ImgStnd_n;
  476. pImgRefresh_n = ImgRefresh_c;
  477. pImgRefresh_c = ImgRefresh_n;
  478. pImgPrint_c = ImgPrint_n;
  479. pImgPrint_n = ImgPrint_c;
  480. pImgSave_c = ImgSave_n;
  481. pImgSave_n = ImgSave_c;
  482. break;
  483. case 1: case 2: case 3: case 0:
  484. case 4: case 5: default:
  485. pImgZoomIn_n = ImgZoomIn_n;
  486. pImgZoomIn_c = ImgZoomIn_c;
  487. pImgZoomOut_n = ImgZoomOut_n;
  488. pImgZoomOut_c = ImgZoomOut_c;
  489. pImgCenter_n = ImgCenter_n;
  490. pImgCenter_c = ImgCenter_c;
  491. pImgPan_c = ImgPan_c;
  492. pImgPan_n = ImgPan_n;
  493. pImgPrev_c = ImgPrev_c;
  494. pImgPrev_n = ImgPrev_n;
  495. pImgNext_n = ImgNext_n;
  496. pImgNext_c = ImgNext_c;
  497. pImgBoundary_c = ImgBoundary_c;
  498. pImgBoundary_n = ImgBoundary_n;
  499. pImgSel_n = ImgSel_n;
  500. pImgSel_c = ImgSel_c;
  501. pImgDist_n = ImgDist_n;
  502. pImgDist_c = ImgDist_c;
  503. pImgSquare_n = ImgSquare_n;
  504. pImgSquare_c = ImgSquare_c;
  505. pImgCircle_c = ImgCircle_c;
  506. pImgCircle_n = ImgCircle_n;
  507. pImgFull_c = ImgFull_c;
  508. pImgFull_n = ImgFull_n;
  509. pImgStnd_n = ImgStnd_n;
  510. pImgStnd_c = ImgStnd_c;
  511. pImgRefresh_n = ImgRefresh_n;
  512. pImgRefresh_c = ImgRefresh_c;
  513. pImgPrint_c = ImgPrint_c;
  514. pImgPrint_n = ImgPrint_n;
  515. pImgSave_c = ImgSave_c;
  516. pImgSave_n = ImgSave_n;
  517. break;
  518. }
  519. try
  520. {
  521. ImgZoomIn->NormalPicture->Assign(pImgZoomIn_n->Picture);
  522. ImgZoomIn->Picture->Assign(pImgZoomIn_n->Picture);
  523. ImgZoomIn->TogglePicture->Assign(pImgZoomIn_c->Picture);
  524. ImgZoomIn->ClickedPicture->Assign(pImgZoomIn_n->Picture);
  525. ImgZoomOut->NormalPicture->Assign(pImgZoomOut_n->Picture);
  526. ImgZoomOut->Picture->Assign(pImgZoomOut_n->Picture);
  527. ImgZoomOut->TogglePicture->Assign(pImgZoomOut_c->Picture);
  528. ImgZoomOut->ClickedPicture->Assign(pImgZoomOut_n->Picture);
  529. ImgCenter->NormalPicture->Assign(pImgCenter_n->Picture);
  530. ImgCenter->Picture->Assign(pImgCenter_n->Picture);
  531. ImgCenter->TogglePicture->Assign(pImgCenter_c->Picture);
  532. ImgCenter->ClickedPicture->Assign(pImgCenter_n->Picture);
  533. ImgPan->NormalPicture->Assign(pImgPan_n->Picture);
  534. ImgPan->Picture->Assign(pImgPan_n->Picture);
  535. ImgPan->TogglePicture->Assign(pImgPan_c->Picture);
  536. ImgPan->ClickedPicture->Assign(pImgPan_n->Picture);
  537. ImgPrev->NormalPicture->Assign(pImgPrev_n->Picture);
  538. ImgPrev->Picture->Assign(pImgPrev_n->Picture);
  539. ImgPrev->TogglePicture->Assign(pImgPrev_c->Picture);
  540. ImgPrev->ClickedPicture->Assign(pImgPrev_n->Picture);
  541. ImgNext->NormalPicture->Assign(pImgNext_n->Picture);
  542. ImgNext->Picture->Assign(pImgNext_n->Picture);
  543. ImgNext->TogglePicture->Assign(pImgNext_c->Picture);
  544. ImgNext->ClickedPicture->Assign(pImgNext_n->Picture);
  545. ImgPrev->Cursor = crHandPoint;
  546. ImgNext->Cursor = crHandPoint;
  547. ImgBoundary->NormalPicture->Assign(pImgBoundary_n->Picture);
  548. ImgBoundary->Picture->Assign(pImgBoundary_n->Picture);
  549. ImgBoundary->TogglePicture->Assign(pImgBoundary_c->Picture);
  550. ImgBoundary->ClickedPicture->Assign(pImgBoundary_n->Picture);
  551. ImgSel->NormalPicture->Assign(pImgSel_n->Picture);
  552. ImgSel->Picture->Assign(pImgSel_n->Picture);
  553. ImgSel->TogglePicture->Assign(pImgSel_c->Picture);
  554. ImgSel->ClickedPicture->Assign(pImgSel_n->Picture);
  555. ImgDist->NormalPicture->Assign(pImgDist_n->Picture);
  556. ImgDist->Picture->Assign(pImgDist_n->Picture);
  557. ImgDist->TogglePicture->Assign(pImgDist_c->Picture);
  558. ImgDist->ClickedPicture->Assign(pImgDist_n->Picture);
  559. ImgSquare->NormalPicture->Assign(pImgSquare_n->Picture);
  560. ImgSquare->Picture->Assign(pImgSquare_n->Picture);
  561. ImgSquare->TogglePicture->Assign(pImgSquare_c->Picture);
  562. ImgSquare->ClickedPicture->Assign(pImgSquare_n->Picture);
  563. ImgCircle->NormalPicture->Assign(pImgCircle_n->Picture);
  564. ImgCircle->Picture->Assign(pImgCircle_n->Picture);
  565. ImgCircle->TogglePicture->Assign(pImgCircle_c->Picture);
  566. ImgCircle->ClickedPicture->Assign(pImgCircle_n->Picture);
  567. ImgFull->NormalPicture->Assign(pImgFull_n->Picture);
  568. ImgFull->Picture->Assign(pImgFull_n->Picture);
  569. ImgFull->TogglePicture->Assign(pImgFull_c->Picture);
  570. ImgFull->ClickedPicture->Assign(pImgFull_n->Picture);
  571. ImgStnd->NormalPicture->Assign(pImgStnd_n->Picture);
  572. ImgStnd->Picture->Assign(pImgStnd_n->Picture);
  573. ImgStnd->TogglePicture->Assign(pImgStnd_c->Picture);
  574. ImgStnd->ClickedPicture->Assign(pImgStnd_n->Picture);
  575. ImgRefresh->NormalPicture->Assign(pImgRefresh_n->Picture);
  576. ImgRefresh->Picture->Assign(pImgRefresh_n->Picture);
  577. ImgRefresh->TogglePicture->Assign(pImgRefresh_c->Picture);
  578. ImgRefresh->ClickedPicture->Assign(pImgRefresh_n->Picture);
  579. ImgPrint->NormalPicture->Assign(pImgPrint_n->Picture);
  580. ImgPrint->Picture->Assign(pImgPrint_n->Picture);
  581. ImgPrint->TogglePicture->Assign(pImgPrint_c->Picture);
  582. ImgPrint->ClickedPicture->Assign(pImgPrint_n->Picture);
  583. ImgSave->NormalPicture->Assign(pImgSave_n->Picture);
  584. ImgSave->Picture->Assign(pImgSave_n->Picture);
  585. ImgSave->TogglePicture->Assign(pImgSave_c->Picture);
  586. ImgSave->ClickedPicture->Assign(pImgSave_n->Picture);
  587. }
  588. catch(...)
  589. {
  590. }
  591. }
  592. //---------------------------------------------------------------------------
  593. void __fastcall TITS00MAP::TmrShowTimer(TObject *Sender)
  594. {
  595. TmrShow->Enabled = false;
  596. Application->ProcessMessages();
  597. LoadGisMap();
  598. Application->ProcessMessages();
  599. UpdateFacilityStatus();
  600. Application->ProcessMessages();
  601. UpdateIncidentStatus();
  602. }
  603. //---------------------------------------------------------------------------
  604. /*
  605. * 지도데이터 로드 및 프로그램 초기화 작업 수행
  606. * arguments
  607. *
  608. * return
  609. *
  610. */
  611. void __fastcall TITS00MAP::LoadGisMap()
  612. {
  613. try
  614. {
  615. xsrvrMap->Active = false;
  616. xclntMap->Active = false;
  617. }
  618. catch (...)
  619. {
  620. }
  621. if (!g_GisInfo.bLoadL0) return;
  622. try
  623. {
  624. try
  625. {
  626. // 지도로딩 상태바 표출
  627. PnlProgress->Left = (this->Width - PnlProgress->Width) / 2;
  628. PnlProgress->Top = (this->Height - PnlProgress->Height) / 2;
  629. PnlProgress->Top -= 50;
  630. PnlProgress->Visible = true;
  631. PbLoadMap->Properties->Text = "전자지도 표출색상 정보 로딩 중...";
  632. Application->ProcessMessages();
  633. PbLoadMap->Position = 50;
  634. TUTISLinkGrade UtisLinkColor;
  635. GetGisTrafficColor(UtisLinkColor);
  636. PbLoadMap->Position = 100;
  637. PbLoadMap->Properties->Text = "전자지도 로딩 중...";
  638. Application->ProcessMessages();
  639. // start server
  640. xsrvrMap->DVAFileName = g_GisInfo.sMapFileNameL0;
  641. xsrvrMap->ShowLoadBar = false;
  642. xsrvrMap->UseMem = true;
  643. xsrvrMap->Active = true;
  644. xsrvrMap->AutoSave = true;
  645. //xsrvrMap->SetFullExtent(DDRect(g_GisInfo.dRightBottomX, g_GisInfo.dLeftTopX, g_GisInfo.dRightBottomY, g_GisInfo.dLeftTopY));
  646. xsrvrMap->SaveLayerInfo();
  647. // start client
  648. if (!xsrvrMap->Active)
  649. {
  650. ShowMessage("Xr Server Start Failed...");
  651. return;
  652. }
  653. TXiMapBufferSize LineBuffer;
  654. LineBuffer = xsrvrMap->GetLineBufferSize();
  655. LineBuffer.Level1 = 3;
  656. LineBuffer.Level2 = 3;
  657. LineBuffer.Level3 = 3;
  658. LineBuffer.Level4 = 3;
  659. LineBuffer.Level5 = 3;
  660. LineBuffer.Level6 = 4;
  661. LineBuffer.Level7 = 4;
  662. xsrvrMap->SetLineBufferSize(LineBuffer);
  663. xclntMap->DoubleBuffered = true;
  664. xclntMap->Start(DDRect(g_GisInfo.dRightBottomX, g_GisInfo.dLeftTopX, g_GisInfo.dRightBottomY, g_GisInfo.dLeftTopY));
  665. xclntMap->MapPanMode = PMDynamic;
  666. xclntMap->MaxZoomValue = 0.001;
  667. xclntMap->BoolIconScale = true;
  668. xclntMap->Show();
  669. // 전자지도 도로등급 정보를 업데이트
  670. UpdateGisRoadRank();
  671. // 소통정보를 표출할 스레드 생성
  672. for (int ii = 0; ii < MAX_LAYERS; ii++)
  673. {
  674. m_pLinkSpeedUpdate[ii] = NULL;
  675. }
  676. int nLayerIndex;
  677. nLayerIndex = xclntMap->GetLayerIndex(LEVEL1_LINK_LAYER_NAME);
  678. if (nLayerIndex >= 0)
  679. {
  680. m_pLinkSpeedUpdate[nLayerIndex] = new TXiLinkSpeedUpdate(xclntMap, nLayerIndex, 5 * 60);
  681. m_pLinkSpeedUpdate[nLayerIndex]->SetDBConString(ITSDb_GetConnection()->ConnectionString);
  682. m_pLinkSpeedUpdate[nLayerIndex]->SetDBQryString (LEVEL1_TRAFFIC_SQL);
  683. m_pLinkSpeedUpdate[nLayerIndex]->SetDefaultLinkColor();
  684. m_pLinkSpeedUpdate[nLayerIndex]->SetUTISLinkColor(UtisLinkColor);
  685. try{
  686. m_pLinkSpeedUpdate[nLayerIndex]->Resume();
  687. }catch(Exception &err){throw(err);}
  688. m_pLinkSpeedUpdate[nLayerIndex]->isRuning = true;
  689. }
  690. nLayerIndex = xclntMap->GetLayerIndex(LEVEL2_LINK_LAYER_NAME);
  691. if (nLayerIndex >= 0)
  692. {
  693. m_pLinkSpeedUpdate[nLayerIndex] = new TXiLinkSpeedUpdate(xclntMap, nLayerIndex, 5 * 60);
  694. m_pLinkSpeedUpdate[nLayerIndex]->SetDBConString(ITSDb_GetConnection()->ConnectionString);
  695. m_pLinkSpeedUpdate[nLayerIndex]->SetDBQryString (LEVEL2_TRAFFIC_SQL);
  696. m_pLinkSpeedUpdate[nLayerIndex]->SetDefaultLinkColor();
  697. m_pLinkSpeedUpdate[nLayerIndex]->SetUTISLinkColor(UtisLinkColor);
  698. try{
  699. m_pLinkSpeedUpdate[nLayerIndex]->Resume();
  700. }catch(Exception &err){throw(err);}
  701. m_pLinkSpeedUpdate[nLayerIndex]->isRuning = true;
  702. }
  703. nLayerIndex = xclntMap->GetLayerIndex(LEVEL3_LINK_LAYER_NAME);
  704. if (nLayerIndex >= 0)
  705. {
  706. m_pLinkSpeedUpdate[nLayerIndex] = new TXiLinkSpeedUpdate(xclntMap, nLayerIndex, 5 * 60);
  707. m_pLinkSpeedUpdate[nLayerIndex]->SetDBConString(ITSDb_GetConnection()->ConnectionString);
  708. m_pLinkSpeedUpdate[nLayerIndex]->SetDBQryString (LEVEL3_TRAFFIC_SQL);
  709. m_pLinkSpeedUpdate[nLayerIndex]->SetDefaultLinkColor();
  710. m_pLinkSpeedUpdate[nLayerIndex]->SetUTISLinkColor(UtisLinkColor);
  711. try{
  712. m_pLinkSpeedUpdate[nLayerIndex]->Resume();
  713. }catch(Exception &err){throw(err);}
  714. m_pLinkSpeedUpdate[nLayerIndex]->isRuning = true;
  715. }
  716. //레이어정보설정 AAAAA
  717. TDVAInfo DVAInfo;
  718. nLayerIndex = xsrvrMap->GetLayerIndex(LEVEL1_LINK_LAYER_NAME);
  719. if (nLayerIndex >= 0)
  720. {
  721. xsrvrMap->GetDVAInfo(nLayerIndex, DVAInfo);
  722. for (int ii = DVAInfo.pDVAinfo.FSLevel; ii <= DVAInfo.pDVAinfo.FELevel; ii++)
  723. {
  724. g_nLinkLyrLevel[ii-1] = 1;
  725. g_sLinkLyrName[ii-1] = LEVEL1_LINK_LAYER_NAME;
  726. g_sNodeLyrName[ii-1] = LEVEL1_NODE_LAYER_NAME;
  727. }
  728. }
  729. nLayerIndex = xsrvrMap->GetLayerIndex(LEVEL2_LINK_LAYER_NAME);
  730. if (nLayerIndex >= 0)
  731. {
  732. xsrvrMap->GetDVAInfo(nLayerIndex, DVAInfo);
  733. for (int ii = DVAInfo.pDVAinfo.FSLevel; ii <= DVAInfo.pDVAinfo.FELevel; ii++)
  734. {
  735. g_nLinkLyrLevel[ii-1] = 2;
  736. g_sLinkLyrName[ii-1] = LEVEL2_LINK_LAYER_NAME;
  737. g_sNodeLyrName[ii-1] = LEVEL2_NODE_LAYER_NAME;
  738. }
  739. }
  740. nLayerIndex = xsrvrMap->GetLayerIndex(LEVEL3_LINK_LAYER_NAME);
  741. if (nLayerIndex >= 0)
  742. {
  743. xsrvrMap->GetDVAInfo(nLayerIndex, DVAInfo);
  744. for (int ii = DVAInfo.pDVAinfo.FSLevel; ii <= DVAInfo.pDVAinfo.FELevel; ii++)
  745. {
  746. g_nLinkLyrLevel[ii-1] = 3;
  747. g_sLinkLyrName[ii-1] = LEVEL3_LINK_LAYER_NAME;
  748. g_sNodeLyrName[ii-1] = LEVEL3_NODE_LAYER_NAME;
  749. }
  750. }
  751. //xclntMap->FullReDraw(); // 지도를 전체 다시 그린다.
  752. pmuControlGisClick((TObject*)pmuMove); // 전자지도 마우스이벤트를 이동으로 설정
  753. }
  754. catch (...)
  755. {
  756. }
  757. }
  758. __finally
  759. {
  760. PnlProgress->Visible = false;
  761. }
  762. }
  763. //---------------------------------------------------------------------------
  764. void __fastcall TITS00MAP::xsrvrMapEntityAdd(TObject *Sender, AnsiString EntityName, int TotalCnt, int CurCnt)
  765. {
  766. PbLoadMap->Position = ((float)CurCnt / TotalCnt) * 100;
  767. //Application->ProcessMessages();
  768. }
  769. //---------------------------------------------------------------------------
  770. void __fastcall TITS00MAP::GetGisTrafficColor(TUTISLinkGrade &pUtisLinkColor)
  771. {
  772. //TJobTick job("GetGisTrafficColor");
  773. // 고속도로
  774. pUtisLinkColor.road101.GDLOW.SpdCOLOR = clRed;
  775. pUtisLinkColor.road101.GDLOW.MinSpeed = 0;
  776. pUtisLinkColor.road101.GDLOW.MaxSpeed = 30;
  777. pUtisLinkColor.road101.GDMID.SpdCOLOR = clYellow;
  778. pUtisLinkColor.road101.GDMID.MinSpeed = 31;
  779. pUtisLinkColor.road101.GDMID.MaxSpeed = 70;
  780. pUtisLinkColor.road101.GDHIG.SpdCOLOR = clLime;
  781. pUtisLinkColor.road101.GDHIG.MinSpeed = 71;
  782. pUtisLinkColor.road101.GDHIG.MaxSpeed = 255;
  783. // 자동차전용도로
  784. pUtisLinkColor.road102.GDLOW.SpdCOLOR = clRed;
  785. pUtisLinkColor.road102.GDLOW.MinSpeed = 0;
  786. pUtisLinkColor.road102.GDLOW.MaxSpeed = 30;
  787. pUtisLinkColor.road102.GDMID.SpdCOLOR = clYellow;
  788. pUtisLinkColor.road102.GDMID.MinSpeed = 31;
  789. pUtisLinkColor.road102.GDMID.MaxSpeed = 50;
  790. pUtisLinkColor.road102.GDHIG.SpdCOLOR = clLime;
  791. pUtisLinkColor.road102.GDHIG.MinSpeed = 51;
  792. pUtisLinkColor.road102.GDHIG.MaxSpeed = 255;
  793. // 일반국도
  794. pUtisLinkColor.road103.GDLOW.SpdCOLOR = clRed;
  795. pUtisLinkColor.road103.GDLOW.MinSpeed = 0;
  796. pUtisLinkColor.road103.GDLOW.MaxSpeed = 10;
  797. pUtisLinkColor.road103.GDMID.SpdCOLOR = clYellow;
  798. pUtisLinkColor.road103.GDMID.MinSpeed = 11;
  799. pUtisLinkColor.road103.GDMID.MaxSpeed = 20;
  800. pUtisLinkColor.road103.GDHIG.SpdCOLOR = clLime;
  801. pUtisLinkColor.road103.GDHIG.MinSpeed = 21;
  802. pUtisLinkColor.road103.GDHIG.MaxSpeed = 255;
  803. // 특별, 광역시도
  804. pUtisLinkColor.road104.GDLOW.SpdCOLOR = clRed;
  805. pUtisLinkColor.road104.GDLOW.MinSpeed = 0;
  806. pUtisLinkColor.road104.GDLOW.MaxSpeed = 10;
  807. pUtisLinkColor.road104.GDMID.SpdCOLOR = clYellow;
  808. pUtisLinkColor.road104.GDMID.MinSpeed = 11;
  809. pUtisLinkColor.road104.GDMID.MaxSpeed = 20;
  810. pUtisLinkColor.road104.GDHIG.SpdCOLOR = clLime;
  811. pUtisLinkColor.road104.GDHIG.MinSpeed = 21;
  812. pUtisLinkColor.road104.GDHIG.MaxSpeed = 255;
  813. // 국가지원지방도
  814. pUtisLinkColor.road105.GDLOW.SpdCOLOR = clRed;
  815. pUtisLinkColor.road105.GDLOW.MinSpeed = 0;
  816. pUtisLinkColor.road105.GDLOW.MaxSpeed = 10;
  817. pUtisLinkColor.road105.GDMID.SpdCOLOR = clYellow;
  818. pUtisLinkColor.road105.GDMID.MinSpeed = 11;
  819. pUtisLinkColor.road105.GDMID.MaxSpeed = 20;
  820. pUtisLinkColor.road105.GDHIG.SpdCOLOR = clLime;
  821. pUtisLinkColor.road105.GDHIG.MinSpeed = 21;
  822. pUtisLinkColor.road105.GDHIG.MaxSpeed = 255;
  823. // 지방도
  824. pUtisLinkColor.road106.GDLOW.SpdCOLOR = clRed;
  825. pUtisLinkColor.road106.GDLOW.MinSpeed = 0;
  826. pUtisLinkColor.road106.GDLOW.MaxSpeed = 10;
  827. pUtisLinkColor.road106.GDMID.SpdCOLOR = clYellow;
  828. pUtisLinkColor.road106.GDMID.MinSpeed = 11;
  829. pUtisLinkColor.road106.GDMID.MaxSpeed = 20;
  830. pUtisLinkColor.road106.GDHIG.SpdCOLOR = clLime;
  831. pUtisLinkColor.road106.GDHIG.MinSpeed = 21;
  832. pUtisLinkColor.road106.GDHIG.MaxSpeed = 255;
  833. // 시군도
  834. pUtisLinkColor.road107.GDLOW.SpdCOLOR = clRed;
  835. pUtisLinkColor.road107.GDLOW.MinSpeed = 0;
  836. pUtisLinkColor.road107.GDLOW.MaxSpeed = 10;
  837. pUtisLinkColor.road107.GDMID.SpdCOLOR = clYellow;
  838. pUtisLinkColor.road107.GDMID.MinSpeed = 11;
  839. pUtisLinkColor.road107.GDMID.MaxSpeed = 20;
  840. pUtisLinkColor.road107.GDHIG.SpdCOLOR = clLime;
  841. pUtisLinkColor.road107.GDHIG.MinSpeed = 21;
  842. pUtisLinkColor.road107.GDHIG.MaxSpeed = 255;
  843. TDBLinkColor *pLinkColor = NULL;
  844. TLinkTrfGrd *pTrgGrd = NULL;
  845. FOR_STL(TItsTrafficGrade *, pGrade, ItsTrafficGradeManager->FLists)
  846. {
  847. FOR_STL(TItsTrafficSubGrade *, pSubGrade, pGrade->FSubLists)
  848. {
  849. if (pGrade->SECT_GRAD_CD == "SRT1") //101.고속국도
  850. pLinkColor = &pUtisLinkColor.road101;
  851. else
  852. if (pGrade->SECT_GRAD_CD == "SRT2") //102.도시고속국도
  853. pLinkColor = &pUtisLinkColor.road102;
  854. else
  855. if (pGrade->SECT_GRAD_CD == "SRT3") //103.일반국도
  856. pLinkColor = &pUtisLinkColor.road103;
  857. else
  858. if (pGrade->SECT_GRAD_CD == "SRT4") //104.특별·광역시도
  859. pLinkColor = &pUtisLinkColor.road104;
  860. else
  861. if (pGrade->SECT_GRAD_CD == "SRT5") //105.국가지원지방도
  862. pLinkColor = &pUtisLinkColor.road105;
  863. else
  864. if (pGrade->SECT_GRAD_CD == "SRT6") //106.지방도
  865. pLinkColor = &pUtisLinkColor.road106;
  866. else
  867. if (pGrade->SECT_GRAD_CD == "SRT7") //107.시·군도
  868. pLinkColor = &pUtisLinkColor.road107;
  869. else
  870. continue;
  871. TColor trfColor;
  872. if (pSubGrade->CMTR_GRAD_CD == "LTC1")
  873. {
  874. pTrgGrd = &pLinkColor->GDHIG;
  875. trfColor = clLime;
  876. }
  877. else
  878. if (pSubGrade->CMTR_GRAD_CD == "LTC2")
  879. {
  880. pTrgGrd = &pLinkColor->GDMID;
  881. trfColor = clYellow;
  882. }
  883. else
  884. if (pSubGrade->CMTR_GRAD_CD == "LTC3")
  885. {
  886. pTrgGrd = &pLinkColor->GDLOW;
  887. trfColor = clRed;
  888. }
  889. else
  890. continue;
  891. pTrgGrd->SpdCOLOR = trfColor;
  892. if (pSubGrade->CMTR_GRAD_CD == "LTC3")
  893. pTrgGrd->MinSpeed = 0;
  894. else
  895. pTrgGrd->MinSpeed = StrToInt(pSubGrade->LWST_TRVL_SPED);
  896. pTrgGrd->MaxSpeed = StrToInt(pSubGrade->HGHS_TRVL_SPED);
  897. }
  898. }
  899. }
  900. //---------------------------------------------------------------------------
  901. void __fastcall TITS00MAP::SetGisTrafficColor()
  902. {
  903. TUTISLinkGrade UtisLinkColor;
  904. GetGisTrafficColor(UtisLinkColor);
  905. // 소통정보를 표출할 스레드 생성
  906. for (int ii = 0; ii < MAX_LAYERS; ii++)
  907. {
  908. if (m_pLinkSpeedUpdate[ii] == NULL) continue;
  909. m_pLinkSpeedUpdate[ii]->SetUTISLinkColor(UtisLinkColor);
  910. }
  911. }
  912. //---------------------------------------------------------------------------
  913. void __fastcall TITS00MAP::GisMenuCheckClear()
  914. {
  915. xclntMap->MapOperation = Nothing;
  916. pmuZoomIn->Checked = false;
  917. pmuZoomOut->Checked = false;
  918. pmuMove->Checked = false;
  919. pmuIconSel->Checked = false;
  920. pmuCalLen->Checked = false;
  921. pmuCalArea->Checked = false;
  922. pmuRadius->Checked = false;
  923. pmuMoveCenter->Checked = false;
  924. pmuGisDefault->Checked = false;
  925. }
  926. //---------------------------------------------------------------------------
  927. void __fastcall TITS00MAP::pmuGisCalcClick(TObject *Sender)
  928. {
  929. TMenuItem *pMenu = (TMenuItem *)Sender;
  930. SetMapOperation((TXiMapOperation)pMenu->Tag);
  931. }
  932. //---------------------------------------------------------------------------
  933. void __fastcall TITS00MAP::pmuControlGisClick(TObject *Sender)
  934. {
  935. TMenuItem *pMenu = (TMenuItem*)Sender;
  936. SetMapOperation((TXiMapOperation)pMenu->Tag);
  937. }
  938. //---------------------------------------------------------------------------
  939. /*
  940. * 지도제어 설정
  941. * arguments
  942. *
  943. * return
  944. *
  945. */
  946. void __fastcall TITS00MAP::SetMapOperation(TXiMapOperation nMapOper)
  947. {
  948. //enum TXiMapOperation { Nothing, OnZoomIn, OnZoomOut, OnPanSt, OnDistance, OnSelect, OnGeoQuery, OnEditting, OnCircle, OnShortPath, OnArea, OnInsert, OnFindEvent, OnNearFind, OnUserDefine };
  949. GisMenuCheckClear();
  950. m_bMoveCenter = false;
  951. m_bCalcMode = false;
  952. m_bCalcCont = false;
  953. xclntMap->MapOperation = nMapOper;
  954. if (OnSelect == nMapOper)
  955. {
  956. GrpPos->Visible = true;
  957. }
  958. else
  959. {
  960. GrpPos->Visible = false;
  961. }
  962. switch(nMapOper)
  963. {
  964. case OnZoomIn: pmuZoomIn->Checked = true; break;
  965. case OnZoomOut: pmuZoomOut->Checked = true; break;
  966. case OnPanSt: pmuMove->Checked = true; break;
  967. case OnSelect: pmuIconSel->Checked = true; break;
  968. case OnDistance: pmuCalLen->Checked = true; m_bCalcMode = true; break;
  969. case OnCircle: pmuRadius->Checked = true; m_bCalcMode = true; break;
  970. case OnArea: pmuCalArea->Checked = true; m_bCalcMode = true; break;
  971. case OnUserDefine: pmuMoveCenter->Checked = true; m_bMoveCenter = true; //중심이동일 경우에는 모드를 Nothing으로 설정한다.
  972. default:
  973. xclntMap->MapOperation = Nothing;
  974. break;
  975. }
  976. if (xclntMap->MapOperation == Nothing)
  977. {
  978. pmuGisDefault->Checked = true;
  979. xclntMap->ClearUserDrawPolyGon();
  980. xclntMap->ReDraw();
  981. }
  982. }
  983. //---------------------------------------------------------------------------
  984. void __fastcall TITS00MAP::MnuLayerSettingClick(TObject *Sender)
  985. {
  986. Application->ProcessMessages();
  987. ShowLayerEditForm();
  988. }
  989. //---------------------------------------------------------------------------
  990. /*
  991. * 레이어편집 설정창 표출
  992. * arguments
  993. *
  994. * return
  995. * void
  996. */
  997. void __fastcall TITS00MAP::ShowLayerEditForm()
  998. {
  999. if (!xclntMap->Active)
  1000. {
  1001. return;
  1002. }
  1003. if (xclntMap->XiMapServer->SetMapInfo(xclntMap->GetViewExtent()))
  1004. {
  1005. #if 0
  1006. for (int nLyrIdx = 0; nLyrIdx < MAX_LAYERS; nLyrIdx++)
  1007. {
  1008. int nLyrIndex = xsrvrMap->GetLayerIndex(g_sLinkLyrName[nLyrIdx]);
  1009. if (nLyrIndex < 0) continue;
  1010. //if (g_GisInfo.bLinkLayerDup[nLyrIdx]) continue; // 중복된 레이어인 경우 처리할 필요가 없다.
  1011. //g_GisInfo.pLinkStream[nLyrIdx] = (TMemoryStream *)xsrvrMap->GetLayerAttSTM(nLyrIndex);
  1012. }
  1013. #endif
  1014. Application->ProcessMessages();
  1015. }
  1016. }
  1017. //---------------------------------------------------------------------------
  1018. /*
  1019. * 전자지도의 영역을 설정한다.
  1020. * arguments
  1021. * double : left 영역
  1022. * double : top 영역
  1023. * double : right 영역
  1024. * double : bottom 영역
  1025. * return
  1026. * void
  1027. */
  1028. void __fastcall TITS00MAP::SetExtent(TDDRect &curRc)
  1029. {
  1030. if (xclntMap->Active)
  1031. {
  1032. xclntMap->ExtentDraw(curRc);
  1033. }
  1034. }
  1035. //---------------------------------------------------------------------------
  1036. /*
  1037. * 지도 영역 이동 함수. 현재 영역을 영역이동 큐에 추가한다.
  1038. * 다음 버튼을 비활성 시킨다.
  1039. * arguments
  1040. * return
  1041. * void
  1042. */
  1043. bool __fastcall TITS00MAP::AddExtentQ(TDDRect &curRc)
  1044. {
  1045. TDDRect *pExt = &m_ExtQ.extent[m_ExtQ.userIdx];
  1046. memcpy((char*)pExt, (char*)&curRc, sizeof(curRc));
  1047. if (m_PrevExt.MinX == pExt->MinX &&
  1048. m_PrevExt.MinY == pExt->MinY &&
  1049. m_PrevExt.MaxX == pExt->MaxX &&
  1050. m_PrevExt.MaxY == pExt->MaxY)
  1051. {
  1052. return false;
  1053. }
  1054. memcpy((char*)&m_PrevExt, pExt, sizeof(m_PrevExt));
  1055. if (m_ExtQ.userIdx >= D_EXT_QUEUE_SIZE)
  1056. {
  1057. m_ExtQ.userIdx = D_EXT_QUEUE_SIZE;
  1058. memcpy((char *)&m_ExtQ.extent[0], (char *)&m_ExtQ.extent[1], sizeof(TDDRect)*D_EXT_QUEUE_SIZE);
  1059. }
  1060. else
  1061. {
  1062. m_ExtQ.userIdx++;
  1063. }
  1064. m_ExtQ.currIdx = m_ExtQ.userIdx-1;
  1065. return true;
  1066. }
  1067. //---------------------------------------------------------------------------
  1068. /*
  1069. * 지도 영역 이동 함수. 이전 영역으로 이동
  1070. * 이동 범위에 따라 이전/다음 버튼을 활성/비활성 시킨다.
  1071. * arguments
  1072. * return
  1073. * void
  1074. */
  1075. bool __fastcall TITS00MAP::PrevExtentQ()
  1076. {
  1077. m_ExtQ.bExtent = false;
  1078. if (m_ExtQ.currIdx <= 0)
  1079. {
  1080. m_ExtQ.currIdx = 0;
  1081. return false;
  1082. }
  1083. m_ExtQ.currIdx--;
  1084. TDDRect *pExt = &m_ExtQ.extent[m_ExtQ.currIdx];
  1085. SetExtent(*pExt);
  1086. return true;
  1087. }
  1088. //---------------------------------------------------------------------------
  1089. /*
  1090. * 지도 영역 이동 함수. 다음 영역으로 이동
  1091. * 이동 범위에 따라 이전/다음 버튼을 활성/비활성 시킨다.
  1092. * arguments
  1093. * return
  1094. * void
  1095. */
  1096. bool __fastcall TITS00MAP::NextExtentQ()
  1097. {
  1098. m_ExtQ.bExtent = false;
  1099. if (m_ExtQ.currIdx >= m_ExtQ.userIdx-1)
  1100. {
  1101. m_ExtQ.currIdx = m_ExtQ.userIdx-1;
  1102. return false;
  1103. }
  1104. m_ExtQ.currIdx++;
  1105. TDDRect *pExt = &m_ExtQ.extent[m_ExtQ.currIdx];
  1106. SetExtent(*pExt);
  1107. return true;
  1108. }
  1109. //---------------------------------------------------------------------------
  1110. void __fastcall TITS00MAP::xclntMapExit(TObject *Sender)
  1111. {
  1112. // 전자지도 영역 밖으로 툴팁 표출을 방지
  1113. ClearToolTip();
  1114. xclntMap->Repaint();
  1115. }
  1116. //---------------------------------------------------------------------------
  1117. void __fastcall TITS00MAP::xclntMapMapChange(TObject *Sender, TPacket &ChangePacket, bool PreImage, bool NextImage)
  1118. {
  1119. try {
  1120. m_drtViewExtent = xclntMap->GetViewExtent(); // 변경된 정보를 저장
  1121. m_nMapLevel = xclntMap->GetLevel(); // 현재 표출되는 전자지도 레벨
  1122. if (xclntMap->IsStart())
  1123. {
  1124. if (m_ExtQ.bExtent)
  1125. {
  1126. AddExtentQ(ChangePacket.Extent);
  1127. }
  1128. m_ExtQ.bExtent = true;
  1129. }
  1130. if (xclntMap->MapOperation == OnZoomIn || xclntMap->MapOperation == OnZoomOut)
  1131. {
  1132. pmuControlGisClick((TObject*)pmuMove);
  1133. }
  1134. LblZoomLevel->Caption = String(m_nMapLevel);
  1135. TDVAInfo DVAInfo;
  1136. int nLayerIdx1 = xclntMap->GetLayerIndex(LEVEL1_LINK_LAYER_NAME);
  1137. if (nLayerIdx1 >= 0)
  1138. {
  1139. xsrvrMap->GetDVAInfo(nLayerIdx1, DVAInfo);
  1140. if (m_nMapLevel >= DVAInfo.pDVAinfo.FSLevel && m_nMapLevel <= DVAInfo.pDVAinfo.FELevel)
  1141. {
  1142. LblLinkLevel->Caption = "1";
  1143. return;
  1144. }
  1145. }
  1146. int nLayerIdx2 = xclntMap->GetLayerIndex(LEVEL2_LINK_LAYER_NAME);
  1147. if (nLayerIdx2 >= 0)
  1148. {
  1149. xsrvrMap->GetDVAInfo(nLayerIdx2, DVAInfo);
  1150. if (m_nMapLevel >= DVAInfo.pDVAinfo.FSLevel && m_nMapLevel <= DVAInfo.pDVAinfo.FELevel)
  1151. {
  1152. LblLinkLevel->Caption = "2";
  1153. return;
  1154. }
  1155. }
  1156. int nLayerIdx3 = xclntMap->GetLayerIndex(LEVEL3_LINK_LAYER_NAME);
  1157. if (nLayerIdx3 >= 0)
  1158. {
  1159. xsrvrMap->GetDVAInfo(nLayerIdx3, DVAInfo);
  1160. if (m_nMapLevel >= DVAInfo.pDVAinfo.FSLevel && m_nMapLevel <= DVAInfo.pDVAinfo.FELevel)
  1161. {
  1162. LblLinkLevel->Caption = "3";
  1163. return;
  1164. }
  1165. }
  1166. LblLinkLevel->Caption = "?";
  1167. } catch(...) {}
  1168. }
  1169. //---------------------------------------------------------------------------
  1170. void __fastcall TITS00MAP::xclntMapMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
  1171. {
  1172. if (!xclntMap->IsStart()) return;
  1173. m_bMouseDown = true;
  1174. xclntMap->SetFocus();
  1175. m_ptDown.x = X;
  1176. m_ptDown.y = Y;
  1177. if (m_objToolTip->HandleAllocated())
  1178. {
  1179. m_objToolTip->ReleaseHandle();
  1180. }
  1181. if (xclntMap->MapOperation == OnSelect)
  1182. {
  1183. if (m_objToolTip->HandleAllocated())
  1184. {
  1185. m_objToolTip->ReleaseHandle();
  1186. }
  1187. ClearToolTip();
  1188. if (Button == mbLeft && OnSelect == xclntMap->MapOperation)
  1189. {
  1190. try {
  1191. TDDPoint dptCurr = xclntMap->ScreenToReal(Point(X, Y));
  1192. SePosX->Value = dptCurr.X;
  1193. SePosY->Value = dptCurr.Y;
  1194. } catch(...) {}
  1195. }
  1196. }
  1197. else if (xclntMap->MapOperation == Nothing)
  1198. {
  1199. if (Button == mbLeft)
  1200. {
  1201. // 중심이동
  1202. if (m_bMoveCenter)
  1203. {
  1204. // 선택지점으로 지도화면 중심이동
  1205. TDDPoint dptCenter;
  1206. dptCenter = xclntMap->ScreenToReal(Point(X, Y));
  1207. xclntMap->MoveExtentDraw(dptCenter);
  1208. return;
  1209. }
  1210. }
  1211. }
  1212. }
  1213. //---------------------------------------------------------------------------
  1214. void __fastcall TITS00MAP::xclntMapMouseLeave(TMessage &Msg)
  1215. {
  1216. // 전자지도 영역 밖으로 툴팁 표출을 방지
  1217. ClearToolTip();
  1218. xclntMap->Repaint();
  1219. }
  1220. //---------------------------------------------------------------------------
  1221. void __fastcall TITS00MAP::xclntMapMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
  1222. {
  1223. if (!xclntMap->IsStart()) return;
  1224. m_bMouseDown = false;
  1225. if (m_bCalcMode)
  1226. {
  1227. if (Button == mbRight)
  1228. {
  1229. if (m_bCalcCont)
  1230. {
  1231. m_bCalcCont = false;
  1232. }
  1233. else
  1234. {
  1235. m_bCalcMode = false;
  1236. pmuControlGisClick((TObject*)pmuMove);
  1237. }
  1238. }
  1239. else if (Button == mbLeft)
  1240. {
  1241. m_bCalcCont = true;
  1242. }
  1243. return;
  1244. }
  1245. if (Button == mbRight)
  1246. {
  1247. if (Button == mbRight)
  1248. {
  1249. POINT p;
  1250. GetCursorPos(&p);
  1251. pmuGis->Popup(p.x, p.y);
  1252. }
  1253. }
  1254. else if (Button == mbLeft)
  1255. {
  1256. if (OnSelect == xclntMap->MapOperation)
  1257. {
  1258. if (m_ptDown.x == X && m_ptDown.y == Y)
  1259. {
  1260. if (SelectLinkByPos(m_ptDown.x, m_ptDown.y))
  1261. {
  1262. return;
  1263. }
  1264. }
  1265. }
  1266. }
  1267. }
  1268. //---------------------------------------------------------------------------
  1269. void __fastcall TITS00MAP::xclntMapMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
  1270. {
  1271. if (!xclntMap->IsStart()) return;
  1272. if (m_bCalcMode) return;
  1273. // 마우스 좌표 출력
  1274. TDDPoint dptCurr = xclntMap->ScreenToReal(Point(X, Y));
  1275. try {
  1276. String sMousePos = FormatFloat("##,##0.#####0", dptCurr.X) + " " + FormatFloat("##,##0.#####0", dptCurr.Y);
  1277. FrmMain->dxStatusBar->Panels->Items[isbGisPos]->Text = sMousePos;
  1278. FrmMain->dxStatusBar->Panels->Items[isbGisPos]->StatusBarControl->Refresh();
  1279. } catch(...) {}
  1280. if (ChkToolTip->Checked)
  1281. {
  1282. HintLinkLyr(Shift, X, Y);
  1283. }
  1284. }
  1285. //---------------------------------------------------------------------------
  1286. /*
  1287. * 툴팁 표출
  1288. * arguments
  1289. *
  1290. * return
  1291. *
  1292. */
  1293. void __fastcall TITS00MAP::ShowToolTipInfo(TPoint ptLocation, TStringList *slToolTip)
  1294. {
  1295. int ii;
  1296. int iMaxX = 0;
  1297. int iMaxY = 0;
  1298. int nTmp;
  1299. String strToolTip = "";
  1300. TRect rt;
  1301. //m_objToolTip->FHint->ColorArrowBackground = clBlack;
  1302. //m_objToolTip->FHint->ColorBackground = clRed;
  1303. for (ii = 0; ii < slToolTip->Count - 1; ii++)
  1304. {
  1305. if (iMaxX < m_objToolTip->Canvas->TextWidth(slToolTip->Strings[ii]))
  1306. {
  1307. iMaxX = m_objToolTip->Canvas->TextWidth(slToolTip->Strings[ii]);
  1308. }
  1309. nTmp = m_objToolTip->Canvas->TextHeight(slToolTip->Strings[ii]);
  1310. iMaxY += nTmp;
  1311. strToolTip += slToolTip->Strings[ii] + "\r\n";
  1312. }
  1313. if (iMaxX < m_objToolTip->Canvas->TextWidth(slToolTip->Strings[slToolTip->Count - 1]))
  1314. {
  1315. iMaxX = m_objToolTip->Canvas->TextWidth(slToolTip->Strings[slToolTip->Count -1]);
  1316. }
  1317. nTmp = m_objToolTip->Canvas->TextHeight(slToolTip->Strings[slToolTip->Count - 1]);
  1318. iMaxY += nTmp;
  1319. strToolTip += slToolTip->Strings[slToolTip->Count - 1];
  1320. iMaxX += 6;
  1321. rt.Right = Mouse->CursorPos.x - 5;
  1322. rt.Bottom = Mouse->CursorPos.y - 5;
  1323. rt.Left = rt.Right - iMaxX;
  1324. rt.Top = rt.Bottom - iMaxY;
  1325. m_objToolTip->ActivateHint(rt, strToolTip);
  1326. }
  1327. //---------------------------------------------------------------------------
  1328. void __fastcall TITS00MAP::ShowToolTipInfo(TzHintWindow *pTTipWin, TStringList *slToolTip)
  1329. {
  1330. int ii;
  1331. int iMaxX = 0;
  1332. int iMaxY = 0;
  1333. int nTmp;
  1334. String strToolTip = "";
  1335. TRect rt;
  1336. for (ii = 0; ii < slToolTip->Count - 1; ii++)
  1337. {
  1338. if (iMaxX < pTTipWin->Canvas->TextWidth(slToolTip->Strings[ii]))
  1339. {
  1340. iMaxX = pTTipWin->Canvas->TextWidth(slToolTip->Strings[ii]);
  1341. }
  1342. nTmp = pTTipWin->Canvas->TextHeight(slToolTip->Strings[ii]);
  1343. iMaxY += nTmp;
  1344. strToolTip += slToolTip->Strings[ii] + "\r\n";
  1345. }
  1346. if (iMaxX < pTTipWin->Canvas->TextWidth(slToolTip->Strings[slToolTip->Count - 1]))
  1347. {
  1348. iMaxX = pTTipWin->Canvas->TextWidth(slToolTip->Strings[slToolTip->Count -1]);
  1349. }
  1350. nTmp = pTTipWin->Canvas->TextHeight(slToolTip->Strings[slToolTip->Count - 1]);
  1351. iMaxY += nTmp;
  1352. strToolTip += slToolTip->Strings[slToolTip->Count - 1];
  1353. iMaxX += 6;
  1354. rt.Right = Mouse->CursorPos.x - 5;
  1355. rt.Bottom = Mouse->CursorPos.y - 5;
  1356. rt.Left = rt.Right - iMaxX;
  1357. rt.Top = rt.Bottom - iMaxY;
  1358. pTTipWin->ActivateHint(rt, strToolTip);
  1359. }
  1360. //---------------------------------------------------------------------------
  1361. void __fastcall TITS00MAP::MnuViewGrayClick(TObject *Sender)
  1362. {
  1363. MnuViewGray->Checked = !MnuViewGray->Checked;
  1364. xclntMap->XiMapServer->LryGrayColor = MnuViewGray->Checked;
  1365. xclntMap->FullReDraw();
  1366. }
  1367. //---------------------------------------------------------------------------
  1368. void __fastcall TITS00MAP::ImgPrevClick(TObject *Sender)
  1369. {
  1370. PrevExtentQ();
  1371. }
  1372. //---------------------------------------------------------------------------
  1373. void __fastcall TITS00MAP::ImgNextClick(TObject *Sender)
  1374. {
  1375. NextExtentQ();
  1376. }
  1377. //---------------------------------------------------------------------------
  1378. void __fastcall TITS00MAP::ImgFullClick(TObject *Sender)
  1379. {
  1380. if (xclntMap->Active)
  1381. {
  1382. xclntMap->ExtentDraw(xclntMap->GetFullExtent());
  1383. }
  1384. }
  1385. //---------------------------------------------------------------------------
  1386. void __fastcall TITS00MAP::ImgStndClick(TObject *Sender)
  1387. {
  1388. if (xclntMap->Active)
  1389. {
  1390. xclntMap->ExtentDraw(DDRect(g_GisInfo.dRightBottomX, g_GisInfo.dLeftTopX, g_GisInfo.dRightBottomY, g_GisInfo.dLeftTopY));
  1391. }
  1392. }
  1393. //---------------------------------------------------------------------------
  1394. void __fastcall TITS00MAP::ImgRefreshClick(TObject *Sender)
  1395. {
  1396. if (xclntMap->Active)
  1397. {
  1398. // 시설물상태정보
  1399. FrmMain->FPollStatus01.Reset();
  1400. // 프로세스상태정보
  1401. FrmMain->FPollStatus02.Reset();
  1402. RefreshMapTraffic();
  1403. }
  1404. }
  1405. //---------------------------------------------------------------------------
  1406. void __fastcall TITS00MAP::ChkTrafficLayerClick(TObject *Sender)
  1407. {
  1408. SetTrfLayerShow(ChkTrafficLayer->Checked);
  1409. }
  1410. //---------------------------------------------------------------------------
  1411. /*
  1412. * 소통정보 레이어 보기 숨기기
  1413. * arguments
  1414. *
  1415. * return
  1416. * void
  1417. */
  1418. void __fastcall TITS00MAP::SetTrfLayerShow(bool bShow)
  1419. {
  1420. TDVAInfo DVAInfo;
  1421. int nLyrIdx = -1;
  1422. try
  1423. {
  1424. for (int ii = 0; ii < MAX_LAYERS; ii++)
  1425. {
  1426. if (m_pLinkSpeedUpdate[ii] == NULL) continue;
  1427. nLyrIdx = xsrvrMap->GetLayerIndex(g_sLinkLyrName[ii]);
  1428. if (nLyrIdx >= 0)
  1429. {
  1430. xsrvrMap->GetDVAInfo(nLyrIdx, DVAInfo);
  1431. // 현재 visible 설정과 다르면 변경
  1432. //if (bShow != DVAInfo.pDVAinfo.FVisible)
  1433. {
  1434. DVAInfo.pDVAinfo.FVisible = bShow;
  1435. xsrvrMap->SetDVAInfo(nLyrIdx, DVAInfo);
  1436. }
  1437. }
  1438. }
  1439. xclntMap->FullReDraw();
  1440. Application->ProcessMessages();
  1441. }
  1442. catch (...)
  1443. {
  1444. }
  1445. }
  1446. //---------------------------------------------------------------------------
  1447. void __fastcall TITS00MAP::ChkToolTipClick(TObject *Sender)
  1448. {
  1449. if (!ChkToolTip->Checked)
  1450. {
  1451. ClearToolTip();
  1452. xclntMap->Repaint();
  1453. }
  1454. }
  1455. //---------------------------------------------------------------------------
  1456. void __fastcall TITS00MAP::TmrSelectTimer(TObject *Sender)
  1457. {
  1458. TmrSelect->Enabled = false;
  1459. ImgSelect->Visible = false;
  1460. }
  1461. //---------------------------------------------------------------------------
  1462. void __fastcall TITS00MAP::SelectObjectByPos(double dPosX, double dPosY, bool bArrow/*=false*/)
  1463. {
  1464. if (!xclntMap->IsStart()) return;
  1465. TDDPoint ptCoord;
  1466. ptCoord.X = dPosX;
  1467. ptCoord.Y = dPosY;
  1468. ITS00MAP->xclntMap->MoveExtentDraw(ptCoord);
  1469. ITS00MAP->xclntMap->LevelView(6);
  1470. m_ptSelect.X = dPosX;
  1471. m_ptSelect.Y = dPosY;
  1472. if (bArrow) SelectObjectByPos();
  1473. }
  1474. //---------------------------------------------------------------------------
  1475. void __fastcall TITS00MAP::SelectObjectByPos()
  1476. {
  1477. TPoint ptTmp;
  1478. ImgSelect->Parent = xclntMap;
  1479. ImgSelect->Visible = false;
  1480. TmrSelect->Enabled = false;
  1481. TmrSelect->Interval = 5000;
  1482. ptTmp = xclntMap->RealToScreen(m_ptSelect);
  1483. ImgSelect->Left = ptTmp.x - (ImgSelect->Width/2);
  1484. ImgSelect->Top = ptTmp.y - (ImgSelect->Height)-10;
  1485. TmrSelect->Enabled = true;
  1486. ImgSelect->Visible = true;
  1487. }
  1488. //---------------------------------------------------------------------------
  1489. String __fastcall TITS00MAP::GetLinkLayerName()
  1490. {
  1491. if (m_nMapLevel < 3 || m_nMapLevel > 7) return "no_map";
  1492. return g_sLinkLyrName[m_nMapLevel-1];
  1493. }
  1494. //---------------------------------------------------------------------------
  1495. bool __fastcall TITS00MAP::SelectLinkById(int ALinkLevel, String sId, bool bHide/*=false*/)
  1496. {
  1497. bool bResult = false;
  1498. String sLinkLyrName = "";
  1499. int nLyrIndex = -1;
  1500. switch(ALinkLevel)
  1501. {
  1502. case 1: sLinkLyrName = LEVEL1_LINK_LAYER_NAME; break;
  1503. case 2: sLinkLyrName = LEVEL2_LINK_LAYER_NAME; break;
  1504. case 3: sLinkLyrName = LEVEL3_LINK_LAYER_NAME; break;
  1505. default: return false;
  1506. }
  1507. nLyrIndex = xclntMap->GetLayerIndex(sLinkLyrName);
  1508. if (nLyrIndex < 0) return false;
  1509. TArrInt vObjIDxs;
  1510. TDDPoints pts;
  1511. TDDRect objmbr;
  1512. TDDLineStyle Linestyle;
  1513. TStringList *Linkids = new TStringList();
  1514. Linkids->Add(sId);
  1515. Linkids->Add(sId);
  1516. TDDRect DDRect_Move;
  1517. DDRect_Move.MinX = 200;
  1518. DDRect_Move.MaxX = 0;
  1519. DDRect_Move.MinY = 50;
  1520. DDRect_Move.MaxY = 0;
  1521. try
  1522. {
  1523. if (xsrvrMap->Get_MultiAtt(nLyrIndex, "SD_LINK_ID", Linkids, vObjIDxs))
  1524. {
  1525. for(int i = 0; i < vObjIDxs.High; i++)
  1526. {
  1527. pts = xclntMap->XiMapServer->Get_NstObj(nLyrIndex, vObjIDxs[i], objmbr);
  1528. if (vObjIDxs[i] == -1)
  1529. continue;
  1530. Linestyle.PenWidth = 6;
  1531. Linestyle.PenColor = clPurple;
  1532. Linestyle.OutLineType = true;
  1533. Linestyle.ArrowType = true;
  1534. xclntMap->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);
  1535. if (DDRect_Move.MinX > objmbr.MinX)
  1536. DDRect_Move.MinX = objmbr.MinX;
  1537. if (DDRect_Move.MaxX < objmbr.MaxX)
  1538. DDRect_Move.MaxX = objmbr.MaxX;
  1539. if (DDRect_Move.MinY > objmbr.MinY)
  1540. DDRect_Move.MinY = objmbr.MinY;
  1541. if (DDRect_Move.MaxY < objmbr.MaxY)
  1542. DDRect_Move.MaxY = objmbr.MaxY;
  1543. }
  1544. DDRect_Move.MinX -= 0.002;
  1545. DDRect_Move.MaxX += 0.002;
  1546. DDRect_Move.MinY -= 0.002;
  1547. DDRect_Move.MaxY += 0.002;
  1548. xclntMap->ExtentDraw(DDRect_Move);
  1549. xclntMap->ReDraw();
  1550. bResult = true;
  1551. if (bHide)
  1552. {
  1553. TmrLinkSelect->Enabled = false;
  1554. TmrLinkSelect->Interval= 3000;
  1555. TmrLinkSelect->Enabled = true;
  1556. }
  1557. }
  1558. }
  1559. catch (Exception &e)
  1560. {
  1561. }
  1562. delete Linkids;
  1563. return bResult;
  1564. }
  1565. //---------------------------------------------------------------------------
  1566. bool __fastcall TITS00MAP::SelectLinkById2(int ALinkLevel, String sId, bool bHide/*=false*/)
  1567. {
  1568. bool bResult = false;
  1569. String sLinkLyrName = "";
  1570. int nLyrIndex = -1;
  1571. switch(ALinkLevel)
  1572. {
  1573. case 1: sLinkLyrName = LEVEL1_LINK_LAYER_NAME; break;
  1574. case 2: sLinkLyrName = LEVEL2_LINK_LAYER_NAME; break;
  1575. case 3: sLinkLyrName = LEVEL3_LINK_LAYER_NAME; break;
  1576. default: return false;
  1577. }
  1578. nLyrIndex = xclntMap->GetLayerIndex(sLinkLyrName);
  1579. if (nLyrIndex < 0) return false;
  1580. int nNum = -1;
  1581. AnsiString sFldName = "SD_LINK_ID";
  1582. AnsiString sQryVal = "";
  1583. TStringList *pVal = new TStringList();
  1584. TStringList *pFvl = new TStringList();
  1585. try
  1586. {
  1587. try
  1588. {
  1589. //TXiMapUtil::SelectLinkById(xsrvrMap, xclntMap, nLyrIndex, sId);
  1590. //return true;
  1591. sQryVal = AnsiString(sId);
  1592. nNum = xsrvrMap->QueryAttribute(nLyrIndex, sFldName, sQryVal, pFvl, pVal);
  1593. if (nNum >= 0)
  1594. {
  1595. TDDRect drtObj;
  1596. TDDPoints dptsObj;
  1597. dptsObj.Length = 0;
  1598. dptsObj = xclntMap->XiMapServer->Get_NstObj(nLyrIndex, nNum, drtObj);
  1599. if (dptsObj.Length > 0)
  1600. {
  1601. TDDLineStyle Linestyle;
  1602. Linestyle.PenWidth = 6;
  1603. Linestyle.PenColor = clRed;
  1604. Linestyle.OutLineType = true;
  1605. Linestyle.ArrowType = true;
  1606. if (bHide)
  1607. {
  1608. xclntMap->ClearPathInfo();
  1609. }
  1610. xclntMap->ADDPathInfo(TDDPolyLine(dptsObj), "", 0, 0, Linestyle);
  1611. //xclntMap->ReDrawWithPath();
  1612. drtObj.MaxX = drtObj.MaxX * 1.00006;
  1613. drtObj.MaxY = drtObj.MaxY * 1.00006;
  1614. drtObj.MinX = drtObj.MinX - (drtObj.MaxX * 1.00006 - drtObj.MaxX);
  1615. drtObj.MinY = drtObj.MinY - (drtObj.MaxY * 1.00006 - drtObj.MaxY);
  1616. xclntMap->ExtentDraw(drtObj);
  1617. xclntMap->ReDraw();
  1618. bResult = true;
  1619. if (bHide)
  1620. {
  1621. TmrLinkSelect->Enabled = false;
  1622. TmrLinkSelect->Interval= 3000;
  1623. TmrLinkSelect->Enabled = true;
  1624. }
  1625. }
  1626. }
  1627. }
  1628. catch (Exception &e)
  1629. {
  1630. }
  1631. catch (...)
  1632. {
  1633. }
  1634. }
  1635. __finally
  1636. {
  1637. delete pVal;
  1638. delete pFvl;
  1639. }
  1640. return bResult;
  1641. }
  1642. //---------------------------------------------------------------------------
  1643. bool __fastcall TITS00MAP::SelectLinkByPos(int X, int Y)
  1644. {
  1645. String sLinkId;
  1646. TDVAInfo DVAInfo;
  1647. int nLayerIdx1 = xclntMap->GetLayerIndex(LEVEL1_LINK_LAYER_NAME);
  1648. if (nLayerIdx1 >= 0)
  1649. {
  1650. xsrvrMap->GetDVAInfo(nLayerIdx1, DVAInfo);
  1651. if (m_nMapLevel >= DVAInfo.pDVAinfo.FSLevel && m_nMapLevel <= DVAInfo.pDVAinfo.FELevel)
  1652. {
  1653. if (GetLevelLinkId(1, sLinkId, X, Y))
  1654. {
  1655. ShowLinkDetailInfo(sLinkId, 1);
  1656. return true;
  1657. }
  1658. return false;
  1659. }
  1660. }
  1661. int nLayerIdx2 = xclntMap->GetLayerIndex(LEVEL2_LINK_LAYER_NAME);
  1662. if (nLayerIdx2 >= 0)
  1663. {
  1664. xsrvrMap->GetDVAInfo(nLayerIdx2, DVAInfo);
  1665. if (m_nMapLevel >= DVAInfo.pDVAinfo.FSLevel && m_nMapLevel <= DVAInfo.pDVAinfo.FELevel)
  1666. {
  1667. if (GetLevelLinkId(2, sLinkId, X, Y))
  1668. {
  1669. ShowLinkDetailInfo(sLinkId, 2);
  1670. return true;
  1671. }
  1672. return false;
  1673. }
  1674. }
  1675. int nLayerIdx3 = xclntMap->GetLayerIndex(LEVEL3_LINK_LAYER_NAME);
  1676. if (nLayerIdx3 >= 0)
  1677. {
  1678. xsrvrMap->GetDVAInfo(nLayerIdx3, DVAInfo);
  1679. if (m_nMapLevel >= DVAInfo.pDVAinfo.FSLevel && m_nMapLevel <= DVAInfo.pDVAinfo.FELevel)
  1680. {
  1681. if (GetLevelLinkId(3, sLinkId, X, Y))
  1682. {
  1683. ShowLinkDetailInfo(sLinkId, 3);
  1684. return true;
  1685. }
  1686. return false;
  1687. }
  1688. }
  1689. return false;
  1690. }
  1691. //---------------------------------------------------------------------------
  1692. void __fastcall TITS00MAP::TmrLinkSelectTimer(TObject *Sender)
  1693. {
  1694. TmrLinkSelect->Enabled = false;
  1695. xclntMap->ClearUserDrawPolyGon();
  1696. xclntMap->ClearPathInfo();
  1697. xclntMap->ReDraw();
  1698. }
  1699. //---------------------------------------------------------------------------
  1700. /*
  1701. * 링크레이어 도움말 표출
  1702. * arguments
  1703. * return
  1704. * void
  1705. */
  1706. bool __fastcall TITS00MAP::GetLevelLinkId(int ALinkLevel, String &sLinkId, int X, int Y)
  1707. {
  1708. String sLinkLyrName = "";
  1709. int nLyrIndex = -1;
  1710. sLinkId = "";
  1711. switch(ALinkLevel)
  1712. {
  1713. case 1: sLinkLyrName = LEVEL1_LINK_LAYER_NAME; break;
  1714. case 2: sLinkLyrName = LEVEL2_LINK_LAYER_NAME; break;
  1715. case 3: sLinkLyrName = LEVEL3_LINK_LAYER_NAME; break;
  1716. default: return false;
  1717. }
  1718. nLyrIndex = xclntMap->GetLayerIndex(sLinkLyrName);
  1719. if (nLyrIndex < 0) return false;
  1720. try
  1721. {
  1722. if (xsrvrMap->ShpObjInfo(X, Y, nLyrIndex, m_slLinkFldName, m_slLinkFldValue, clWhite, true, false))
  1723. {
  1724. if (m_slLinkFldName->Count != m_slLinkFldValue->Count)
  1725. {
  1726. return false;
  1727. }
  1728. sLinkId = m_slLinkFldValue->Strings[1];
  1729. return true;
  1730. }
  1731. }
  1732. catch(...)
  1733. {
  1734. }
  1735. return false;
  1736. }
  1737. //---------------------------------------------------------------------------
  1738. /*
  1739. * 링크레이어 도움말 표출
  1740. * arguments
  1741. * return
  1742. * void
  1743. */
  1744. bool __fastcall TITS00MAP::HintLinkLyr(TShiftState Shift, int X, int Y)
  1745. {
  1746. if (!ChkToolTip->Checked) return false;
  1747. if (!ChkTrafficLayer->Checked) return false;
  1748. int nLyrIndex = -1;
  1749. switch(m_nMapLevel)
  1750. {
  1751. case 3:
  1752. case 4:
  1753. case 5:
  1754. case 6:
  1755. case 7:
  1756. nLyrIndex = xclntMap->GetLayerIndex(GetLinkLayerName());
  1757. break;
  1758. default: return false;
  1759. }
  1760. if (nLyrIndex < 0) return false;
  1761. try
  1762. {
  1763. TDVAInfo DVAInfo;
  1764. xsrvrMap->GetDVAInfo(nLyrIndex, DVAInfo);
  1765. if (DVAInfo.pDVAinfo.FVisible == false) return false;
  1766. //TDDPoint dptCurr = MapClient->ScreenToReal(Point(X, Y));
  1767. // 링크에 대한 공간정보를 검색
  1768. if (xsrvrMap->ShpObjInfo(X, Y, nLyrIndex, m_slFldName, m_slFldValue, clWhite, true, false))
  1769. {
  1770. if (m_slFldName->Count != m_slFldValue->Count)
  1771. {
  1772. return false;
  1773. }
  1774. #if 0
  1775. for(int kk = 0; kk < m_slFldName->Count; kk++)
  1776. ShowMessage(String(kk) + " = " + m_slFldName->Strings[kk] + " : " + m_slFldValue->Strings[kk]);
  1777. #endif
  1778. m_slToolTip->Clear();
  1779. TStringList *UserAtt;
  1780. //아이디1, 시작노드2,종료노드3,등급6,유형7,도로명9,길이20,레벨26
  1781. String sId = m_slFldValue->Strings[1];
  1782. UserAtt = xclntMap->XiMapServer->GetLayerUserDat(nLyrIndex, sId);
  1783. if (!UserAtt) return false;
  1784. m_slToolTip->Add(L"▶▶링크 소통 정보◀◀");
  1785. m_slToolTip->Add(L"도 로 명 : " + m_slFldValue->Strings[ 9]);
  1786. m_slToolTip->Add(L"링크 아이디 : " + m_slFldValue->Strings[ 1]);
  1787. m_slToolTip->Add(L"출 발 노 드 : " + m_slFldValue->Strings[ 2]);
  1788. m_slToolTip->Add(L"도 착 노 드 : " + m_slFldValue->Strings[ 3]);
  1789. m_slToolTip->Add(L"도 로 길 이 : " + m_slFldValue->Strings[20] + " m");
  1790. m_slToolTip->Add(L"차 선 수 : " + m_slFldValue->Strings[ 5] + " 차로");
  1791. m_slToolTip->Add(L"제 한 속 도 : " + m_slFldValue->Strings[12] + " km/h");
  1792. m_slToolTip->Add(L"도 로 레 벨 : " + String(g_nLinkLyrLevel[m_nMapLevel-1]));
  1793. String sRank = m_slFldValue->Strings[6];
  1794. //*
  1795. if (sRank == "101") m_slToolTip->Add(L"도 로 등 급 : [101]고속국도");
  1796. else if (sRank == "102") m_slToolTip->Add(L"도 로 등 급 : [102]도시고속국도");
  1797. else if (sRank == "103") m_slToolTip->Add(L"도 로 등 급 : [103]일반국도");
  1798. else if (sRank == "104") m_slToolTip->Add(L"도 로 등 급 : [104]특별광역시도");
  1799. else if (sRank == "105") m_slToolTip->Add(L"도 로 등 급 : [105]국가지원지방도");
  1800. else if (sRank == "106") m_slToolTip->Add(L"도 로 등 급 : [106]지방도");
  1801. else if (sRank == "107") m_slToolTip->Add(L"도 로 등 급 : [107]시군도");
  1802. else if (sRank == "108") m_slToolTip->Add(L"도 로 등 급 : [108]기타");
  1803. //else m_slToolTip->Add(L"도 로 등 급 : [???]알수없음");
  1804. else m_slToolTip->Add(L"도 로 등 급 : ["+sRank+"]알수없음");
  1805. //*/
  1806. sRank = m_slFldValue->Strings[7];
  1807. //*
  1808. if (sRank == "000") m_slToolTip->Add(L"도 로 유 형 : [000]일반도로");
  1809. else if (sRank == "001") m_slToolTip->Add(L"도 로 유 형 : [001]고가차도");
  1810. else if (sRank == "002") m_slToolTip->Add(L"도 로 유 형 : [002]지하차도");
  1811. else if (sRank == "003") m_slToolTip->Add(L"도 로 유 형 : [003]교량");
  1812. else if (sRank == "004") m_slToolTip->Add(L"도 로 유 형 : [004]터널");
  1813. else if (sRank == "005") m_slToolTip->Add(L"도 로 유 형 : [005]램프");
  1814. else m_slToolTip->Add(L"도 로 유 형 : [???]알수없음");
  1815. //*/
  1816. if (UserAtt->Values["SPEED"] == "0" || UserAtt->Values["SPEED"] == "")
  1817. {
  1818. m_slToolTip->Add("구 간 속 도 : 정보없음");
  1819. m_slToolTip->Add("통 행 시 간 : 정보없음");
  1820. m_objToolTip->FHint->ColorArrowBackground = clSilver;
  1821. }
  1822. else
  1823. {
  1824. m_slToolTip->Add("구 간 속 도 : " + UserAtt->Values["SPEED"] + " km/h");
  1825. m_slToolTip->Add("통 행 시 간 : " + ITSUtil_GetSecondToString(StrToInt(UserAtt->Values["TRVTM"])));
  1826. m_slToolTip->Add("수집데이터수 : " + UserAtt->Values["DATACNT"] + " 개");
  1827. m_slToolTip->Add("등 록 일 시 : " + ITSUtil_GetTimeToString(UserAtt->Values["REGDATE"]));
  1828. try{
  1829. TColor clBack = (TColor)(StrToInt(m_slFldValue->Strings[m_slFldName->Count-2]));
  1830. m_objToolTip->FHint->ColorArrowBackground = clBack;
  1831. } catch(...) {
  1832. m_objToolTip->FHint->ColorArrowBackground = clLime;
  1833. }
  1834. }
  1835. ShowToolTipInfo(Point(X, Y), m_slToolTip);
  1836. return true;
  1837. }
  1838. }
  1839. catch(...)
  1840. {
  1841. }
  1842. return false;
  1843. }
  1844. //---------------------------------------------------------------------------
  1845. void __fastcall TITS00MAP::MnuSetStdAreaClick(TObject *Sender)
  1846. {
  1847. if (!xclntMap->Active) return;
  1848. Application->ProcessMessages();
  1849. if (Application->MessageBox(L"현재 영역을 표준영역으로 지정하시겠습니까?", L"확인",
  1850. MB_YESNO|MB_ICONQUESTION) != IDYES)
  1851. {
  1852. return;
  1853. }
  1854. TIniFile *pIniFile = NULL;
  1855. String sIniFile = ChangeFileExt(ExtractFileName(Application->ExeName), ".ini");
  1856. String sCfgFile = ExtractFilePath(Application->ExeName) + "\\cfg\\" + sIniFile;
  1857. try
  1858. {
  1859. try
  1860. {
  1861. pIniFile = new TIniFile(sCfgFile);
  1862. TDDRect rc = xclntMap->GetViewExtent();
  1863. pIniFile->WriteString("MAP", "LEFTTOPX", String(rc.MaxX));
  1864. pIniFile->WriteString("MAP", "LEFTTOPY", String(rc.MaxY));
  1865. pIniFile->WriteString("MAP", "RIGHTBOTTOMX", String(rc.MinX));
  1866. pIniFile->WriteString("MAP", "RIGHTBOTTOMY", String(rc.MinY));
  1867. g_GisInfo.dLeftTopX = rc.MaxX;
  1868. g_GisInfo.dLeftTopY = rc.MaxY;
  1869. g_GisInfo.dRightBottomX = rc.MinX;
  1870. g_GisInfo.dRightBottomY = rc.MinY;
  1871. }
  1872. __finally
  1873. {
  1874. if (pIniFile) delete pIniFile;
  1875. pIniFile = NULL;
  1876. }
  1877. }
  1878. catch(...)
  1879. {
  1880. }
  1881. }
  1882. //---------------------------------------------------------------------------
  1883. void __fastcall TITS00MAP::MnuMoveStdAreaClick(TObject *Sender)
  1884. {
  1885. Application->ProcessMessages();
  1886. if (xclntMap->Active)
  1887. {
  1888. xclntMap->ExtentDraw(DDRect(g_GisInfo.dRightBottomX, g_GisInfo.dLeftTopX, g_GisInfo.dRightBottomY, g_GisInfo.dLeftTopY));
  1889. }
  1890. }
  1891. //---------------------------------------------------------------------------
  1892. void __fastcall TITS00MAP::SetTrafficInfo(bool bFlag)
  1893. {
  1894. bool alivethread = false;
  1895. if (!bFlag)
  1896. {
  1897. for (int ii = 0; ii < MAX_LAYERS; ii++)
  1898. {
  1899. if (m_pLinkSpeedUpdate[ii] == NULL) continue;
  1900. m_pLinkSpeedUpdate[ii]->isRuning = false;
  1901. }
  1902. }
  1903. else
  1904. {
  1905. for (int ii = 0; ii < MAX_LAYERS; ii++)
  1906. {
  1907. if (m_pLinkSpeedUpdate[ii] == NULL) continue;
  1908. if (m_pLinkSpeedUpdate[ii]->isRuning == false)
  1909. {
  1910. m_pLinkSpeedUpdate[ii]->isRuning = true;
  1911. alivethread = true;
  1912. }
  1913. }
  1914. }
  1915. }
  1916. //---------------------------------------------------------------------------
  1917. void __fastcall TITS00MAP::RefreshMapTraffic()
  1918. {
  1919. LblTraffic->Visible = true;
  1920. TmrLblTraffic->Enabled = true;
  1921. //if (ChkTrafficLayer->Checked)
  1922. {
  1923. /* 소통정보 표출설정한 경우에만 지도 화면 리플레쉬 */
  1924. for (int ii = 0; ii < MAX_LAYERS; ii++)
  1925. {
  1926. if (m_pLinkSpeedUpdate[ii] == NULL) continue;
  1927. m_pLinkSpeedUpdate[ii]->Reflash_Now();
  1928. }
  1929. }
  1930. /* 결측 링크는 언제라 리플레쉬 */
  1931. //UpdateMissLinkInfo(); /* JSH: 2012.07.18 */
  1932. try
  1933. {
  1934. if (FrmLinkInfo)
  1935. {
  1936. FrmLinkInfo->RefreshLinkInfo();
  1937. }
  1938. }
  1939. catch(...)
  1940. {
  1941. }
  1942. }
  1943. //---------------------------------------------------------------------------
  1944. void __fastcall TITS00MAP::ChkDrawIncidentClick(TObject *Sender)
  1945. {
  1946. UpdateIncidentStatus();
  1947. }
  1948. //---------------------------------------------------------------------------
  1949. void __fastcall TITS00MAP::ChkDrawGisClick(TObject *Sender)
  1950. {
  1951. UpdateFacilityStatus();
  1952. xclntMap->SetFocus();
  1953. }
  1954. //---------------------------------------------------------------------------
  1955. void __fastcall TITS00MAP::ShowLinkDetailInfo(String sLinkId, int nLinkLevel)
  1956. {
  1957. try
  1958. {
  1959. if (FrmLinkInfo == NULL)
  1960. {
  1961. FrmLinkInfo = new TFrmLinkInfo(Application);
  1962. }
  1963. FrmLinkInfo->Show();
  1964. FrmLinkInfo->ShowLinkInfo(sLinkId, nLinkLevel);
  1965. }
  1966. catch(...)
  1967. {
  1968. }
  1969. }
  1970. //---------------------------------------------------------------------------
  1971. void __fastcall TITS00MAP::ChkGisSearchClick(TObject *Sender)
  1972. {
  1973. try
  1974. {
  1975. if (ChkGisSearch->Checked)
  1976. {
  1977. if (FrmGisSearch == NULL)
  1978. {
  1979. FrmGisSearch = new TFrmGisSearch(this);
  1980. //FrmGisSearch->Parent = this;
  1981. }
  1982. FrmGisSearch->Show();
  1983. }
  1984. else
  1985. {
  1986. if (FrmGisSearch)
  1987. {
  1988. if (FrmGisSearch->m_bClose == false)
  1989. {
  1990. FrmGisSearch->Close();
  1991. }
  1992. }
  1993. }
  1994. }
  1995. catch(...)
  1996. {
  1997. }
  1998. }
  1999. //---------------------------------------------------------------------------
  2000. void __fastcall TITS00MAP::MnuDrawAntiAliasClick(TObject *Sender)
  2001. {
  2002. Application->ProcessMessages();
  2003. if (MnuDrawAntiAlias->Checked)
  2004. {
  2005. MnuDrawAntiAlias->Checked = false;
  2006. }
  2007. else
  2008. {
  2009. MnuDrawAntiAlias->Checked = true;
  2010. }
  2011. xsrvrMap->DrawAntiAlias = MnuDrawAntiAlias->Checked;
  2012. xclntMap->FullReDraw();
  2013. }
  2014. //---------------------------------------------------------------------------
  2015. void __fastcall TITS00MAP::FormClose(TObject *Sender, TCloseAction &Action)
  2016. {
  2017. CommClose();
  2018. //ITS00MAP = NULL;
  2019. Action = caFree;
  2020. }
  2021. //---------------------------------------------------------------------------
  2022. void __fastcall TITS00MAP::panRemarkMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
  2023. {
  2024. TcxGroupBox *pGroup = (TcxGroupBox*)Sender;
  2025. ReleaseCapture();
  2026. pGroup->Perform(WM_SYSCOMMAND, 0xf012, 0);
  2027. }
  2028. //---------------------------------------------------------------------------
  2029. void __fastcall TITS00MAP::ChkViewExamplePropertiesChange(TObject *Sender)
  2030. {
  2031. panRemark->Visible = ChkViewExample->Checked;
  2032. }
  2033. //---------------------------------------------------------------------------
  2034. void __fastcall TITS00MAP::xclntMapAccClick(TMouseButton Button, TShiftState Shift, int CNT, TArr_Accdt_Rec INFO)
  2035. {
  2036. if (CNT < 1) return;
  2037. TAccdt_INFO info = INFO[0];
  2038. }
  2039. //---------------------------------------------------------------------------
  2040. /*
  2041. * 시설물의 상태에 따라 이미지를 전자지도에 표출한다.(XiClient->CCTVIconList)
  2042. * arguments
  2043. *
  2044. * return
  2045. * void
  2046. */
  2047. void __fastcall TITS00MAP::UpdateFacilityStatus()
  2048. {
  2049. static String sStatusMsg[3] = { "정상", "이상", "알수없음", };
  2050. int nStatus = 0;
  2051. TItsFacility *pFacility;
  2052. xclntMap->ClearCCTVEvent(true);
  2053. if (ChkDrawCtv->Checked)
  2054. {
  2055. try
  2056. {
  2057. ItsFacilityManager->FCctvLists.Lock();
  2058. FOR_STL(TItsCctv *, pObj, ItsFacilityManager->FCctvLists)
  2059. {
  2060. if (pObj->DEL_YN == "Y") continue;
  2061. //if (pObj->LOCAL_YN != "Y") continue; //지역CCTV정보만 위치에 표출
  2062. nStatus = 2;
  2063. pFacility = ItsFacilityManager->FLists.Find(pObj->CCTV_CTLR_ID);
  2064. if (pFacility)
  2065. {
  2066. #if 0
  2067. if (pFacility->FCommStatus == "CMS0") nStatus = 0;
  2068. else
  2069. if (pFacility->FCommStatus == "CMS1") nStatus = 1;
  2070. #else
  2071. if (pFacility->FComm == "0") nStatus = 1;//"통신이상";
  2072. else
  2073. if (pFacility->FComm == "1") nStatus = 0;//"정상";
  2074. else
  2075. if (pFacility->FComm == "2") nStatus = 0;//"함체문열림";
  2076. else
  2077. if (pFacility->FComm == "3") nStatus = 2;//"알수없음";
  2078. #endif
  2079. } else continue;
  2080. try {
  2081. String sTitle = "▶▶CCTV 정보◀◀|CCTV ID : " + pObj->CCTV_CTLR_ID + "|명칭 : " + pObj->ISTL_LCTN_NM + "|상태 : " + sStatusMsg[nStatus];
  2082. xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->CCTV_CTLR_ID, "CCTV", sTitle, nStatus+0, 1, 7);
  2083. } catch(...) { }
  2084. }
  2085. }
  2086. __finally
  2087. {
  2088. ItsFacilityManager->FCctvLists.UnLock();
  2089. }
  2090. }
  2091. if (ChkDrawVms->Checked)
  2092. {
  2093. try
  2094. {
  2095. ItsFacilityManager->FVmsLists.Lock();
  2096. FOR_STL(TItsVms *, pObj, ItsFacilityManager->FVmsLists)
  2097. {
  2098. if (pObj->DEL_YN == "Y") continue;
  2099. nStatus = 2;
  2100. pFacility = ItsFacilityManager->FLists.Find(pObj->VMS_CTLR_ID);
  2101. if (pFacility)
  2102. {
  2103. if (pFacility->FCommStatus == "CMS0") nStatus = 0;
  2104. else
  2105. if (pFacility->FCommStatus == "CMS1") nStatus = 1;
  2106. } else continue;
  2107. try {
  2108. String sTitle = "▶▶VMS 정보◀◀|VMS ID : " + pObj->VMS_CTLR_ID + "|명칭 : " + pObj->VMS_NM + "|상태 : " + sStatusMsg[nStatus];
  2109. xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->VMS_CTLR_ID, "VMS", sTitle, nStatus+3, 1, 7);
  2110. } catch(...) { }
  2111. }
  2112. }
  2113. __finally
  2114. {
  2115. ItsFacilityManager->FVmsLists.UnLock();
  2116. }
  2117. }
  2118. if (ChkDrawRse->Checked)
  2119. {
  2120. try
  2121. {
  2122. ItsFacilityManager->FRseLists.Lock();
  2123. FOR_STL(TItsRse *, pObj, ItsFacilityManager->FRseLists)
  2124. {
  2125. //if (pObj->DEL_YN == "Y") continue;
  2126. nStatus = 2;
  2127. pFacility = ItsFacilityManager->FLists.Find(pObj->RSEID);
  2128. if (pFacility)
  2129. {
  2130. if (pFacility->FCommStatus == "CMS0") nStatus = 0;
  2131. else
  2132. if (pFacility->FCommStatus == "CMS1") nStatus = 1;
  2133. } else continue;
  2134. try {
  2135. String sTitle = "▶▶RSE 정보◀◀|RSE ID : " + pObj->RSEID + "|명칭 : " + pObj->LOCATION + "|상태 : " + sStatusMsg[nStatus];
  2136. xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->COORDX, 0), StrToFloatDef(pObj->COORDY, 0)), pObj->RSEID, "RSE", sTitle, nStatus+6, 1, 7);
  2137. } catch(...) { }
  2138. }
  2139. }
  2140. __finally
  2141. {
  2142. ItsFacilityManager->FRseLists.UnLock();
  2143. }
  2144. }
  2145. if (ChkWebCam->Checked)
  2146. {
  2147. try
  2148. {
  2149. ItsFacilityManager->FWebCamLists.Lock();
  2150. FOR_STL(TItsWebCam *, pObj, ItsFacilityManager->FWebCamLists)
  2151. {
  2152. //if (pObj->DEL_YN == "Y") continue;
  2153. nStatus = 2;
  2154. pFacility = ItsFacilityManager->FLists.Find(pObj->WEB_CMRA_ID);
  2155. if (pFacility)
  2156. {
  2157. if (pFacility->FCommStatus == "CMS0") nStatus = 0;
  2158. else
  2159. if (pFacility->FCommStatus == "CMS1") nStatus = 1;
  2160. } else continue;
  2161. try {
  2162. String sTitle = "▶▶웹카메라 정보◀◀|RSE ID : " + pObj->WEB_CMRA_ID + "|위치 : " + pObj->ISTL_LCTN_NM + "|상태 : " + sStatusMsg[nStatus];
  2163. xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->WEB_CMRA_ID, "WCAM", sTitle, nStatus+22, 1, 7);
  2164. } catch(...) { }
  2165. }
  2166. }
  2167. __finally
  2168. {
  2169. ItsFacilityManager->FWebCamLists.UnLock();
  2170. }
  2171. }
  2172. if (ChkDrawVds->Checked)
  2173. {
  2174. try
  2175. {
  2176. ItsFacilityManager->FVdsLists.Lock();
  2177. FOR_STL(TItsVds *, pObj, ItsFacilityManager->FVdsLists)
  2178. {
  2179. if (pObj->DEL_YN == "Y") continue;
  2180. nStatus = 2;
  2181. pFacility = ItsFacilityManager->FLists.Find(pObj->CTLR_MNGM_NMBR);
  2182. if (pFacility)
  2183. {
  2184. if (pFacility->FCommStatus == "CMS0") nStatus = 0;
  2185. else
  2186. if (pFacility->FCommStatus == "CMS1") nStatus = 1;
  2187. } else continue;
  2188. try {
  2189. String sTitle = "▶▶VDS-제어기 정보◀◀|VDS ID : " + pObj->VDS_CTLR_ID + "|명칭 : " + pObj->LCTN + "|상태 : " + sStatusMsg[nStatus];
  2190. xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->VDS_CTLR_ID, "VDS", sTitle, nStatus+9, 1, 7);
  2191. } catch(...) { }
  2192. }
  2193. }
  2194. __finally
  2195. {
  2196. ItsFacilityManager->FVdsLists.UnLock();
  2197. }
  2198. }
  2199. if (ChkDrawAvi->Checked)
  2200. {
  2201. try
  2202. {
  2203. ItsFacilityManager->FAviLists.Lock();
  2204. FOR_STL(TItsAvi *, pObj, ItsFacilityManager->FAviLists)
  2205. {
  2206. if (pObj->DEL_YN == "Y") continue;
  2207. nStatus = 2;
  2208. pFacility = ItsFacilityManager->FLists.Find(pObj->AVI_ID);
  2209. if (pFacility)
  2210. {
  2211. if (pFacility->FCommStatus == "CMS0") nStatus = 0;
  2212. else
  2213. if (pFacility->FCommStatus == "CMS1") nStatus = 1;
  2214. } else continue;
  2215. try {
  2216. String sTitle = "▶▶AVI-제어기 정보◀◀|AVI ID : " + pObj->AVI_ID + "|명칭 : " + pObj->AVI_LCTN_NM + "|상태 : " + sStatusMsg[nStatus];
  2217. xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->AVI_ID, "AVI", sTitle, nStatus+12, 1, 7);
  2218. } catch(...) { }
  2219. }
  2220. }
  2221. __finally
  2222. {
  2223. ItsFacilityManager->FAviLists.UnLock();
  2224. }
  2225. }
  2226. if (ChkDrawDsrc->Checked)
  2227. {
  2228. try
  2229. {
  2230. ItsFacilityManager->FDsrcLists.Lock();
  2231. FOR_STL(TItsDsrc *, pObj, ItsFacilityManager->FDsrcLists)
  2232. {
  2233. if (pObj->DEL_YN == "Y") continue;
  2234. nStatus = 2;
  2235. pFacility = ItsFacilityManager->FLists.Find(pObj->ID);
  2236. if (pFacility)
  2237. {
  2238. if (pFacility->FCommStatus == "CMS0") nStatus = 0;
  2239. else
  2240. if (pFacility->FCommStatus == "CMS1") nStatus = 1;
  2241. } else continue;
  2242. try {
  2243. String sTitle = "▶▶DSRC 정보◀◀|DSRC ID : " + pObj->RSE_ID + "|명칭 : " + pObj->ISTL_LCTN_NM + "|상태 : " + sStatusMsg[nStatus];
  2244. xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->LCTN_X, 0), StrToFloatDef(pObj->LCTN_Y, 0)), pObj->RSE_ID, "DSRC", sTitle, nStatus+15, 1, 7);
  2245. } catch(...) { }
  2246. }
  2247. }
  2248. __finally
  2249. {
  2250. ItsFacilityManager->FDsrcLists.UnLock();
  2251. }
  2252. }
  2253. xclntMap->ReDraw();
  2254. }
  2255. //---------------------------------------------------------------------------
  2256. /*
  2257. * 돌발 상태에 따라 이미지를 전자지도에 표출한다.(XiClient->ADDAccEvent)
  2258. * arguments
  2259. *
  2260. * return
  2261. * void
  2262. */
  2263. void __fastcall TITS00MAP::UpdateIncidentStatus()
  2264. {
  2265. static String sStatusMsg[5] = { "사고", "공사", "행사", "기상", "기타", };
  2266. int nStatus = 0;
  2267. xclntMap->ClearAccEvent(true);
  2268. if (ChkDrawIncident->Checked)
  2269. {
  2270. try
  2271. {
  2272. ItsIncidentManager->FLists.Lock();
  2273. FOR_STL(TItsIncident *, pObj, ItsIncidentManager->FLists)
  2274. {
  2275. if (pObj->DISP_INCD == "N") continue;
  2276. if (pObj->INCD_PRGR_STEP_CD == "ISS2")
  2277. {
  2278. nStatus = 4;
  2279. if (pObj->INCD_TYPE_CLSF_CD == "1") nStatus = 0;
  2280. else
  2281. if (pObj->INCD_TYPE_CLSF_CD == "2") nStatus = 1;
  2282. else
  2283. if (pObj->INCD_TYPE_CLSF_CD == "3") nStatus = 2;
  2284. else
  2285. if (pObj->INCD_TYPE_CLSF_CD == "4") nStatus = 3;
  2286. String sTitle = "▶▶돌발 정보◀◀|돌발 ID : " + pObj->INCD_OCRR_ID + "|제목 : " + pObj->INCD_TITL + "|유형 : " + sStatusMsg[nStatus];
  2287. sTitle += "|돌발등록시각: " + ITSUtil_StrToTime(pObj->RGST_DT) + "|돌발시작시각: " + ITSUtil_StrToTime(pObj->FINCD_STRT_DT);
  2288. //돌발유형이 사고,기상인 경우는 돌발종료시각을 표출하지 않도록 함. 돌발유형이 공사,행사인 경우만 돌발종료시각 표출함
  2289. if (nStatus == 1 || nStatus == 2)
  2290. {
  2291. sTitle += "|돌발종료시각: " + ITSUtil_StrToTime(pObj->INCD_END_PRAR_DT);
  2292. }
  2293. xclntMap->ADDAccEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->INCD_OCRR_ID, sTitle, sTitle, "", nStatus+18, false, 1, 7);
  2294. }
  2295. }
  2296. }
  2297. __finally
  2298. {
  2299. ItsIncidentManager->FLists.UnLock();
  2300. }
  2301. }
  2302. xclntMap->ReDraw();
  2303. }
  2304. //---------------------------------------------------------------------------
  2305. void __fastcall TITS00MAP::xclntMapCCTVClick(TMouseButton Button, TShiftState Shift, int CNT, TArr_CCTV_Rec INFO)
  2306. {
  2307. FSelId = "";
  2308. if (Button == mbRight)
  2309. {
  2310. if (CNT < 1) return;
  2311. TCCTV_REC info = INFO[0];
  2312. FSelId = info.fID;
  2313. POINT p;
  2314. GetCursorPos(&p);
  2315. if (info.fAttr == "CCTV")
  2316. {
  2317. pmuCctv->Popup(p.x, p.y);
  2318. }
  2319. else
  2320. if (info.fAttr == "VMS")
  2321. {
  2322. pmuVms->Popup(p.x, p.y);
  2323. }
  2324. else
  2325. if (info.fAttr == "RSE")
  2326. {
  2327. pmuRse->Popup(p.x, p.y);
  2328. }
  2329. else
  2330. if (info.fAttr == "WCAM")
  2331. {
  2332. pmuWebCam->Popup(p.x, p.y);
  2333. }
  2334. else
  2335. if (info.fAttr == "VDS")
  2336. {
  2337. pmuVds->Popup(p.x, p.y);
  2338. }
  2339. else
  2340. if (info.fAttr == "AVI")
  2341. {
  2342. pmuAvi->Popup(p.x, p.y);
  2343. }
  2344. else
  2345. if (info.fAttr == "DSRC")
  2346. {
  2347. pmuDsrc->Popup(p.x, p.y);
  2348. }
  2349. }
  2350. }
  2351. //---------------------------------------------------------------------------
  2352. void __fastcall TITS00MAP::pmuFacilityPopup(TObject *Sender)
  2353. {
  2354. TPopupMenu *pMenu = (TPopupMenu*)Sender;
  2355. if (pMenu->Tag == 0)
  2356. {
  2357. MnuCctvId->Caption = "[CCTV] " + FSelId;
  2358. }
  2359. else
  2360. if (pMenu->Tag == 1)
  2361. {
  2362. MnuVmsId->Caption = "[VMS] " + FSelId;
  2363. }
  2364. else
  2365. if (pMenu->Tag == 2)
  2366. {
  2367. MnuRseId->Caption = "[RSE] " + FSelId;
  2368. }
  2369. else
  2370. if (pMenu->Tag == 3)
  2371. {
  2372. MnuWebCamId->Caption = "[웹카메라] " + FSelId;
  2373. }
  2374. else
  2375. if (pMenu->Tag == 4)
  2376. {
  2377. MnuVdsId->Caption = "[VDS] " + FSelId;
  2378. }
  2379. else
  2380. if (pMenu->Tag == 5)
  2381. {
  2382. MnuAviId->Caption = "[AVI] " + FSelId;
  2383. }
  2384. else
  2385. if (pMenu->Tag == 6)
  2386. {
  2387. MnuDsrcId->Caption = "[DSRC] " + FSelId;
  2388. }
  2389. }
  2390. //---------------------------------------------------------------------------
  2391. void __fastcall TITS00MAP::mnuFacilityPingClick(TObject *Sender)
  2392. {
  2393. TMenuItem *pMenu = (TMenuItem*)Sender;
  2394. String sIp;
  2395. Application->ProcessMessages();
  2396. if (pMenu->Tag >= 11 && 15 >= pMenu->Tag)
  2397. {
  2398. TItsCctv *pObj = ItsFacilityManager->FCctvLists.Find(FSelId);
  2399. if (pObj)
  2400. {
  2401. switch(pMenu->Tag)
  2402. {
  2403. case 12: sIp = pObj->CCTV_CAPT_IP.Trim(); break;
  2404. case 13: sIp = pObj->CCTV_ENCD_IP.Trim(); break;
  2405. case 14: sIp = pObj->STRM_SVR_IP.Trim(); break;
  2406. case 15: sIp = pObj->CCTV_FIBR_IP.Trim(); break;
  2407. case 11:
  2408. default: sIp = pObj->CCTV_CTLR_IP.Trim(); break;
  2409. }
  2410. }
  2411. }
  2412. else
  2413. if (pMenu->Tag >= 21 && 22 >= pMenu->Tag)
  2414. {
  2415. TItsVms *pObj = ItsFacilityManager->FVmsLists.Find(FSelId);
  2416. if (pObj)
  2417. {
  2418. switch(pMenu->Tag)
  2419. {
  2420. case 22: sIp = pObj->WEB_CMRA_IP.Trim(); break;
  2421. case 21:
  2422. default: sIp = pObj->VMS_CTLR_IP.Trim(); break;
  2423. }
  2424. }
  2425. }
  2426. else
  2427. if (pMenu->Tag == 2)
  2428. {
  2429. TItsRse *pObj = ItsFacilityManager->FRseLists.Find(FSelId);
  2430. if (pObj) sIp = pObj->RSEIP.Trim();
  2431. }
  2432. else
  2433. if (pMenu->Tag == 4)
  2434. {
  2435. #if 1
  2436. TItsVds *pObj = ItsFacilityManager->FVdsLists.Find(FSelId);
  2437. if (pObj) sIp = pObj->TRMN_IP.Trim();
  2438. #else
  2439. TItsVds *pObj = NULL;//ItsFacilityManager->FVdsLists.Find(AId);
  2440. FOR_STL(TItsVds*, pTmp, ItsFacilityManager->FVdsLists)
  2441. {
  2442. if (FSelId == pTmp->VDS_CTLR_ID)
  2443. {
  2444. pObj = pTmp;
  2445. break;
  2446. }
  2447. }
  2448. if (pObj) sIp = pObj->TRMN_IP.Trim();
  2449. #endif
  2450. }
  2451. else
  2452. if (pMenu->Tag == 5)
  2453. {
  2454. #if 1
  2455. TItsAvi *pObj = ItsFacilityManager->FAviLists.Find(FSelId);
  2456. if (pObj) sIp = pObj->AVI_CTLR_IP.Trim();
  2457. #else
  2458. TItsAvi *pObj = NULL;//ItsFacilityManager->FAviLists.Find(AId);
  2459. FOR_STL(TItsAvi*, pTmp, ItsFacilityManager->FAviLists)
  2460. {
  2461. if (FSelId == pTmp->AVI_ID)
  2462. {
  2463. pObj = pTmp;
  2464. break;
  2465. }
  2466. }
  2467. if (pObj) sIp = pObj->AVI_CTLR_IP.Trim();
  2468. #endif
  2469. }
  2470. else
  2471. if (pMenu->Tag == 6)
  2472. {
  2473. #if 1
  2474. TItsDsrc *pObj = ItsFacilityManager->FDsrcLists.Find(FSelId);
  2475. if (pObj) sIp = pObj->IP.Trim();
  2476. #else
  2477. TItsDsrc *pObj = NULL;//ItsFacilityManager->FDsrcLists.Find(FSelId);
  2478. FOR_STL(TItsDsrc*, pTmp, ItsFacilityManager->FDsrcLists)
  2479. {
  2480. if (FSelId == pTmp->RSE_ID)
  2481. {
  2482. pObj = pTmp;
  2483. break;
  2484. }
  2485. }
  2486. if (pObj) sIp = pObj->IP.Trim();
  2487. #endif
  2488. }
  2489. else
  2490. if (pMenu->Tag == 99)
  2491. {
  2492. TItsWebCam *pObj = ItsFacilityManager->FWebCamLists.Find(FSelId);
  2493. if (pObj) sIp = pObj->CMRA_IP.Trim();
  2494. }
  2495. if (sIp.IsEmpty())
  2496. {
  2497. Application->MessageBox(L"IP Address 정보가 없습니다.\r\nIP Address 정보를 확인하세요.",
  2498. L"네크워크 연결확인", MB_OK|MB_ICONERROR|MB_APPLMODAL);
  2499. return;
  2500. }
  2501. ITSUtil_NetworkPing(sIp);
  2502. }
  2503. //---------------------------------------------------------------------------
  2504. void __fastcall TITS00MAP::mnuStopImageClick(TObject *Sender)
  2505. {
  2506. Application->ProcessMessages();
  2507. TPoint pt;
  2508. GetCursorPos(&pt);
  2509. pt = ITS0000M->ScreenToClient(pt);
  2510. ShowCctvStopImage(FSelId, pt);
  2511. }
  2512. //---------------------------------------------------------------------------
  2513. void __fastcall TITS00MAP::mnuCctvCamClick(TObject *Sender)
  2514. {
  2515. Application->ProcessMessages();
  2516. TPoint pt;
  2517. GetCursorPos(&pt);
  2518. pt = ITS0000M->ScreenToClient(pt);
  2519. ShowCctvCamera(FSelId, pt);
  2520. }
  2521. //---------------------------------------------------------------------------
  2522. void __fastcall TITS00MAP::mnuVmsMsgClick(TObject *Sender)
  2523. {
  2524. Application->ProcessMessages();
  2525. TPoint pt;
  2526. GetCursorPos(&pt);
  2527. pt = ITS0000M->ScreenToClient(pt);
  2528. ShowVmsMessage(FSelId, pt);
  2529. }
  2530. //---------------------------------------------------------------------------
  2531. void __fastcall TITS00MAP::mnuVmsCamClick(TObject *Sender)
  2532. {
  2533. Application->ProcessMessages();
  2534. TPoint pt;
  2535. GetCursorPos(&pt);
  2536. pt = ITS0000M->ScreenToClient(pt);
  2537. ShowVmsCamera(FSelId, pt);
  2538. }
  2539. //---------------------------------------------------------------------------
  2540. void __fastcall TITS00MAP::ShowCctvStopImage(String AId, TPoint pt)
  2541. {
  2542. TItsCctv *pObj = ItsFacilityManager->FCctvLists.Find(AId);
  2543. if (!pObj) return;
  2544. try {
  2545. if (pObj->FData1)
  2546. {
  2547. TFrmCctvImg *pForm = (TFrmCctvImg *)pObj->FData1;
  2548. pForm->SetFocus();
  2549. pForm->LoadStopImage();
  2550. }
  2551. else
  2552. {
  2553. TFrmCctvImg *pForm = new TFrmCctvImg(ITS0000M);
  2554. pForm->Parent = ITS0000M;
  2555. if ((pt.x + pForm->Width + 5) > this->Width)
  2556. {
  2557. pt.x = this->Width - pForm->Width - 5;
  2558. }
  2559. if ((pt.y + pForm->Height + 5) > this->Height)
  2560. {
  2561. pt.y = this->Height - pForm->Height - 5;
  2562. }
  2563. pForm->Left = Left + pt.x;
  2564. pForm->Top = Top + pt.y;
  2565. pForm->FObj = pObj;
  2566. pObj->FData1 = (void*)pForm;
  2567. pForm->Show();
  2568. }
  2569. } catch(...) {}
  2570. }
  2571. //---------------------------------------------------------------------------
  2572. void __fastcall TITS00MAP::ShowCctvCamera(String AId, TPoint pt)
  2573. {
  2574. TItsCctv *pObj = ItsFacilityManager->FCctvLists.Find(AId);
  2575. if (!pObj) return;
  2576. try {
  2577. if (pObj->FData2)
  2578. {
  2579. TFrmCctvCam *pForm = (TFrmCctvCam *)pObj->FData2;
  2580. pForm->SetFocus();
  2581. //pForm->RefreshCctv();
  2582. }
  2583. else
  2584. {
  2585. TFrmCctvCam *pForm = new TFrmCctvCam(ITS0000M);
  2586. pForm->Parent = ITS0000M;
  2587. if ((pt.x + pForm->Width + 5) > this->Width)
  2588. {
  2589. pt.x = this->Width - pForm->Width - 5;
  2590. }
  2591. if ((pt.y + pForm->Height + 5) > this->Height)
  2592. {
  2593. pt.y = this->Height - pForm->Height - 5;
  2594. }
  2595. pForm->Left = Left + pt.x;
  2596. pForm->Top = Top + pt.y;
  2597. pForm->FObj = pObj;
  2598. pObj->FData2 = (void*)pForm;
  2599. pForm->Show();
  2600. }
  2601. } catch(...) {}
  2602. }
  2603. //---------------------------------------------------------------------------
  2604. void __fastcall TITS00MAP::ShowVmsMessage(String AId, TPoint pt)
  2605. {
  2606. TItsVms *pObj = ItsFacilityManager->FVmsLists.Find(FSelId);
  2607. if (!pObj) return;
  2608. try {
  2609. if (pObj->FData1)
  2610. {
  2611. TFrmVmsMsg *pForm = (TFrmVmsMsg *)pObj->FData1;
  2612. pForm->SetFocus();
  2613. }
  2614. else
  2615. {
  2616. TFrmVmsMsg *pForm = new TFrmVmsMsg(ITS0000M, pObj);
  2617. pForm->Parent = ITS0000M;
  2618. int nHG = pForm->ClientHeight - pForm->PnlVmsMsgDisp->Height;
  2619. int nWG = pForm->ClientWidth - pForm->PnlVmsMsgDisp->Width;
  2620. #if 0
  2621. pForm->ClientHeight = nHG + pObj->Height;
  2622. pForm->ClientWidth = nWG + pObj->Width;
  2623. #endif
  2624. if ((pt.x + pForm->Width + 5) > this->Width)
  2625. {
  2626. pt.x = this->Width - pForm->Width - 5;
  2627. }
  2628. if ((pt.y + pForm->Height + 5) > this->Height)
  2629. {
  2630. pt.y = this->Height - pForm->Height - 5;
  2631. }
  2632. pForm->Left = Left + pt.x;
  2633. pForm->Top = Top + pt.y;
  2634. pObj->FData1 = (void*)pForm;
  2635. pForm->Show();
  2636. }
  2637. } catch(...) {}
  2638. }
  2639. //---------------------------------------------------------------------------
  2640. void __fastcall TITS00MAP::ShowVmsCamera(String AId, TPoint pt)
  2641. {
  2642. TItsVms *pObj = ItsFacilityManager->FVmsLists.Find(FSelId);
  2643. if (!pObj) return;
  2644. try {
  2645. if (pObj->FData2)
  2646. {
  2647. TFrmVmsCam *pForm = (TFrmVmsCam *)pObj->FData2;
  2648. pForm->SetFocus();
  2649. //pForm->RefreshVms();
  2650. }
  2651. else
  2652. {
  2653. TFrmVmsCam *pForm = new TFrmVmsCam(ITS0000M);;
  2654. pForm->Parent = ITS0000M;
  2655. if ((pt.x + pForm->Width + 5) > this->Width)
  2656. {
  2657. pt.x = this->Width - pForm->Width - 5;
  2658. }
  2659. if ((pt.y + pForm->Height + 5) > this->Height)
  2660. {
  2661. pt.y = this->Height - pForm->Height - 5;
  2662. }
  2663. pForm->Left = Left + pt.x;
  2664. pForm->Top = Top + pt.y;
  2665. pForm->FObj = pObj;
  2666. pObj->FData2 = (void*)pForm;
  2667. pForm->Show();
  2668. }
  2669. } catch(...) {}
  2670. }
  2671. //---------------------------------------------------------------------------
  2672. void __fastcall TITS00MAP::RefreshGisLink()
  2673. {
  2674. SelectLinkById(g_SelLink.Level, g_SelLink.Id, true);
  2675. }
  2676. //---------------------------------------------------------------------------
  2677. void __fastcall TITS00MAP::MnuWebCamClick(TObject *Sender)
  2678. {
  2679. Application->ProcessMessages();
  2680. TPoint pt;
  2681. GetCursorPos(&pt);
  2682. pt = ITS0000M->ScreenToClient(pt);
  2683. ShowWebCamera(FSelId, pt);
  2684. }
  2685. //---------------------------------------------------------------------------
  2686. void __fastcall TITS00MAP::ShowWebCamera(String AId, TPoint pt)
  2687. {
  2688. TItsWebCam *pObj = ItsFacilityManager->FWebCamLists.Find(FSelId);
  2689. if (!pObj) return;
  2690. try {
  2691. if (pObj->FData2)
  2692. {
  2693. TFrmWebCam *pForm = (TFrmWebCam *)pObj->FData2;
  2694. #if 0
  2695. if ((pt.x + pForm->Width + 5) > this->Width)
  2696. {
  2697. pt.x = this->Width - pForm->Width - 5;
  2698. }
  2699. if ((pt.y + pForm->Height + 5) > this->Height)
  2700. {
  2701. pt.y = this->Height - pForm->Height - 5;
  2702. }
  2703. pForm->Left = Left + pt.x;
  2704. pForm->Top = Top + pt.y;
  2705. #endif
  2706. pForm->SetFocus();
  2707. }
  2708. else
  2709. {
  2710. TFrmWebCam *pForm = new TFrmWebCam(ITS0000M, pObj);
  2711. pForm->Parent = ITS0000M;
  2712. if ((pt.x + pForm->Width + 5) > this->Width)
  2713. {
  2714. pt.x = this->Width - pForm->Width - 5;
  2715. }
  2716. if ((pt.y + pForm->Height + 5) > this->Height)
  2717. {
  2718. pt.y = this->Height - pForm->Height - 5;
  2719. }
  2720. pForm->Left = Left + pt.x;
  2721. pForm->Top = Top + pt.y;
  2722. pObj->FData2 = (void*)pForm;
  2723. pForm->Show();
  2724. }
  2725. } catch(...) {}
  2726. }
  2727. //---------------------------------------------------------------------------
  2728. void __fastcall TITS00MAP::TmrLblTrafficTimer(TObject *Sender)
  2729. {
  2730. TmrLblTraffic->Enabled = false;
  2731. LblTraffic->Visible = false;
  2732. }
  2733. //---------------------------------------------------------------------------
  2734. void __fastcall TITS00MAP::UpdateGisRoadRank()
  2735. {
  2736. return;
  2737. int nLyrIdx;
  2738. nLyrIdx = xsrvrMap->GetLayerIndex(LEVEL1_LINK_LAYER_NAME);
  2739. if (nLyrIdx >= 0)
  2740. {
  2741. UpdateGisRoadRank(1, nLyrIdx);
  2742. }
  2743. nLyrIdx = xsrvrMap->GetLayerIndex(LEVEL2_LINK_LAYER_NAME);
  2744. if (nLyrIdx >= 0)
  2745. {
  2746. UpdateGisRoadRank(2, nLyrIdx);
  2747. }
  2748. nLyrIdx = xsrvrMap->GetLayerIndex(LEVEL3_LINK_LAYER_NAME);
  2749. if (nLyrIdx >= 0)
  2750. {
  2751. UpdateGisRoadRank(3, nLyrIdx);
  2752. }
  2753. }
  2754. //---------------------------------------------------------------------------
  2755. void __fastcall TITS00MAP::UpdateGisRoadRank(int ALinkLevel, int ALyrIdx)
  2756. {
  2757. System::AnsiString sRoadRankNm = "SD_ROAD_RANK";
  2758. System::AnsiString sLinkIdNm = "SD_LINK_ID";
  2759. int ii, jj, idx;
  2760. int nFldCnt, nTotCnt;
  2761. unsigned char sl;
  2762. TFieldInfos FldInfos;
  2763. char buf[512];
  2764. String sGisLinkId = "";
  2765. String sGisRoadRank = "";
  2766. String sDbRoadRank = "";
  2767. String sUtisRoadRank = "";
  2768. try
  2769. {
  2770. try
  2771. {
  2772. FGisStream = new TMemoryStream();
  2773. FGisStream->LoadFromStream(xsrvrMap->GetLayerAttSTM(ALyrIdx));
  2774. FGisStream->Position = 0;
  2775. FGisStream->ReadBuffer(&nTotCnt, 4);
  2776. FGisStream->ReadBuffer(&nFldCnt,4);
  2777. FldInfos.Length = nFldCnt;
  2778. FGisStream->Position = 8;
  2779. for (ii = 0; ii < nFldCnt; ii++)
  2780. {
  2781. FGisStream->ReadBuffer(&sl, 1);
  2782. memset(buf, 0x00, sizeof(buf));
  2783. FGisStream->ReadBuffer(buf, sl);
  2784. FldInfos[ii].FFieldName = System::AnsiString(buf);
  2785. FGisStream->ReadBuffer(&(FldInfos[ii].FFieldType), sizeof(FldInfos[ii].FFieldType));
  2786. }
  2787. for (ii = 0; ii < nTotCnt; ii++)
  2788. {
  2789. if (FGisStream->Position >= FGisStream->Size) break;
  2790. for (jj = 0; jj < nFldCnt; jj++)
  2791. {
  2792. switch (FldInfos[jj].FFieldType)
  2793. {
  2794. case ftSmallint : FGisStream->Position += sizeof(short); break;
  2795. case ftFloat : FGisStream->Position += sizeof(double); break;
  2796. case ftWord : FGisStream->Position += sizeof(unsigned short); break;
  2797. case ftBoolean : FGisStream->Position += sizeof(bool); break;
  2798. case ftDate :
  2799. case ftTime :
  2800. case ftDateTime : FGisStream->Position += sizeof(TDateTime); break;
  2801. case ftInteger : FGisStream->Position += sizeof(int); break;
  2802. case ftString :
  2803. case ftWideString :
  2804. FGisStream->ReadBuffer(&sl, 1);
  2805. if (sl <= 1)
  2806. {
  2807. if (sl == 1)
  2808. FGisStream->Position += sl;
  2809. else
  2810. continue;
  2811. }
  2812. else
  2813. {
  2814. memset(buf, 0x00, sizeof(buf));
  2815. FGisStream->ReadBuffer(buf, sl);
  2816. if (FldInfos[jj].FFieldName == sLinkIdNm)
  2817. {
  2818. sGisLinkId = String(buf);
  2819. }
  2820. else
  2821. if (FldInfos[jj].FFieldName == sRoadRankNm)
  2822. {
  2823. if (sl == 4)
  2824. {
  2825. sDbRoadRank = "";
  2826. switch(ALinkLevel)
  2827. {
  2828. case 1: //레벨1 링크(표준링크)
  2829. {
  2830. TItsLink *pLink = ItsLinkManager->FLists.Find(sGisLinkId);
  2831. if (pLink) sDbRoadRank = pLink->SECT_GRAD_CD;
  2832. }
  2833. break;
  2834. case 2: //레벨2 링크(서비스링크)
  2835. {
  2836. TItsServiceLink *pLink = ItsServiceLinkManager->FLists.Find(sGisLinkId);
  2837. if (pLink) sDbRoadRank = pLink->SECT_GRAD_CD;
  2838. }
  2839. break;
  2840. case 3: //도로
  2841. {
  2842. TItsRoad *pLink = ItsRoadManager->FLists.Find(sGisLinkId);
  2843. if (pLink) sDbRoadRank = pLink->SECT_GRAD_CD;
  2844. }
  2845. break;
  2846. }
  2847. if (sDbRoadRank != "")
  2848. {
  2849. sUtisRoadRank = "10" + sDbRoadRank.SubString(4,1);
  2850. sGisRoadRank = String(buf);
  2851. if (sUtisRoadRank != sGisRoadRank)
  2852. {
  2853. FGisStream->Position -= sl;
  2854. FGisStream->WriteBuffer(AnsiString(sUtisRoadRank).c_str(), sl);
  2855. }
  2856. }
  2857. #if 0
  2858. if (sDbRoadRank == "SRT1") sUtisRoadRank = "101";
  2859. else
  2860. if (sDbRoadRank == "SRT2") sUtisRoadRank = "102";
  2861. else
  2862. if (sDbRoadRank == "SRT3") sUtisRoadRank = "103";
  2863. else
  2864. if (sDbRoadRank == "SRT4") sUtisRoadRank = "104";
  2865. else
  2866. if (sDbRoadRank == "SRT5") sUtisRoadRank = "105";
  2867. else
  2868. if (sDbRoadRank == "SRT6") sUtisRoadRank = "106";
  2869. else
  2870. if (sDbRoadRank == "SRT7") sUtisRoadRank = "107";
  2871. #endif
  2872. }
  2873. }
  2874. }
  2875. break;
  2876. default:
  2877. break;
  2878. }
  2879. }
  2880. }
  2881. xsrvrMap->SetLayerAttSTM(ALyrIdx, FGisStream);
  2882. }
  2883. catch(Exception &e)
  2884. {
  2885. }
  2886. }
  2887. __finally
  2888. {
  2889. if (FGisStream) delete FGisStream;
  2890. }
  2891. }
  2892. //---------------------------------------------------------------------------