12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272 |
- //---------------------------------------------------------------------------
- #include "FrmVmsCamF.h"
- #include "FrmWebCamF.h"
- #include <vcl.h>
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "XiMapUtilF.h"
- #include "CDSTrafficGradeF.h"
- #include "CDSFacilityF.h"
- #include "CDSIncidentF.h"
- #pragma hdrstop
- #include <OleCtrls.hpp>
- #include "ITS00MAPF.h"
- #include "ITS0000MF.h"
- #include "FrmCctvImgF.h"
- #include "FrmCctvCamF.h"
- #include "FrmVmsMsgF.h"
- #include "FrmLinkInfoF.h"
- #include "FrmGisSearchF.h"
- #include "FrmMainF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "cxCheckBox"
- #pragma link "cxContainer"
- #pragma link "cxControls"
- #pragma link "cxEdit"
- #pragma link "cxGraphics"
- #pragma link "cxGroupBox"
- #pragma link "cxLabel"
- #pragma link "cxLookAndFeelPainters"
- #pragma link "cxLookAndFeels"
- #pragma link "cxMaskEdit"
- #pragma link "cxProgressBar"
- #pragma link "cxSpinEdit"
- #pragma link "cxTextEdit"
- #pragma link "dxGDIPlusClasses"
- #pragma link "dxSkinBlack"
- #pragma link "dxSkinBlue"
- #pragma link "dxSkinCaramel"
- #pragma link "dxSkinCoffee"
- #pragma link "dxSkinDarkRoom"
- #pragma link "dxSkinDarkSide"
- #pragma link "dxSkinFoggy"
- #pragma link "dxSkinGlassOceans"
- #pragma link "dxSkiniMaginary"
- #pragma link "dxSkinLilian"
- #pragma link "dxSkinLiquidSky"
- #pragma link "dxSkinLondonLiquidSky"
- #pragma link "dxSkinMcSkin"
- #pragma link "dxSkinMoneyTwins"
- #pragma link "dxSkinOffice2007Black"
- #pragma link "dxSkinOffice2007Blue"
- #pragma link "dxSkinOffice2007Green"
- #pragma link "dxSkinOffice2007Pink"
- #pragma link "dxSkinOffice2007Silver"
- #pragma link "dxSkinOffice2010Black"
- #pragma link "dxSkinOffice2010Blue"
- #pragma link "dxSkinOffice2010Silver"
- #pragma link "dxSkinsCore"
- #pragma link "dxSkinSeven"
- #pragma link "dxSkinSharp"
- #pragma link "dxSkinSilver"
- #pragma link "dxSkinStardust"
- #pragma resource "*.dfm"
- //---------------------------------------------------------------------------
- TITS00MAP *ITS00MAP = NULL;
- const String LEVEL1_LINK_LAYER_NAME = "GD_LINK_LV7.dvf";
- const String LEVEL2_LINK_LAYER_NAME = "GD_LINK_LV6.dvf";
- const String LEVEL3_LINK_LAYER_NAME = "GD_LINK_LV5.dvf";
- const String LEVEL1_NODE_LAYER_NAME = "GD_NODE_LV7.dvf";
- const String LEVEL2_NODE_LAYER_NAME = "GD_NODE_LV6.dvf";
- const String LEVEL3_NODE_LAYER_NAME = "GD_NODE_LV5.dvf";
- const String LEVEL1_TRAFFIC_SQL =
- "SELECT A.LINK_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
- " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
- " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
- " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
- " FROM TB_LINK A, \r\n"
- " (SELECT * \r\n"
- " FROM TB_LINK_TRAF \r\n"
- " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
- " ) B \r\n"
- " WHERE A.LINK_ID = B.LINK_ID(+) \r\n";
- const String LEVEL2_TRAFFIC_SQL =
- "SELECT A.IFSC_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
- " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
- " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
- " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
- " FROM TB_IFSC A, \r\n"
- " (SELECT * \r\n"
- " FROM TB_IFSC_TRAF \r\n"
- " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
- " ) B \r\n"
- " WHERE A.IFSC_ID = B.IFSC_ID(+) \r\n";
- const String LEVEL3_TRAFFIC_SQL =
- "SELECT A.ROAD_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
- " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
- " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
- " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
- " FROM TB_ROAD A, \r\n"
- " (SELECT * \r\n"
- " FROM TB_ROAD_TRAF \r\n"
- " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
- " ) B \r\n"
- " WHERE A.ROAD_ID = B.ROAD_ID(+) \r\n";
- String g_sLinkLyrName[MAX_LAYERS] = {
- "",//LEVEL3_LINK_LAYER_NAME,
- "",//LEVEL3_LINK_LAYER_NAME,
- "",//LEVEL3_LINK_LAYER_NAME,
- "",//LEVEL2_LINK_LAYER_NAME,
- "",//LEVEL2_LINK_LAYER_NAME,
- "",//LEVEL1_LINK_LAYER_NAME,
- "",//LEVEL1_LINK_LAYER_NAME,
- };
- String g_sNodeLyrName[MAX_LAYERS] = {
- "",//LEVEL3_NODE_LAYER_NAME,
- "",//LEVEL3_NODE_LAYER_NAME,
- "",//LEVEL3_NODE_LAYER_NAME,
- "",//LEVEL2_NODE_LAYER_NAME,
- "",//LEVEL2_NODE_LAYER_NAME,
- "",//LEVEL1_NODE_LAYER_NAME,
- "",//LEVEL1_NODE_LAYER_NAME,
- };
- int g_nLinkLyrLevel[MAX_LAYERS] = {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- };
- //아래거는 사용안함
- #if 0
- bool g_bLinkLyrLoad[MAX_LAYERS] = {
- false,
- false,
- true,
- true,
- false,
- true,
- false,
- };
- String g_sTrafficSql[MAX_LAYERS] = {
- "0************************************************************************\r\n",
- "1************************************************************************\r\n",
- "SELECT A.ROAD_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
- " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
- " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
- " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
- " FROM TB_ROAD A, \r\n"
- " (SELECT * \r\n"
- " FROM TB_ROAD_TRAF \r\n"
- " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
- " ) B \r\n"
- " WHERE A.ROAD_ID = B.ROAD_ID(+) \r\n",
- "SELECT A.IFSC_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
- " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
- " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
- " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
- " FROM TB_IFSC A, \r\n"
- " (SELECT * \r\n"
- " FROM TB_IFSC_TRAF \r\n"
- " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
- " ) B \r\n"
- " WHERE A.IFSC_ID = B.IFSC_ID(+) \r\n",
- "4************************************************************************\r\n",
- "SELECT A.LINK_ID AS LINKID, NVL(B.SPED, 0) AS SPEED, \r\n"
- " NVL(B.PRCN_DT, '19000101000000') AS REGDATE, \r\n"
- " NVL(B.DATA_NUM, 0) AS DATACNT, \r\n"
- " NVL(B.TRVL_HH, 0) AS TRVTM \r\n"
- " FROM TB_LINK A, \r\n"
- " (SELECT * \r\n"
- " FROM TB_LINK_TRAF \r\n"
- " WHERE PRCN_DT > TO_CHAR(SYSDATE - 5 / 1440, 'YYYYMMDDHH24MISS') \r\n"
- " ) B \r\n"
- " WHERE A.LINK_ID = B.LINK_ID(+) \r\n",
- "6************************************************************************\r\n",
- };
- #endif
- //---------------------------------------------------------------------------
- __fastcall TITS00MAP::TITS00MAP(TComponent* Owner, TForm *ParentForm)
- : TForm(Owner)
- {
- ::CoInitialize(NULL);
- ITSSkin_Load(this);
- LoadLocalSkin();
-
- panRemark->Visible = false;
-
- m_objToolTip = NULL;
- m_slToolTip = new TStringList();
- m_slFldName = new TStringList();
- m_slFldValue = new TStringList();
- m_slLinkFldName = new TStringList();
- m_slLinkFldValue = new TStringList();
- m_nMapLevel = 1;
-
- //마우스 제어 플래그 초기화
- m_bMouseDown = false;
- m_bMoveCenter = false;
- m_bCalcMode = false;
- m_bCalcCont = false;
- m_ptDown.x = m_ptDown.y = 0;
- //체크박스
- ChkDrawVds->Checked = false;
- ChkDrawAvi->Checked = false;
- ChkDrawDsrc->Checked = false;
- ChkDrawRse->Checked = false;
- ChkWebCam->Checked = false;
- ChkDrawVds->Visible = false;
- ChkDrawAvi->Visible = false;
- ChkDrawDsrc->Visible = false;
- ChkDrawRse->Visible = false;
- ChkWebCam->Visible = false;
- GrpFacility->Width = 124;
- //범례
- GrpRse->Visible = false;
- GrpWeb->Visible = false;
- GrpVds->Visible = false;
- GrpAvi->Visible = false;
- GrpDsrc->Visible = false;
- panRemark->Height = 198;
- LoadConfig();
- CreateToolTip();
- }
- //---------------------------------------------------------------------------
- /*
- * 환경설정정보 로딩
- *
- * arguments
- *
- * return
- * void
- */
- void __fastcall TITS00MAP::LoadConfig()
- {
- #if 0
- TIniFile *pIniFile = NULL;
- String sIniFile = ChangeFileExt(ExtractFileName(Application->ExeName), ".ini");
- String sCfgFile = ExtractFilePath(Application->ExeName) + "\\cfg\\" + sIniFile;
- try
- {
- try
- {
- pIniFile = new TIniFile(sCfgFile);
- // 표출이미지 로딩
- //LoadImageFile(pIniFile->ReadString("IMAGE", "CENTER", ""), ImgOffice);
- LoadImageFile(pIniFile->ReadString("IMAGE", "RSE_N", ""), ImgRseN);
- LoadImageFile(pIniFile->ReadString("IMAGE", "RSE_C", ""), ImgRseC);
- LoadImageFile(pIniFile->ReadString("IMAGE", "CCTV_N", ""), ImgCctvN);
- LoadImageFile(pIniFile->ReadString("IMAGE", "CCTV_C", ""), ImgCctvC);
- LoadImageFile(pIniFile->ReadString("IMAGE", "CCTV_M", ""), ImgCctvM);
- LoadImageFile(pIniFile->ReadString("IMAGE", "VMS_N", ""), ImgVmsN);
- LoadImageFile(pIniFile->ReadString("IMAGE", "VMS_C", ""), ImgVmsC);
- LoadImageFile(pIniFile->ReadString("IMAGE", "VMS_M", ""), ImgVmsM);
- LoadImageFile(pIniFile->ReadString("IMAGE", "INC_01", ""), ImgInc01);
- LoadImageFile(pIniFile->ReadString("IMAGE", "INC_02", ""), ImgInc02);
- LoadImageFile(pIniFile->ReadString("IMAGE", "INC_03", ""), ImgInc03);
- LoadImageFile(pIniFile->ReadString("IMAGE", "INC_04", ""), ImgInc04);
- }
- __finally
- {
- if (pIniFile) delete pIniFile;
- pIniFile = NULL;
- }
- }
- catch(...)
- {
- }
- #endif
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::CreateToolTip()
- {
- if (NULL == m_objToolTip)
- {
- m_objToolTip = new TzHintWindow(this);
- m_objToolTip->FHint->Font->Name = "돋움체";
- m_objToolTip->FHint->Font->Size = 9;
- //xclntMap->ToolTipFont->Size = 9;
- xclntMap->SetDisplayFontSize(9);
- m_objToolTip->DoubleBuffered = true;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ClearToolTip()
- {
- if (m_objToolTip)
- {
- if (m_objToolTip->HandleAllocated())
- m_objToolTip->ReleaseHandle();
- m_objToolTip->FHint->ColorArrowBackground = (TColor)0x41CAFF;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::LoadImageFile(String sImgFile, TImage *pImage)
- {
- if (sImgFile.Trim() == "") return;
- try
- {
- ImgTemp->Picture->Assign(NULL);
- ImgTemp->Picture->LoadFromFile(sImgFile);
- pImage->Picture->Assign(pImage->Picture);
- ImgTemp->Picture->Assign(NULL);
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- /*
- * 메인화면 FormDestroy시 호출되는 Method
- * Form의 자원이 해제 되기 이전에 반드시 이 Method가 호출된다.
- * 그러므로 최종적으로 자원을 해제 하고자 한다면 이곳에서 처리하는게 확실함.
- * parameter
- * Sender : Event를 보낸 객체
- * return
- * None
- */
- void __fastcall TITS00MAP::FormDestroy(TObject *Sender)
- {
- try
- {
- for (int ii = 0; ii < MAX_LAYERS; ii++)
- {
- if (m_pLinkSpeedUpdate[ii] == NULL) continue;
-
- try {
- m_pLinkSpeedUpdate[ii]->isRuning = false;
- m_pLinkSpeedUpdate[ii]->Terminate();
- //free(m_pLinkSpeedUpdate[ii]);
- } catch(...) {}
- }
- if (m_slLinkFldName != NULL) delete m_slLinkFldName;
- if (m_slLinkFldValue != NULL) delete m_slLinkFldValue;
- if (m_slFldName != NULL) delete m_slFldName;
- if (m_slFldValue != NULL) delete m_slFldValue;
- if (m_slToolTip != NULL) delete m_slToolTip;
- if (m_objToolTip != NULL) delete m_objToolTip;
- if (xclntMap->Active) xclntMap->Active = false;
- if (xsrvrMap->Active) xsrvrMap->Active = false;
- }
- catch (...)
- {
- }
- ::CoUninitialize();
- }
- //---------------------------------------------------------------------------
- /*
- * form을 보여줄때 호출되는 event 메서드이다.
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TITS00MAP::FormShow(TObject *Sender)
- {
- Refresh();
- FormInit();
- Application->ProcessMessages();
- TmrShow->Enabled = true;
- }
- //---------------------------------------------------------------------------
- /*
- * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
- * Form과 DataModule class를 delete시킨다.
- * arguments
- *
- * return
- * void
- */
- void __fastcall TITS00MAP::CommClose()
- {
- //ITS00MAP = NULL;
- //::CoUninitialize();
- }
- //---------------------------------------------------------------------------
- /*
- * Form의 초기화 작업을 수행한다.
- * arguments
- * void
- * return
- * void
- */
- bool __fastcall TITS00MAP::FormInit()
- {
- memset((char*)&m_PrevExt, 0x00, sizeof(m_PrevExt));
- memset((char*)&m_ExtQ, 0x00, sizeof(m_ExtQ));
- m_ExtQ.bExtent = true;
- m_ExtQ.userIdx = 0;
- m_ExtQ.currIdx = 0;
- return true;
- }
- //---------------------------------------------------------------------------
- /*
- * Form의 Skin 초기화 작업을 수행한다.
- * arguments
- * void
- * return
- * void
- */
- void __fastcall TITS00MAP::LoadLocalSkin()
- {
- //PnlMenu->ParentColor = false;
- //PnlMenu->Color = 0x00FF9D62;
- PnlTrf00->ParentColor = false;
- PnlTrf00->Color = clSilver;
- PnlTrf01->ParentColor = false;
- PnlTrf01->Color = clLime;
- PnlTrf02->ParentColor = false;
- PnlTrf02->Color = clYellow;
- PnlTrf03->ParentColor = false;
- PnlTrf03->Color = clRed;
- /*
- * GIS Command button skin
- */
- TImage *pImgZoomIn_n;
- TImage *pImgZoomIn_c;
- TImage *pImgCenter_n;
- TImage *pImgCenter_c;
- TImage *pImgPrev_c;
- TImage *pImgPrev_n;
- TImage *pImgSel_n;
- TImage *pImgSel_c;
- TImage *pImgDist_n;
- TImage *pImgCircle_c;
- TImage *pImgCircle_n;
- TImage *pImgDist_c;
- TImage *pImgStnd_n;
- TImage *pImgSave_c;
- TImage *pImgSave_n;
- TImage *pImgStnd_c;
- TImage *pImgZoomOut_n;
- TImage *pImgZoomOut_c;
- TImage *pImgPan_c;
- TImage *pImgPan_n;
- TImage *pImgNext_n;
- TImage *pImgNext_c;
- TImage *pImgBoundary_c;
- TImage *pImgBoundary_n;
- TImage *pImgSquare_n;
- TImage *pImgSquare_c;
- TImage *pImgFull_c;
- TImage *pImgFull_n;
- TImage *pImgRefresh_n;
- TImage *pImgRefresh_c;
- TImage *pImgPrint_c;
- TImage *pImgPrint_n;
- int nSkin = 1;
- switch (nSkin)
- {
- case 10:
- pImgZoomIn_n = ImgZoomIn_c;
- pImgZoomIn_c = ImgZoomIn_n;
- pImgZoomOut_n = ImgZoomOut_c;
- pImgZoomOut_c = ImgZoomOut_n;
- pImgCenter_n = ImgCenter_c;
- pImgCenter_c = ImgCenter_n;
- pImgPan_c = ImgPan_n;
- pImgPan_n = ImgPan_c;
- pImgPrev_c = ImgPrev_n;
- pImgPrev_n = ImgPrev_c;
- pImgNext_n = ImgNext_c;
- pImgNext_c = ImgNext_n;
- pImgBoundary_c = ImgBoundary_n;
- pImgBoundary_n = ImgBoundary_c;
- pImgSel_n = ImgSel_c;
- pImgSel_c = ImgSel_n;
- pImgDist_n = ImgDist_c;
- pImgDist_c = ImgDist_n;
- pImgSquare_n = ImgSquare_c;
- pImgSquare_c = ImgSquare_n;
- pImgCircle_c = ImgCircle_n;
- pImgCircle_n = ImgCircle_c;
- pImgFull_c = ImgFull_n;
- pImgFull_n = ImgFull_c;
- pImgStnd_n = ImgStnd_c;
- pImgStnd_c = ImgStnd_n;
- pImgRefresh_n = ImgRefresh_c;
- pImgRefresh_c = ImgRefresh_n;
- pImgPrint_c = ImgPrint_n;
- pImgPrint_n = ImgPrint_c;
- pImgSave_c = ImgSave_n;
- pImgSave_n = ImgSave_c;
- break;
- case 1: case 2: case 3: case 0:
- case 4: case 5: default:
- pImgZoomIn_n = ImgZoomIn_n;
- pImgZoomIn_c = ImgZoomIn_c;
- pImgZoomOut_n = ImgZoomOut_n;
- pImgZoomOut_c = ImgZoomOut_c;
- pImgCenter_n = ImgCenter_n;
- pImgCenter_c = ImgCenter_c;
- pImgPan_c = ImgPan_c;
- pImgPan_n = ImgPan_n;
- pImgPrev_c = ImgPrev_c;
- pImgPrev_n = ImgPrev_n;
- pImgNext_n = ImgNext_n;
- pImgNext_c = ImgNext_c;
- pImgBoundary_c = ImgBoundary_c;
- pImgBoundary_n = ImgBoundary_n;
- pImgSel_n = ImgSel_n;
- pImgSel_c = ImgSel_c;
- pImgDist_n = ImgDist_n;
- pImgDist_c = ImgDist_c;
- pImgSquare_n = ImgSquare_n;
- pImgSquare_c = ImgSquare_c;
- pImgCircle_c = ImgCircle_c;
- pImgCircle_n = ImgCircle_n;
- pImgFull_c = ImgFull_c;
- pImgFull_n = ImgFull_n;
- pImgStnd_n = ImgStnd_n;
- pImgStnd_c = ImgStnd_c;
- pImgRefresh_n = ImgRefresh_n;
- pImgRefresh_c = ImgRefresh_c;
- pImgPrint_c = ImgPrint_c;
- pImgPrint_n = ImgPrint_n;
- pImgSave_c = ImgSave_c;
- pImgSave_n = ImgSave_n;
- break;
- }
- try
- {
- ImgZoomIn->NormalPicture->Assign(pImgZoomIn_n->Picture);
- ImgZoomIn->Picture->Assign(pImgZoomIn_n->Picture);
- ImgZoomIn->TogglePicture->Assign(pImgZoomIn_c->Picture);
- ImgZoomIn->ClickedPicture->Assign(pImgZoomIn_n->Picture);
- ImgZoomOut->NormalPicture->Assign(pImgZoomOut_n->Picture);
- ImgZoomOut->Picture->Assign(pImgZoomOut_n->Picture);
- ImgZoomOut->TogglePicture->Assign(pImgZoomOut_c->Picture);
- ImgZoomOut->ClickedPicture->Assign(pImgZoomOut_n->Picture);
- ImgCenter->NormalPicture->Assign(pImgCenter_n->Picture);
- ImgCenter->Picture->Assign(pImgCenter_n->Picture);
- ImgCenter->TogglePicture->Assign(pImgCenter_c->Picture);
- ImgCenter->ClickedPicture->Assign(pImgCenter_n->Picture);
- ImgPan->NormalPicture->Assign(pImgPan_n->Picture);
- ImgPan->Picture->Assign(pImgPan_n->Picture);
- ImgPan->TogglePicture->Assign(pImgPan_c->Picture);
- ImgPan->ClickedPicture->Assign(pImgPan_n->Picture);
- ImgPrev->NormalPicture->Assign(pImgPrev_n->Picture);
- ImgPrev->Picture->Assign(pImgPrev_n->Picture);
- ImgPrev->TogglePicture->Assign(pImgPrev_c->Picture);
- ImgPrev->ClickedPicture->Assign(pImgPrev_n->Picture);
-
- ImgNext->NormalPicture->Assign(pImgNext_n->Picture);
- ImgNext->Picture->Assign(pImgNext_n->Picture);
- ImgNext->TogglePicture->Assign(pImgNext_c->Picture);
- ImgNext->ClickedPicture->Assign(pImgNext_n->Picture);
- ImgPrev->Cursor = crHandPoint;
- ImgNext->Cursor = crHandPoint;
- ImgBoundary->NormalPicture->Assign(pImgBoundary_n->Picture);
- ImgBoundary->Picture->Assign(pImgBoundary_n->Picture);
- ImgBoundary->TogglePicture->Assign(pImgBoundary_c->Picture);
- ImgBoundary->ClickedPicture->Assign(pImgBoundary_n->Picture);
- ImgSel->NormalPicture->Assign(pImgSel_n->Picture);
- ImgSel->Picture->Assign(pImgSel_n->Picture);
- ImgSel->TogglePicture->Assign(pImgSel_c->Picture);
- ImgSel->ClickedPicture->Assign(pImgSel_n->Picture);
- ImgDist->NormalPicture->Assign(pImgDist_n->Picture);
- ImgDist->Picture->Assign(pImgDist_n->Picture);
- ImgDist->TogglePicture->Assign(pImgDist_c->Picture);
- ImgDist->ClickedPicture->Assign(pImgDist_n->Picture);
- ImgSquare->NormalPicture->Assign(pImgSquare_n->Picture);
- ImgSquare->Picture->Assign(pImgSquare_n->Picture);
- ImgSquare->TogglePicture->Assign(pImgSquare_c->Picture);
- ImgSquare->ClickedPicture->Assign(pImgSquare_n->Picture);
- ImgCircle->NormalPicture->Assign(pImgCircle_n->Picture);
- ImgCircle->Picture->Assign(pImgCircle_n->Picture);
- ImgCircle->TogglePicture->Assign(pImgCircle_c->Picture);
- ImgCircle->ClickedPicture->Assign(pImgCircle_n->Picture);
- ImgFull->NormalPicture->Assign(pImgFull_n->Picture);
- ImgFull->Picture->Assign(pImgFull_n->Picture);
- ImgFull->TogglePicture->Assign(pImgFull_c->Picture);
- ImgFull->ClickedPicture->Assign(pImgFull_n->Picture);
- ImgStnd->NormalPicture->Assign(pImgStnd_n->Picture);
- ImgStnd->Picture->Assign(pImgStnd_n->Picture);
- ImgStnd->TogglePicture->Assign(pImgStnd_c->Picture);
- ImgStnd->ClickedPicture->Assign(pImgStnd_n->Picture);
- ImgRefresh->NormalPicture->Assign(pImgRefresh_n->Picture);
- ImgRefresh->Picture->Assign(pImgRefresh_n->Picture);
- ImgRefresh->TogglePicture->Assign(pImgRefresh_c->Picture);
- ImgRefresh->ClickedPicture->Assign(pImgRefresh_n->Picture);
- ImgPrint->NormalPicture->Assign(pImgPrint_n->Picture);
- ImgPrint->Picture->Assign(pImgPrint_n->Picture);
- ImgPrint->TogglePicture->Assign(pImgPrint_c->Picture);
- ImgPrint->ClickedPicture->Assign(pImgPrint_n->Picture);
- ImgSave->NormalPicture->Assign(pImgSave_n->Picture);
- ImgSave->Picture->Assign(pImgSave_n->Picture);
- ImgSave->TogglePicture->Assign(pImgSave_c->Picture);
- ImgSave->ClickedPicture->Assign(pImgSave_n->Picture);
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::TmrShowTimer(TObject *Sender)
- {
- TmrShow->Enabled = false;
- Application->ProcessMessages();
- LoadGisMap();
- Application->ProcessMessages();
- UpdateFacilityStatus();
- Application->ProcessMessages();
- UpdateIncidentStatus();
- }
- //---------------------------------------------------------------------------
- /*
- * 지도데이터 로드 및 프로그램 초기화 작업 수행
- * arguments
- *
- * return
- *
- */
- void __fastcall TITS00MAP::LoadGisMap()
- {
- try
- {
- xsrvrMap->Active = false;
- xclntMap->Active = false;
- }
- catch (...)
- {
- }
- if (!g_GisInfo.bLoadL0) return;
- try
- {
- try
- {
- // 지도로딩 상태바 표출
- PnlProgress->Left = (this->Width - PnlProgress->Width) / 2;
- PnlProgress->Top = (this->Height - PnlProgress->Height) / 2;
- PnlProgress->Top -= 50;
- PnlProgress->Visible = true;
- PbLoadMap->Properties->Text = "전자지도 표출색상 정보 로딩 중...";
- Application->ProcessMessages();
- PbLoadMap->Position = 50;
- TUTISLinkGrade UtisLinkColor;
- GetGisTrafficColor(UtisLinkColor);
- PbLoadMap->Position = 100;
- PbLoadMap->Properties->Text = "전자지도 로딩 중...";
- Application->ProcessMessages();
- // start server
- xsrvrMap->DVAFileName = g_GisInfo.sMapFileNameL0;
- xsrvrMap->ShowLoadBar = false;
- xsrvrMap->UseMem = true;
- xsrvrMap->Active = true;
- xsrvrMap->AutoSave = true;
- //xsrvrMap->SetFullExtent(DDRect(g_GisInfo.dRightBottomX, g_GisInfo.dLeftTopX, g_GisInfo.dRightBottomY, g_GisInfo.dLeftTopY));
- xsrvrMap->SaveLayerInfo();
- // start client
- if (!xsrvrMap->Active)
- {
- ShowMessage("Xr Server Start Failed...");
- return;
- }
- TXiMapBufferSize LineBuffer;
- LineBuffer = xsrvrMap->GetLineBufferSize();
- LineBuffer.Level1 = 3;
- LineBuffer.Level2 = 3;
- LineBuffer.Level3 = 3;
- LineBuffer.Level4 = 3;
- LineBuffer.Level5 = 3;
- LineBuffer.Level6 = 4;
- LineBuffer.Level7 = 4;
- xsrvrMap->SetLineBufferSize(LineBuffer);
- xclntMap->DoubleBuffered = true;
- xclntMap->Start(DDRect(g_GisInfo.dRightBottomX, g_GisInfo.dLeftTopX, g_GisInfo.dRightBottomY, g_GisInfo.dLeftTopY));
- xclntMap->MapPanMode = PMDynamic;
- xclntMap->MaxZoomValue = 0.001;
- xclntMap->BoolIconScale = true;
- xclntMap->Show();
- // 전자지도 도로등급 정보를 업데이트
- UpdateGisRoadRank();
- // 소통정보를 표출할 스레드 생성
- for (int ii = 0; ii < MAX_LAYERS; ii++)
- {
- m_pLinkSpeedUpdate[ii] = NULL;
- }
- int nLayerIndex;
- nLayerIndex = xclntMap->GetLayerIndex(LEVEL1_LINK_LAYER_NAME);
- if (nLayerIndex >= 0)
- {
- m_pLinkSpeedUpdate[nLayerIndex] = new TXiLinkSpeedUpdate(xclntMap, nLayerIndex, 5 * 60);
- m_pLinkSpeedUpdate[nLayerIndex]->SetDBConString(ITSDb_GetConnection()->ConnectionString);
- m_pLinkSpeedUpdate[nLayerIndex]->SetDBQryString (LEVEL1_TRAFFIC_SQL);
- m_pLinkSpeedUpdate[nLayerIndex]->SetDefaultLinkColor();
- m_pLinkSpeedUpdate[nLayerIndex]->SetUTISLinkColor(UtisLinkColor);
- try{
- m_pLinkSpeedUpdate[nLayerIndex]->Resume();
- }catch(Exception &err){throw(err);}
- m_pLinkSpeedUpdate[nLayerIndex]->isRuning = true;
- }
- nLayerIndex = xclntMap->GetLayerIndex(LEVEL2_LINK_LAYER_NAME);
- if (nLayerIndex >= 0)
- {
- m_pLinkSpeedUpdate[nLayerIndex] = new TXiLinkSpeedUpdate(xclntMap, nLayerIndex, 5 * 60);
- m_pLinkSpeedUpdate[nLayerIndex]->SetDBConString(ITSDb_GetConnection()->ConnectionString);
- m_pLinkSpeedUpdate[nLayerIndex]->SetDBQryString (LEVEL2_TRAFFIC_SQL);
- m_pLinkSpeedUpdate[nLayerIndex]->SetDefaultLinkColor();
- m_pLinkSpeedUpdate[nLayerIndex]->SetUTISLinkColor(UtisLinkColor);
- try{
- m_pLinkSpeedUpdate[nLayerIndex]->Resume();
- }catch(Exception &err){throw(err);}
- m_pLinkSpeedUpdate[nLayerIndex]->isRuning = true;
- }
- nLayerIndex = xclntMap->GetLayerIndex(LEVEL3_LINK_LAYER_NAME);
- if (nLayerIndex >= 0)
- {
- m_pLinkSpeedUpdate[nLayerIndex] = new TXiLinkSpeedUpdate(xclntMap, nLayerIndex, 5 * 60);
- m_pLinkSpeedUpdate[nLayerIndex]->SetDBConString(ITSDb_GetConnection()->ConnectionString);
- m_pLinkSpeedUpdate[nLayerIndex]->SetDBQryString (LEVEL3_TRAFFIC_SQL);
- m_pLinkSpeedUpdate[nLayerIndex]->SetDefaultLinkColor();
- m_pLinkSpeedUpdate[nLayerIndex]->SetUTISLinkColor(UtisLinkColor);
- try{
- m_pLinkSpeedUpdate[nLayerIndex]->Resume();
- }catch(Exception &err){throw(err);}
- m_pLinkSpeedUpdate[nLayerIndex]->isRuning = true;
- }
- //레이어정보설정 AAAAA
- TDVAInfo DVAInfo;
- nLayerIndex = xsrvrMap->GetLayerIndex(LEVEL1_LINK_LAYER_NAME);
- if (nLayerIndex >= 0)
- {
- xsrvrMap->GetDVAInfo(nLayerIndex, DVAInfo);
- for (int ii = DVAInfo.pDVAinfo.FSLevel; ii <= DVAInfo.pDVAinfo.FELevel; ii++)
- {
- g_nLinkLyrLevel[ii-1] = 1;
- g_sLinkLyrName[ii-1] = LEVEL1_LINK_LAYER_NAME;
- g_sNodeLyrName[ii-1] = LEVEL1_NODE_LAYER_NAME;
- }
- }
- nLayerIndex = xsrvrMap->GetLayerIndex(LEVEL2_LINK_LAYER_NAME);
- if (nLayerIndex >= 0)
- {
- xsrvrMap->GetDVAInfo(nLayerIndex, DVAInfo);
- for (int ii = DVAInfo.pDVAinfo.FSLevel; ii <= DVAInfo.pDVAinfo.FELevel; ii++)
- {
- g_nLinkLyrLevel[ii-1] = 2;
- g_sLinkLyrName[ii-1] = LEVEL2_LINK_LAYER_NAME;
- g_sNodeLyrName[ii-1] = LEVEL2_NODE_LAYER_NAME;
- }
- }
- nLayerIndex = xsrvrMap->GetLayerIndex(LEVEL3_LINK_LAYER_NAME);
- if (nLayerIndex >= 0)
- {
- xsrvrMap->GetDVAInfo(nLayerIndex, DVAInfo);
- for (int ii = DVAInfo.pDVAinfo.FSLevel; ii <= DVAInfo.pDVAinfo.FELevel; ii++)
- {
- g_nLinkLyrLevel[ii-1] = 3;
- g_sLinkLyrName[ii-1] = LEVEL3_LINK_LAYER_NAME;
- g_sNodeLyrName[ii-1] = LEVEL3_NODE_LAYER_NAME;
- }
- }
- //xclntMap->FullReDraw(); // 지도를 전체 다시 그린다.
- pmuControlGisClick((TObject*)pmuMove); // 전자지도 마우스이벤트를 이동으로 설정
- }
- catch (...)
- {
- }
- }
- __finally
- {
- PnlProgress->Visible = false;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::xsrvrMapEntityAdd(TObject *Sender, AnsiString EntityName, int TotalCnt, int CurCnt)
- {
- PbLoadMap->Position = ((float)CurCnt / TotalCnt) * 100;
- //Application->ProcessMessages();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::GetGisTrafficColor(TUTISLinkGrade &pUtisLinkColor)
- {
- //TJobTick job("GetGisTrafficColor");
- // 고속도로
- pUtisLinkColor.road101.GDLOW.SpdCOLOR = clRed;
- pUtisLinkColor.road101.GDLOW.MinSpeed = 0;
- pUtisLinkColor.road101.GDLOW.MaxSpeed = 30;
- pUtisLinkColor.road101.GDMID.SpdCOLOR = clYellow;
- pUtisLinkColor.road101.GDMID.MinSpeed = 31;
- pUtisLinkColor.road101.GDMID.MaxSpeed = 70;
- pUtisLinkColor.road101.GDHIG.SpdCOLOR = clLime;
- pUtisLinkColor.road101.GDHIG.MinSpeed = 71;
- pUtisLinkColor.road101.GDHIG.MaxSpeed = 255;
- // 자동차전용도로
- pUtisLinkColor.road102.GDLOW.SpdCOLOR = clRed;
- pUtisLinkColor.road102.GDLOW.MinSpeed = 0;
- pUtisLinkColor.road102.GDLOW.MaxSpeed = 30;
- pUtisLinkColor.road102.GDMID.SpdCOLOR = clYellow;
- pUtisLinkColor.road102.GDMID.MinSpeed = 31;
- pUtisLinkColor.road102.GDMID.MaxSpeed = 50;
- pUtisLinkColor.road102.GDHIG.SpdCOLOR = clLime;
- pUtisLinkColor.road102.GDHIG.MinSpeed = 51;
- pUtisLinkColor.road102.GDHIG.MaxSpeed = 255;
- // 일반국도
- pUtisLinkColor.road103.GDLOW.SpdCOLOR = clRed;
- pUtisLinkColor.road103.GDLOW.MinSpeed = 0;
- pUtisLinkColor.road103.GDLOW.MaxSpeed = 10;
- pUtisLinkColor.road103.GDMID.SpdCOLOR = clYellow;
- pUtisLinkColor.road103.GDMID.MinSpeed = 11;
- pUtisLinkColor.road103.GDMID.MaxSpeed = 20;
- pUtisLinkColor.road103.GDHIG.SpdCOLOR = clLime;
- pUtisLinkColor.road103.GDHIG.MinSpeed = 21;
- pUtisLinkColor.road103.GDHIG.MaxSpeed = 255;
- // 특별, 광역시도
- pUtisLinkColor.road104.GDLOW.SpdCOLOR = clRed;
- pUtisLinkColor.road104.GDLOW.MinSpeed = 0;
- pUtisLinkColor.road104.GDLOW.MaxSpeed = 10;
- pUtisLinkColor.road104.GDMID.SpdCOLOR = clYellow;
- pUtisLinkColor.road104.GDMID.MinSpeed = 11;
- pUtisLinkColor.road104.GDMID.MaxSpeed = 20;
- pUtisLinkColor.road104.GDHIG.SpdCOLOR = clLime;
- pUtisLinkColor.road104.GDHIG.MinSpeed = 21;
- pUtisLinkColor.road104.GDHIG.MaxSpeed = 255;
- // 국가지원지방도
- pUtisLinkColor.road105.GDLOW.SpdCOLOR = clRed;
- pUtisLinkColor.road105.GDLOW.MinSpeed = 0;
- pUtisLinkColor.road105.GDLOW.MaxSpeed = 10;
- pUtisLinkColor.road105.GDMID.SpdCOLOR = clYellow;
- pUtisLinkColor.road105.GDMID.MinSpeed = 11;
- pUtisLinkColor.road105.GDMID.MaxSpeed = 20;
- pUtisLinkColor.road105.GDHIG.SpdCOLOR = clLime;
- pUtisLinkColor.road105.GDHIG.MinSpeed = 21;
- pUtisLinkColor.road105.GDHIG.MaxSpeed = 255;
- // 지방도
- pUtisLinkColor.road106.GDLOW.SpdCOLOR = clRed;
- pUtisLinkColor.road106.GDLOW.MinSpeed = 0;
- pUtisLinkColor.road106.GDLOW.MaxSpeed = 10;
- pUtisLinkColor.road106.GDMID.SpdCOLOR = clYellow;
- pUtisLinkColor.road106.GDMID.MinSpeed = 11;
- pUtisLinkColor.road106.GDMID.MaxSpeed = 20;
- pUtisLinkColor.road106.GDHIG.SpdCOLOR = clLime;
- pUtisLinkColor.road106.GDHIG.MinSpeed = 21;
- pUtisLinkColor.road106.GDHIG.MaxSpeed = 255;
- // 시군도
- pUtisLinkColor.road107.GDLOW.SpdCOLOR = clRed;
- pUtisLinkColor.road107.GDLOW.MinSpeed = 0;
- pUtisLinkColor.road107.GDLOW.MaxSpeed = 10;
- pUtisLinkColor.road107.GDMID.SpdCOLOR = clYellow;
- pUtisLinkColor.road107.GDMID.MinSpeed = 11;
- pUtisLinkColor.road107.GDMID.MaxSpeed = 20;
- pUtisLinkColor.road107.GDHIG.SpdCOLOR = clLime;
- pUtisLinkColor.road107.GDHIG.MinSpeed = 21;
- pUtisLinkColor.road107.GDHIG.MaxSpeed = 255;
- TDBLinkColor *pLinkColor = NULL;
- TLinkTrfGrd *pTrgGrd = NULL;
- FOR_STL(TItsTrafficGrade *, pGrade, ItsTrafficGradeManager->FLists)
- {
- FOR_STL(TItsTrafficSubGrade *, pSubGrade, pGrade->FSubLists)
- {
- if (pGrade->SECT_GRAD_CD == "SRT1") //101.고속국도
- pLinkColor = &pUtisLinkColor.road101;
- else
- if (pGrade->SECT_GRAD_CD == "SRT2") //102.도시고속국도
- pLinkColor = &pUtisLinkColor.road102;
- else
- if (pGrade->SECT_GRAD_CD == "SRT3") //103.일반국도
- pLinkColor = &pUtisLinkColor.road103;
- else
- if (pGrade->SECT_GRAD_CD == "SRT4") //104.특별·광역시도
- pLinkColor = &pUtisLinkColor.road104;
- else
- if (pGrade->SECT_GRAD_CD == "SRT5") //105.국가지원지방도
- pLinkColor = &pUtisLinkColor.road105;
- else
- if (pGrade->SECT_GRAD_CD == "SRT6") //106.지방도
- pLinkColor = &pUtisLinkColor.road106;
- else
- if (pGrade->SECT_GRAD_CD == "SRT7") //107.시·군도
- pLinkColor = &pUtisLinkColor.road107;
- else
- continue;
- TColor trfColor;
- if (pSubGrade->CMTR_GRAD_CD == "LTC1")
- {
- pTrgGrd = &pLinkColor->GDHIG;
- trfColor = clLime;
- }
- else
- if (pSubGrade->CMTR_GRAD_CD == "LTC2")
- {
- pTrgGrd = &pLinkColor->GDMID;
- trfColor = clYellow;
- }
- else
- if (pSubGrade->CMTR_GRAD_CD == "LTC3")
- {
- pTrgGrd = &pLinkColor->GDLOW;
- trfColor = clRed;
- }
- else
- continue;
- pTrgGrd->SpdCOLOR = trfColor;
- if (pSubGrade->CMTR_GRAD_CD == "LTC3")
- pTrgGrd->MinSpeed = 0;
- else
- pTrgGrd->MinSpeed = StrToInt(pSubGrade->LWST_TRVL_SPED);
- pTrgGrd->MaxSpeed = StrToInt(pSubGrade->HGHS_TRVL_SPED);
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::SetGisTrafficColor()
- {
- TUTISLinkGrade UtisLinkColor;
- GetGisTrafficColor(UtisLinkColor);
- // 소통정보를 표출할 스레드 생성
- for (int ii = 0; ii < MAX_LAYERS; ii++)
- {
- if (m_pLinkSpeedUpdate[ii] == NULL) continue;
- m_pLinkSpeedUpdate[ii]->SetUTISLinkColor(UtisLinkColor);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::GisMenuCheckClear()
- {
- xclntMap->MapOperation = Nothing;
- pmuZoomIn->Checked = false;
- pmuZoomOut->Checked = false;
- pmuMove->Checked = false;
- pmuIconSel->Checked = false;
- pmuCalLen->Checked = false;
- pmuCalArea->Checked = false;
- pmuRadius->Checked = false;
- pmuMoveCenter->Checked = false;
- pmuGisDefault->Checked = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::pmuGisCalcClick(TObject *Sender)
- {
- TMenuItem *pMenu = (TMenuItem *)Sender;
- SetMapOperation((TXiMapOperation)pMenu->Tag);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::pmuControlGisClick(TObject *Sender)
- {
- TMenuItem *pMenu = (TMenuItem*)Sender;
-
- SetMapOperation((TXiMapOperation)pMenu->Tag);
- }
- //---------------------------------------------------------------------------
- /*
- * 지도제어 설정
- * arguments
- *
- * return
- *
- */
- void __fastcall TITS00MAP::SetMapOperation(TXiMapOperation nMapOper)
- {
- //enum TXiMapOperation { Nothing, OnZoomIn, OnZoomOut, OnPanSt, OnDistance, OnSelect, OnGeoQuery, OnEditting, OnCircle, OnShortPath, OnArea, OnInsert, OnFindEvent, OnNearFind, OnUserDefine };
- GisMenuCheckClear();
- m_bMoveCenter = false;
- m_bCalcMode = false;
- m_bCalcCont = false;
- xclntMap->MapOperation = nMapOper;
- if (OnSelect == nMapOper)
- {
- GrpPos->Visible = true;
- }
- else
- {
- GrpPos->Visible = false;
- }
-
- switch(nMapOper)
- {
- case OnZoomIn: pmuZoomIn->Checked = true; break;
- case OnZoomOut: pmuZoomOut->Checked = true; break;
- case OnPanSt: pmuMove->Checked = true; break;
- case OnSelect: pmuIconSel->Checked = true; break;
- case OnDistance: pmuCalLen->Checked = true; m_bCalcMode = true; break;
- case OnCircle: pmuRadius->Checked = true; m_bCalcMode = true; break;
- case OnArea: pmuCalArea->Checked = true; m_bCalcMode = true; break;
- case OnUserDefine: pmuMoveCenter->Checked = true; m_bMoveCenter = true; //중심이동일 경우에는 모드를 Nothing으로 설정한다.
- default:
- xclntMap->MapOperation = Nothing;
- break;
- }
- if (xclntMap->MapOperation == Nothing)
- {
- pmuGisDefault->Checked = true;
- xclntMap->ClearUserDrawPolyGon();
- xclntMap->ReDraw();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::MnuLayerSettingClick(TObject *Sender)
- {
- Application->ProcessMessages();
- ShowLayerEditForm();
- }
- //---------------------------------------------------------------------------
- /*
- * 레이어편집 설정창 표출
- * arguments
- *
- * return
- * void
- */
- void __fastcall TITS00MAP::ShowLayerEditForm()
- {
- if (!xclntMap->Active)
- {
- return;
- }
-
- if (xclntMap->XiMapServer->SetMapInfo(xclntMap->GetViewExtent()))
- {
- #if 0
- for (int nLyrIdx = 0; nLyrIdx < MAX_LAYERS; nLyrIdx++)
- {
- int nLyrIndex = xsrvrMap->GetLayerIndex(g_sLinkLyrName[nLyrIdx]);
- if (nLyrIndex < 0) continue;
- //if (g_GisInfo.bLinkLayerDup[nLyrIdx]) continue; // 중복된 레이어인 경우 처리할 필요가 없다.
- //g_GisInfo.pLinkStream[nLyrIdx] = (TMemoryStream *)xsrvrMap->GetLayerAttSTM(nLyrIndex);
- }
- #endif
- Application->ProcessMessages();
- }
- }
- //---------------------------------------------------------------------------
- /*
- * 전자지도의 영역을 설정한다.
- * arguments
- * double : left 영역
- * double : top 영역
- * double : right 영역
- * double : bottom 영역
- * return
- * void
- */
- void __fastcall TITS00MAP::SetExtent(TDDRect &curRc)
- {
- if (xclntMap->Active)
- {
- xclntMap->ExtentDraw(curRc);
- }
- }
- //---------------------------------------------------------------------------
- /*
- * 지도 영역 이동 함수. 현재 영역을 영역이동 큐에 추가한다.
- * 다음 버튼을 비활성 시킨다.
- * arguments
- * return
- * void
- */
- bool __fastcall TITS00MAP::AddExtentQ(TDDRect &curRc)
- {
- TDDRect *pExt = &m_ExtQ.extent[m_ExtQ.userIdx];
- memcpy((char*)pExt, (char*)&curRc, sizeof(curRc));
- if (m_PrevExt.MinX == pExt->MinX &&
- m_PrevExt.MinY == pExt->MinY &&
- m_PrevExt.MaxX == pExt->MaxX &&
- m_PrevExt.MaxY == pExt->MaxY)
- {
- return false;
- }
- memcpy((char*)&m_PrevExt, pExt, sizeof(m_PrevExt));
- if (m_ExtQ.userIdx >= D_EXT_QUEUE_SIZE)
- {
- m_ExtQ.userIdx = D_EXT_QUEUE_SIZE;
- memcpy((char *)&m_ExtQ.extent[0], (char *)&m_ExtQ.extent[1], sizeof(TDDRect)*D_EXT_QUEUE_SIZE);
- }
- else
- {
- m_ExtQ.userIdx++;
- }
- m_ExtQ.currIdx = m_ExtQ.userIdx-1;
- return true;
- }
- //---------------------------------------------------------------------------
- /*
- * 지도 영역 이동 함수. 이전 영역으로 이동
- * 이동 범위에 따라 이전/다음 버튼을 활성/비활성 시킨다.
- * arguments
- * return
- * void
- */
- bool __fastcall TITS00MAP::PrevExtentQ()
- {
- m_ExtQ.bExtent = false;
- if (m_ExtQ.currIdx <= 0)
- {
- m_ExtQ.currIdx = 0;
- return false;
- }
- m_ExtQ.currIdx--;
- TDDRect *pExt = &m_ExtQ.extent[m_ExtQ.currIdx];
- SetExtent(*pExt);
- return true;
- }
- //---------------------------------------------------------------------------
- /*
- * 지도 영역 이동 함수. 다음 영역으로 이동
- * 이동 범위에 따라 이전/다음 버튼을 활성/비활성 시킨다.
- * arguments
- * return
- * void
- */
- bool __fastcall TITS00MAP::NextExtentQ()
- {
- m_ExtQ.bExtent = false;
- if (m_ExtQ.currIdx >= m_ExtQ.userIdx-1)
- {
- m_ExtQ.currIdx = m_ExtQ.userIdx-1;
- return false;
- }
- m_ExtQ.currIdx++;
- TDDRect *pExt = &m_ExtQ.extent[m_ExtQ.currIdx];
- SetExtent(*pExt);
- return true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::xclntMapExit(TObject *Sender)
- {
- // 전자지도 영역 밖으로 툴팁 표출을 방지
- ClearToolTip();
- xclntMap->Repaint();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::xclntMapMapChange(TObject *Sender, TPacket &ChangePacket, bool PreImage, bool NextImage)
- {
- try {
- m_drtViewExtent = xclntMap->GetViewExtent(); // 변경된 정보를 저장
- m_nMapLevel = xclntMap->GetLevel(); // 현재 표출되는 전자지도 레벨
- if (xclntMap->IsStart())
- {
- if (m_ExtQ.bExtent)
- {
- AddExtentQ(ChangePacket.Extent);
- }
- m_ExtQ.bExtent = true;
- }
- if (xclntMap->MapOperation == OnZoomIn || xclntMap->MapOperation == OnZoomOut)
- {
- pmuControlGisClick((TObject*)pmuMove);
- }
- LblZoomLevel->Caption = String(m_nMapLevel);
- TDVAInfo DVAInfo;
- int nLayerIdx1 = xclntMap->GetLayerIndex(LEVEL1_LINK_LAYER_NAME);
- if (nLayerIdx1 >= 0)
- {
- xsrvrMap->GetDVAInfo(nLayerIdx1, DVAInfo);
- if (m_nMapLevel >= DVAInfo.pDVAinfo.FSLevel && m_nMapLevel <= DVAInfo.pDVAinfo.FELevel)
- {
- LblLinkLevel->Caption = "1";
- return;
- }
- }
- int nLayerIdx2 = xclntMap->GetLayerIndex(LEVEL2_LINK_LAYER_NAME);
- if (nLayerIdx2 >= 0)
- {
- xsrvrMap->GetDVAInfo(nLayerIdx2, DVAInfo);
- if (m_nMapLevel >= DVAInfo.pDVAinfo.FSLevel && m_nMapLevel <= DVAInfo.pDVAinfo.FELevel)
- {
- LblLinkLevel->Caption = "2";
- return;
- }
- }
- int nLayerIdx3 = xclntMap->GetLayerIndex(LEVEL3_LINK_LAYER_NAME);
- if (nLayerIdx3 >= 0)
- {
- xsrvrMap->GetDVAInfo(nLayerIdx3, DVAInfo);
- if (m_nMapLevel >= DVAInfo.pDVAinfo.FSLevel && m_nMapLevel <= DVAInfo.pDVAinfo.FELevel)
- {
- LblLinkLevel->Caption = "3";
- return;
- }
- }
- LblLinkLevel->Caption = "?";
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::xclntMapMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
- {
- if (!xclntMap->IsStart()) return;
- m_bMouseDown = true;
- xclntMap->SetFocus();
- m_ptDown.x = X;
- m_ptDown.y = Y;
- if (m_objToolTip->HandleAllocated())
- {
- m_objToolTip->ReleaseHandle();
- }
- if (xclntMap->MapOperation == OnSelect)
- {
- if (m_objToolTip->HandleAllocated())
- {
- m_objToolTip->ReleaseHandle();
- }
- ClearToolTip();
- if (Button == mbLeft && OnSelect == xclntMap->MapOperation)
- {
- try {
- TDDPoint dptCurr = xclntMap->ScreenToReal(Point(X, Y));
- SePosX->Value = dptCurr.X;
- SePosY->Value = dptCurr.Y;
- } catch(...) {}
- }
- }
- else if (xclntMap->MapOperation == Nothing)
- {
- if (Button == mbLeft)
- {
- // 중심이동
- if (m_bMoveCenter)
- {
- // 선택지점으로 지도화면 중심이동
- TDDPoint dptCenter;
- dptCenter = xclntMap->ScreenToReal(Point(X, Y));
- xclntMap->MoveExtentDraw(dptCenter);
- return;
- }
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::xclntMapMouseLeave(TMessage &Msg)
- {
- // 전자지도 영역 밖으로 툴팁 표출을 방지
- ClearToolTip();
- xclntMap->Repaint();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::xclntMapMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
- {
- if (!xclntMap->IsStart()) return;
- m_bMouseDown = false;
- if (m_bCalcMode)
- {
- if (Button == mbRight)
- {
- if (m_bCalcCont)
- {
- m_bCalcCont = false;
- }
- else
- {
- m_bCalcMode = false;
- pmuControlGisClick((TObject*)pmuMove);
- }
- }
- else if (Button == mbLeft)
- {
- m_bCalcCont = true;
- }
- return;
- }
- if (Button == mbRight)
- {
- if (Button == mbRight)
- {
- POINT p;
- GetCursorPos(&p);
- pmuGis->Popup(p.x, p.y);
- }
- }
- else if (Button == mbLeft)
- {
- if (OnSelect == xclntMap->MapOperation)
- {
- if (m_ptDown.x == X && m_ptDown.y == Y)
- {
- if (SelectLinkByPos(m_ptDown.x, m_ptDown.y))
- {
- return;
- }
- }
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::xclntMapMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
- {
- if (!xclntMap->IsStart()) return;
- if (m_bCalcMode) return;
- // 마우스 좌표 출력
- TDDPoint dptCurr = xclntMap->ScreenToReal(Point(X, Y));
- try {
- String sMousePos = FormatFloat("##,##0.#####0", dptCurr.X) + " " + FormatFloat("##,##0.#####0", dptCurr.Y);
- FrmMain->dxStatusBar->Panels->Items[isbGisPos]->Text = sMousePos;
- FrmMain->dxStatusBar->Panels->Items[isbGisPos]->StatusBarControl->Refresh();
- } catch(...) {}
- if (ChkToolTip->Checked)
- {
- HintLinkLyr(Shift, X, Y);
- }
- }
- //---------------------------------------------------------------------------
- /*
- * 툴팁 표출
- * arguments
- *
- * return
- *
- */
- void __fastcall TITS00MAP::ShowToolTipInfo(TPoint ptLocation, TStringList *slToolTip)
- {
- int ii;
- int iMaxX = 0;
- int iMaxY = 0;
- int nTmp;
- String strToolTip = "";
- TRect rt;
- //m_objToolTip->FHint->ColorArrowBackground = clBlack;
- //m_objToolTip->FHint->ColorBackground = clRed;
- for (ii = 0; ii < slToolTip->Count - 1; ii++)
- {
- if (iMaxX < m_objToolTip->Canvas->TextWidth(slToolTip->Strings[ii]))
- {
- iMaxX = m_objToolTip->Canvas->TextWidth(slToolTip->Strings[ii]);
- }
- nTmp = m_objToolTip->Canvas->TextHeight(slToolTip->Strings[ii]);
- iMaxY += nTmp;
- strToolTip += slToolTip->Strings[ii] + "\r\n";
- }
- if (iMaxX < m_objToolTip->Canvas->TextWidth(slToolTip->Strings[slToolTip->Count - 1]))
- {
- iMaxX = m_objToolTip->Canvas->TextWidth(slToolTip->Strings[slToolTip->Count -1]);
- }
- nTmp = m_objToolTip->Canvas->TextHeight(slToolTip->Strings[slToolTip->Count - 1]);
- iMaxY += nTmp;
- strToolTip += slToolTip->Strings[slToolTip->Count - 1];
- iMaxX += 6;
- rt.Right = Mouse->CursorPos.x - 5;
- rt.Bottom = Mouse->CursorPos.y - 5;
- rt.Left = rt.Right - iMaxX;
- rt.Top = rt.Bottom - iMaxY;
- m_objToolTip->ActivateHint(rt, strToolTip);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ShowToolTipInfo(TzHintWindow *pTTipWin, TStringList *slToolTip)
- {
- int ii;
- int iMaxX = 0;
- int iMaxY = 0;
- int nTmp;
- String strToolTip = "";
- TRect rt;
- for (ii = 0; ii < slToolTip->Count - 1; ii++)
- {
- if (iMaxX < pTTipWin->Canvas->TextWidth(slToolTip->Strings[ii]))
- {
- iMaxX = pTTipWin->Canvas->TextWidth(slToolTip->Strings[ii]);
- }
- nTmp = pTTipWin->Canvas->TextHeight(slToolTip->Strings[ii]);
- iMaxY += nTmp;
- strToolTip += slToolTip->Strings[ii] + "\r\n";
- }
- if (iMaxX < pTTipWin->Canvas->TextWidth(slToolTip->Strings[slToolTip->Count - 1]))
- {
- iMaxX = pTTipWin->Canvas->TextWidth(slToolTip->Strings[slToolTip->Count -1]);
- }
- nTmp = pTTipWin->Canvas->TextHeight(slToolTip->Strings[slToolTip->Count - 1]);
- iMaxY += nTmp;
- strToolTip += slToolTip->Strings[slToolTip->Count - 1];
- iMaxX += 6;
- rt.Right = Mouse->CursorPos.x - 5;
- rt.Bottom = Mouse->CursorPos.y - 5;
- rt.Left = rt.Right - iMaxX;
- rt.Top = rt.Bottom - iMaxY;
- pTTipWin->ActivateHint(rt, strToolTip);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::MnuViewGrayClick(TObject *Sender)
- {
- MnuViewGray->Checked = !MnuViewGray->Checked;
- xclntMap->XiMapServer->LryGrayColor = MnuViewGray->Checked;
- xclntMap->FullReDraw();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ImgPrevClick(TObject *Sender)
- {
- PrevExtentQ();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ImgNextClick(TObject *Sender)
- {
- NextExtentQ();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ImgFullClick(TObject *Sender)
- {
- if (xclntMap->Active)
- {
- xclntMap->ExtentDraw(xclntMap->GetFullExtent());
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ImgStndClick(TObject *Sender)
- {
- if (xclntMap->Active)
- {
- xclntMap->ExtentDraw(DDRect(g_GisInfo.dRightBottomX, g_GisInfo.dLeftTopX, g_GisInfo.dRightBottomY, g_GisInfo.dLeftTopY));
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ImgRefreshClick(TObject *Sender)
- {
- if (xclntMap->Active)
- {
- // 시설물상태정보
- FrmMain->FPollStatus01.Reset();
- // 프로세스상태정보
- FrmMain->FPollStatus02.Reset();
- RefreshMapTraffic();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ChkTrafficLayerClick(TObject *Sender)
- {
- SetTrfLayerShow(ChkTrafficLayer->Checked);
- }
- //---------------------------------------------------------------------------
- /*
- * 소통정보 레이어 보기 숨기기
- * arguments
- *
- * return
- * void
- */
- void __fastcall TITS00MAP::SetTrfLayerShow(bool bShow)
- {
- TDVAInfo DVAInfo;
- int nLyrIdx = -1;
- try
- {
- for (int ii = 0; ii < MAX_LAYERS; ii++)
- {
- if (m_pLinkSpeedUpdate[ii] == NULL) continue;
- nLyrIdx = xsrvrMap->GetLayerIndex(g_sLinkLyrName[ii]);
- if (nLyrIdx >= 0)
- {
- xsrvrMap->GetDVAInfo(nLyrIdx, DVAInfo);
- // 현재 visible 설정과 다르면 변경
- //if (bShow != DVAInfo.pDVAinfo.FVisible)
- {
- DVAInfo.pDVAinfo.FVisible = bShow;
- xsrvrMap->SetDVAInfo(nLyrIdx, DVAInfo);
- }
- }
- }
- xclntMap->FullReDraw();
- Application->ProcessMessages();
- }
- catch (...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ChkToolTipClick(TObject *Sender)
- {
- if (!ChkToolTip->Checked)
- {
- ClearToolTip();
- xclntMap->Repaint();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::TmrSelectTimer(TObject *Sender)
- {
- TmrSelect->Enabled = false;
- ImgSelect->Visible = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::SelectObjectByPos(double dPosX, double dPosY, bool bArrow/*=false*/)
- {
- if (!xclntMap->IsStart()) return;
- TDDPoint ptCoord;
- ptCoord.X = dPosX;
- ptCoord.Y = dPosY;
- ITS00MAP->xclntMap->MoveExtentDraw(ptCoord);
- ITS00MAP->xclntMap->LevelView(6);
- m_ptSelect.X = dPosX;
- m_ptSelect.Y = dPosY;
- if (bArrow) SelectObjectByPos();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::SelectObjectByPos()
- {
- TPoint ptTmp;
- ImgSelect->Parent = xclntMap;
- ImgSelect->Visible = false;
- TmrSelect->Enabled = false;
- TmrSelect->Interval = 5000;
- ptTmp = xclntMap->RealToScreen(m_ptSelect);
- ImgSelect->Left = ptTmp.x - (ImgSelect->Width/2);
- ImgSelect->Top = ptTmp.y - (ImgSelect->Height)-10;
- TmrSelect->Enabled = true;
- ImgSelect->Visible = true;
- }
- //---------------------------------------------------------------------------
- String __fastcall TITS00MAP::GetLinkLayerName()
- {
- if (m_nMapLevel < 3 || m_nMapLevel > 7) return "no_map";
- return g_sLinkLyrName[m_nMapLevel-1];
- }
- //---------------------------------------------------------------------------
- bool __fastcall TITS00MAP::SelectLinkById(int ALinkLevel, String sId, bool bHide/*=false*/)
- {
- bool bResult = false;
- String sLinkLyrName = "";
- int nLyrIndex = -1;
- switch(ALinkLevel)
- {
- case 1: sLinkLyrName = LEVEL1_LINK_LAYER_NAME; break;
- case 2: sLinkLyrName = LEVEL2_LINK_LAYER_NAME; break;
- case 3: sLinkLyrName = LEVEL3_LINK_LAYER_NAME; break;
- default: return false;
- }
- nLyrIndex = xclntMap->GetLayerIndex(sLinkLyrName);
- if (nLyrIndex < 0) return false;
- TArrInt vObjIDxs;
- TDDPoints pts;
- TDDRect objmbr;
- TDDLineStyle Linestyle;
- TStringList *Linkids = new TStringList();
- Linkids->Add(sId);
- Linkids->Add(sId);
- TDDRect DDRect_Move;
- DDRect_Move.MinX = 200;
- DDRect_Move.MaxX = 0;
- DDRect_Move.MinY = 50;
- DDRect_Move.MaxY = 0;
- try
- {
- if (xsrvrMap->Get_MultiAtt(nLyrIndex, "SD_LINK_ID", Linkids, vObjIDxs))
- {
- for(int i = 0; i < vObjIDxs.High; i++)
- {
- pts = xclntMap->XiMapServer->Get_NstObj(nLyrIndex, vObjIDxs[i], objmbr);
- if (vObjIDxs[i] == -1)
- continue;
- Linestyle.PenWidth = 6;
- Linestyle.PenColor = clPurple;
- Linestyle.OutLineType = true;
- Linestyle.ArrowType = true;
- xclntMap->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);
- if (DDRect_Move.MinX > objmbr.MinX)
- DDRect_Move.MinX = objmbr.MinX;
- if (DDRect_Move.MaxX < objmbr.MaxX)
- DDRect_Move.MaxX = objmbr.MaxX;
- if (DDRect_Move.MinY > objmbr.MinY)
- DDRect_Move.MinY = objmbr.MinY;
- if (DDRect_Move.MaxY < objmbr.MaxY)
- DDRect_Move.MaxY = objmbr.MaxY;
- }
- DDRect_Move.MinX -= 0.002;
- DDRect_Move.MaxX += 0.002;
- DDRect_Move.MinY -= 0.002;
- DDRect_Move.MaxY += 0.002;
- xclntMap->ExtentDraw(DDRect_Move);
- xclntMap->ReDraw();
- bResult = true;
- if (bHide)
- {
- TmrLinkSelect->Enabled = false;
- TmrLinkSelect->Interval= 3000;
- TmrLinkSelect->Enabled = true;
- }
- }
- }
- catch (Exception &e)
- {
- }
- delete Linkids;
- return bResult;
- }
- //---------------------------------------------------------------------------
- bool __fastcall TITS00MAP::SelectLinkById2(int ALinkLevel, String sId, bool bHide/*=false*/)
- {
- bool bResult = false;
- String sLinkLyrName = "";
- int nLyrIndex = -1;
- switch(ALinkLevel)
- {
- case 1: sLinkLyrName = LEVEL1_LINK_LAYER_NAME; break;
- case 2: sLinkLyrName = LEVEL2_LINK_LAYER_NAME; break;
- case 3: sLinkLyrName = LEVEL3_LINK_LAYER_NAME; break;
- default: return false;
- }
- nLyrIndex = xclntMap->GetLayerIndex(sLinkLyrName);
- if (nLyrIndex < 0) return false;
- int nNum = -1;
- AnsiString sFldName = "SD_LINK_ID";
- AnsiString sQryVal = "";
- TStringList *pVal = new TStringList();
- TStringList *pFvl = new TStringList();
- try
- {
- try
- {
- //TXiMapUtil::SelectLinkById(xsrvrMap, xclntMap, nLyrIndex, sId);
- //return true;
- sQryVal = AnsiString(sId);
- nNum = xsrvrMap->QueryAttribute(nLyrIndex, sFldName, sQryVal, pFvl, pVal);
- if (nNum >= 0)
- {
- TDDRect drtObj;
- TDDPoints dptsObj;
- dptsObj.Length = 0;
- dptsObj = xclntMap->XiMapServer->Get_NstObj(nLyrIndex, nNum, drtObj);
- if (dptsObj.Length > 0)
- {
- TDDLineStyle Linestyle;
- Linestyle.PenWidth = 6;
- Linestyle.PenColor = clRed;
- Linestyle.OutLineType = true;
- Linestyle.ArrowType = true;
- if (bHide)
- {
- xclntMap->ClearPathInfo();
- }
- xclntMap->ADDPathInfo(TDDPolyLine(dptsObj), "", 0, 0, Linestyle);
- //xclntMap->ReDrawWithPath();
- drtObj.MaxX = drtObj.MaxX * 1.00006;
- drtObj.MaxY = drtObj.MaxY * 1.00006;
- drtObj.MinX = drtObj.MinX - (drtObj.MaxX * 1.00006 - drtObj.MaxX);
- drtObj.MinY = drtObj.MinY - (drtObj.MaxY * 1.00006 - drtObj.MaxY);
- xclntMap->ExtentDraw(drtObj);
- xclntMap->ReDraw();
- bResult = true;
- if (bHide)
- {
- TmrLinkSelect->Enabled = false;
- TmrLinkSelect->Interval= 3000;
- TmrLinkSelect->Enabled = true;
- }
- }
- }
- }
- catch (Exception &e)
- {
- }
- catch (...)
- {
- }
- }
- __finally
- {
- delete pVal;
- delete pFvl;
- }
- return bResult;
- }
- //---------------------------------------------------------------------------
- bool __fastcall TITS00MAP::SelectLinkByPos(int X, int Y)
- {
- String sLinkId;
- TDVAInfo DVAInfo;
- int nLayerIdx1 = xclntMap->GetLayerIndex(LEVEL1_LINK_LAYER_NAME);
- if (nLayerIdx1 >= 0)
- {
- xsrvrMap->GetDVAInfo(nLayerIdx1, DVAInfo);
- if (m_nMapLevel >= DVAInfo.pDVAinfo.FSLevel && m_nMapLevel <= DVAInfo.pDVAinfo.FELevel)
- {
- if (GetLevelLinkId(1, sLinkId, X, Y))
- {
- ShowLinkDetailInfo(sLinkId, 1);
- return true;
- }
- return false;
- }
- }
- int nLayerIdx2 = xclntMap->GetLayerIndex(LEVEL2_LINK_LAYER_NAME);
- if (nLayerIdx2 >= 0)
- {
- xsrvrMap->GetDVAInfo(nLayerIdx2, DVAInfo);
- if (m_nMapLevel >= DVAInfo.pDVAinfo.FSLevel && m_nMapLevel <= DVAInfo.pDVAinfo.FELevel)
- {
- if (GetLevelLinkId(2, sLinkId, X, Y))
- {
- ShowLinkDetailInfo(sLinkId, 2);
- return true;
- }
- return false;
- }
- }
- int nLayerIdx3 = xclntMap->GetLayerIndex(LEVEL3_LINK_LAYER_NAME);
- if (nLayerIdx3 >= 0)
- {
- xsrvrMap->GetDVAInfo(nLayerIdx3, DVAInfo);
- if (m_nMapLevel >= DVAInfo.pDVAinfo.FSLevel && m_nMapLevel <= DVAInfo.pDVAinfo.FELevel)
- {
- if (GetLevelLinkId(3, sLinkId, X, Y))
- {
- ShowLinkDetailInfo(sLinkId, 3);
- return true;
- }
- return false;
- }
- }
- return false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::TmrLinkSelectTimer(TObject *Sender)
- {
- TmrLinkSelect->Enabled = false;
- xclntMap->ClearUserDrawPolyGon();
- xclntMap->ClearPathInfo();
- xclntMap->ReDraw();
- }
- //---------------------------------------------------------------------------
- /*
- * 링크레이어 도움말 표출
- * arguments
- * return
- * void
- */
- bool __fastcall TITS00MAP::GetLevelLinkId(int ALinkLevel, String &sLinkId, int X, int Y)
- {
- String sLinkLyrName = "";
- int nLyrIndex = -1;
- sLinkId = "";
- switch(ALinkLevel)
- {
- case 1: sLinkLyrName = LEVEL1_LINK_LAYER_NAME; break;
- case 2: sLinkLyrName = LEVEL2_LINK_LAYER_NAME; break;
- case 3: sLinkLyrName = LEVEL3_LINK_LAYER_NAME; break;
- default: return false;
- }
- nLyrIndex = xclntMap->GetLayerIndex(sLinkLyrName);
- if (nLyrIndex < 0) return false;
- try
- {
- if (xsrvrMap->ShpObjInfo(X, Y, nLyrIndex, m_slLinkFldName, m_slLinkFldValue, clWhite, true, false))
- {
- if (m_slLinkFldName->Count != m_slLinkFldValue->Count)
- {
- return false;
- }
- sLinkId = m_slLinkFldValue->Strings[1];
- return true;
- }
- }
- catch(...)
- {
- }
- return false;
- }
- //---------------------------------------------------------------------------
- /*
- * 링크레이어 도움말 표출
- * arguments
- * return
- * void
- */
- bool __fastcall TITS00MAP::HintLinkLyr(TShiftState Shift, int X, int Y)
- {
- if (!ChkToolTip->Checked) return false;
- if (!ChkTrafficLayer->Checked) return false;
-
- int nLyrIndex = -1;
- switch(m_nMapLevel)
- {
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- nLyrIndex = xclntMap->GetLayerIndex(GetLinkLayerName());
- break;
- default: return false;
- }
- if (nLyrIndex < 0) return false;
-
- try
- {
- TDVAInfo DVAInfo;
- xsrvrMap->GetDVAInfo(nLyrIndex, DVAInfo);
- if (DVAInfo.pDVAinfo.FVisible == false) return false;
- //TDDPoint dptCurr = MapClient->ScreenToReal(Point(X, Y));
- // 링크에 대한 공간정보를 검색
- if (xsrvrMap->ShpObjInfo(X, Y, nLyrIndex, m_slFldName, m_slFldValue, clWhite, true, false))
- {
- if (m_slFldName->Count != m_slFldValue->Count)
- {
- return false;
- }
- #if 0
- for(int kk = 0; kk < m_slFldName->Count; kk++)
- ShowMessage(String(kk) + " = " + m_slFldName->Strings[kk] + " : " + m_slFldValue->Strings[kk]);
- #endif
- m_slToolTip->Clear();
- TStringList *UserAtt;
- //아이디1, 시작노드2,종료노드3,등급6,유형7,도로명9,길이20,레벨26
- String sId = m_slFldValue->Strings[1];
- UserAtt = xclntMap->XiMapServer->GetLayerUserDat(nLyrIndex, sId);
- if (!UserAtt) return false;
- m_slToolTip->Add(L"▶▶링크 소통 정보◀◀");
- m_slToolTip->Add(L"도 로 명 : " + m_slFldValue->Strings[ 9]);
- m_slToolTip->Add(L"링크 아이디 : " + m_slFldValue->Strings[ 1]);
- m_slToolTip->Add(L"출 발 노 드 : " + m_slFldValue->Strings[ 2]);
- m_slToolTip->Add(L"도 착 노 드 : " + m_slFldValue->Strings[ 3]);
- m_slToolTip->Add(L"도 로 길 이 : " + m_slFldValue->Strings[20] + " m");
- m_slToolTip->Add(L"차 선 수 : " + m_slFldValue->Strings[ 5] + " 차로");
- m_slToolTip->Add(L"제 한 속 도 : " + m_slFldValue->Strings[12] + " km/h");
- m_slToolTip->Add(L"도 로 레 벨 : " + String(g_nLinkLyrLevel[m_nMapLevel-1]));
- String sRank = m_slFldValue->Strings[6];
- //*
- if (sRank == "101") m_slToolTip->Add(L"도 로 등 급 : [101]고속국도");
- else if (sRank == "102") m_slToolTip->Add(L"도 로 등 급 : [102]도시고속국도");
- else if (sRank == "103") m_slToolTip->Add(L"도 로 등 급 : [103]일반국도");
- else if (sRank == "104") m_slToolTip->Add(L"도 로 등 급 : [104]특별광역시도");
- else if (sRank == "105") m_slToolTip->Add(L"도 로 등 급 : [105]국가지원지방도");
- else if (sRank == "106") m_slToolTip->Add(L"도 로 등 급 : [106]지방도");
- else if (sRank == "107") m_slToolTip->Add(L"도 로 등 급 : [107]시군도");
- else if (sRank == "108") m_slToolTip->Add(L"도 로 등 급 : [108]기타");
- //else m_slToolTip->Add(L"도 로 등 급 : [???]알수없음");
- else m_slToolTip->Add(L"도 로 등 급 : ["+sRank+"]알수없음");
- //*/
- sRank = m_slFldValue->Strings[7];
- //*
- if (sRank == "000") m_slToolTip->Add(L"도 로 유 형 : [000]일반도로");
- else if (sRank == "001") m_slToolTip->Add(L"도 로 유 형 : [001]고가차도");
- else if (sRank == "002") m_slToolTip->Add(L"도 로 유 형 : [002]지하차도");
- else if (sRank == "003") m_slToolTip->Add(L"도 로 유 형 : [003]교량");
- else if (sRank == "004") m_slToolTip->Add(L"도 로 유 형 : [004]터널");
- else if (sRank == "005") m_slToolTip->Add(L"도 로 유 형 : [005]램프");
- else m_slToolTip->Add(L"도 로 유 형 : [???]알수없음");
- //*/
-
- if (UserAtt->Values["SPEED"] == "0" || UserAtt->Values["SPEED"] == "")
- {
- m_slToolTip->Add("구 간 속 도 : 정보없음");
- m_slToolTip->Add("통 행 시 간 : 정보없음");
- m_objToolTip->FHint->ColorArrowBackground = clSilver;
- }
- else
- {
- m_slToolTip->Add("구 간 속 도 : " + UserAtt->Values["SPEED"] + " km/h");
- m_slToolTip->Add("통 행 시 간 : " + ITSUtil_GetSecondToString(StrToInt(UserAtt->Values["TRVTM"])));
- m_slToolTip->Add("수집데이터수 : " + UserAtt->Values["DATACNT"] + " 개");
- m_slToolTip->Add("등 록 일 시 : " + ITSUtil_GetTimeToString(UserAtt->Values["REGDATE"]));
- try{
- TColor clBack = (TColor)(StrToInt(m_slFldValue->Strings[m_slFldName->Count-2]));
- m_objToolTip->FHint->ColorArrowBackground = clBack;
- } catch(...) {
- m_objToolTip->FHint->ColorArrowBackground = clLime;
- }
- }
-
- ShowToolTipInfo(Point(X, Y), m_slToolTip);
- return true;
- }
- }
- catch(...)
- {
- }
- return false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::MnuSetStdAreaClick(TObject *Sender)
- {
- if (!xclntMap->Active) return;
- Application->ProcessMessages();
- if (Application->MessageBox(L"현재 영역을 표준영역으로 지정하시겠습니까?", L"확인",
- MB_YESNO|MB_ICONQUESTION) != IDYES)
- {
- return;
- }
- TIniFile *pIniFile = NULL;
- String sIniFile = ChangeFileExt(ExtractFileName(Application->ExeName), ".ini");
- String sCfgFile = ExtractFilePath(Application->ExeName) + "\\cfg\\" + sIniFile;
- try
- {
- try
- {
- pIniFile = new TIniFile(sCfgFile);
- TDDRect rc = xclntMap->GetViewExtent();
- pIniFile->WriteString("MAP", "LEFTTOPX", String(rc.MaxX));
- pIniFile->WriteString("MAP", "LEFTTOPY", String(rc.MaxY));
- pIniFile->WriteString("MAP", "RIGHTBOTTOMX", String(rc.MinX));
- pIniFile->WriteString("MAP", "RIGHTBOTTOMY", String(rc.MinY));
-
- g_GisInfo.dLeftTopX = rc.MaxX;
- g_GisInfo.dLeftTopY = rc.MaxY;
- g_GisInfo.dRightBottomX = rc.MinX;
- g_GisInfo.dRightBottomY = rc.MinY;
- }
- __finally
- {
- if (pIniFile) delete pIniFile;
- pIniFile = NULL;
- }
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::MnuMoveStdAreaClick(TObject *Sender)
- {
- Application->ProcessMessages();
- if (xclntMap->Active)
- {
- xclntMap->ExtentDraw(DDRect(g_GisInfo.dRightBottomX, g_GisInfo.dLeftTopX, g_GisInfo.dRightBottomY, g_GisInfo.dLeftTopY));
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::SetTrafficInfo(bool bFlag)
- {
- bool alivethread = false;
- if (!bFlag)
- {
- for (int ii = 0; ii < MAX_LAYERS; ii++)
- {
- if (m_pLinkSpeedUpdate[ii] == NULL) continue;
- m_pLinkSpeedUpdate[ii]->isRuning = false;
- }
- }
- else
- {
- for (int ii = 0; ii < MAX_LAYERS; ii++)
- {
- if (m_pLinkSpeedUpdate[ii] == NULL) continue;
- if (m_pLinkSpeedUpdate[ii]->isRuning == false)
- {
- m_pLinkSpeedUpdate[ii]->isRuning = true;
- alivethread = true;
- }
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::RefreshMapTraffic()
- {
- LblTraffic->Visible = true;
- TmrLblTraffic->Enabled = true;
- //if (ChkTrafficLayer->Checked)
- {
- /* 소통정보 표출설정한 경우에만 지도 화면 리플레쉬 */
- for (int ii = 0; ii < MAX_LAYERS; ii++)
- {
- if (m_pLinkSpeedUpdate[ii] == NULL) continue;
- m_pLinkSpeedUpdate[ii]->Reflash_Now();
- }
- }
- /* 결측 링크는 언제라 리플레쉬 */
- //UpdateMissLinkInfo(); /* JSH: 2012.07.18 */
- try
- {
- if (FrmLinkInfo)
- {
- FrmLinkInfo->RefreshLinkInfo();
- }
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ChkDrawIncidentClick(TObject *Sender)
- {
- UpdateIncidentStatus();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ChkDrawGisClick(TObject *Sender)
- {
- UpdateFacilityStatus();
- xclntMap->SetFocus();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ShowLinkDetailInfo(String sLinkId, int nLinkLevel)
- {
- try
- {
- if (FrmLinkInfo == NULL)
- {
- FrmLinkInfo = new TFrmLinkInfo(Application);
- }
- FrmLinkInfo->Show();
- FrmLinkInfo->ShowLinkInfo(sLinkId, nLinkLevel);
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ChkGisSearchClick(TObject *Sender)
- {
- try
- {
- if (ChkGisSearch->Checked)
- {
- if (FrmGisSearch == NULL)
- {
- FrmGisSearch = new TFrmGisSearch(this);
- //FrmGisSearch->Parent = this;
- }
- FrmGisSearch->Show();
- }
- else
- {
- if (FrmGisSearch)
- {
- if (FrmGisSearch->m_bClose == false)
- {
- FrmGisSearch->Close();
- }
- }
- }
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::MnuDrawAntiAliasClick(TObject *Sender)
- {
- Application->ProcessMessages();
- if (MnuDrawAntiAlias->Checked)
- {
- MnuDrawAntiAlias->Checked = false;
- }
- else
- {
- MnuDrawAntiAlias->Checked = true;
- }
- xsrvrMap->DrawAntiAlias = MnuDrawAntiAlias->Checked;
- xclntMap->FullReDraw();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::FormClose(TObject *Sender, TCloseAction &Action)
- {
- CommClose();
- //ITS00MAP = NULL;
- Action = caFree;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::panRemarkMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
- {
- TcxGroupBox *pGroup = (TcxGroupBox*)Sender;
- ReleaseCapture();
- pGroup->Perform(WM_SYSCOMMAND, 0xf012, 0);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ChkViewExamplePropertiesChange(TObject *Sender)
- {
- panRemark->Visible = ChkViewExample->Checked;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::xclntMapAccClick(TMouseButton Button, TShiftState Shift, int CNT, TArr_Accdt_Rec INFO)
- {
- if (CNT < 1) return;
- TAccdt_INFO info = INFO[0];
- }
- //---------------------------------------------------------------------------
- /*
- * 시설물의 상태에 따라 이미지를 전자지도에 표출한다.(XiClient->CCTVIconList)
- * arguments
- *
- * return
- * void
- */
- void __fastcall TITS00MAP::UpdateFacilityStatus()
- {
- static String sStatusMsg[3] = { "정상", "이상", "알수없음", };
- int nStatus = 0;
- TItsFacility *pFacility;
- xclntMap->ClearCCTVEvent(true);
- if (ChkDrawCtv->Checked)
- {
- try
- {
- ItsFacilityManager->FCctvLists.Lock();
- FOR_STL(TItsCctv *, pObj, ItsFacilityManager->FCctvLists)
- {
- if (pObj->DEL_YN == "Y") continue;
- //if (pObj->LOCAL_YN != "Y") continue; //지역CCTV정보만 위치에 표출
- nStatus = 2;
- pFacility = ItsFacilityManager->FLists.Find(pObj->CCTV_CTLR_ID);
- if (pFacility)
- {
- #if 0
- if (pFacility->FCommStatus == "CMS0") nStatus = 0;
- else
- if (pFacility->FCommStatus == "CMS1") nStatus = 1;
- #else
- if (pFacility->FComm == "0") nStatus = 1;//"통신이상";
- else
- if (pFacility->FComm == "1") nStatus = 0;//"정상";
- else
- if (pFacility->FComm == "2") nStatus = 0;//"함체문열림";
- else
- if (pFacility->FComm == "3") nStatus = 2;//"알수없음";
- #endif
- } else continue;
- try {
- String sTitle = "▶▶CCTV 정보◀◀|CCTV ID : " + pObj->CCTV_CTLR_ID + "|명칭 : " + pObj->ISTL_LCTN_NM + "|상태 : " + sStatusMsg[nStatus];
- xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->CCTV_CTLR_ID, "CCTV", sTitle, nStatus+0, 1, 7);
- } catch(...) { }
- }
- }
- __finally
- {
- ItsFacilityManager->FCctvLists.UnLock();
- }
- }
- if (ChkDrawVms->Checked)
- {
- try
- {
- ItsFacilityManager->FVmsLists.Lock();
- FOR_STL(TItsVms *, pObj, ItsFacilityManager->FVmsLists)
- {
- if (pObj->DEL_YN == "Y") continue;
- nStatus = 2;
- pFacility = ItsFacilityManager->FLists.Find(pObj->VMS_CTLR_ID);
- if (pFacility)
- {
- if (pFacility->FCommStatus == "CMS0") nStatus = 0;
- else
- if (pFacility->FCommStatus == "CMS1") nStatus = 1;
- } else continue;
- try {
- String sTitle = "▶▶VMS 정보◀◀|VMS ID : " + pObj->VMS_CTLR_ID + "|명칭 : " + pObj->VMS_NM + "|상태 : " + sStatusMsg[nStatus];
- xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->VMS_CTLR_ID, "VMS", sTitle, nStatus+3, 1, 7);
- } catch(...) { }
- }
- }
- __finally
- {
- ItsFacilityManager->FVmsLists.UnLock();
- }
- }
- if (ChkDrawRse->Checked)
- {
- try
- {
- ItsFacilityManager->FRseLists.Lock();
- FOR_STL(TItsRse *, pObj, ItsFacilityManager->FRseLists)
- {
- //if (pObj->DEL_YN == "Y") continue;
- nStatus = 2;
- pFacility = ItsFacilityManager->FLists.Find(pObj->RSEID);
- if (pFacility)
- {
- if (pFacility->FCommStatus == "CMS0") nStatus = 0;
- else
- if (pFacility->FCommStatus == "CMS1") nStatus = 1;
- } else continue;
- try {
- String sTitle = "▶▶RSE 정보◀◀|RSE ID : " + pObj->RSEID + "|명칭 : " + pObj->LOCATION + "|상태 : " + sStatusMsg[nStatus];
- xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->COORDX, 0), StrToFloatDef(pObj->COORDY, 0)), pObj->RSEID, "RSE", sTitle, nStatus+6, 1, 7);
- } catch(...) { }
- }
- }
- __finally
- {
- ItsFacilityManager->FRseLists.UnLock();
- }
- }
- if (ChkWebCam->Checked)
- {
- try
- {
- ItsFacilityManager->FWebCamLists.Lock();
- FOR_STL(TItsWebCam *, pObj, ItsFacilityManager->FWebCamLists)
- {
- //if (pObj->DEL_YN == "Y") continue;
- nStatus = 2;
- pFacility = ItsFacilityManager->FLists.Find(pObj->WEB_CMRA_ID);
- if (pFacility)
- {
- if (pFacility->FCommStatus == "CMS0") nStatus = 0;
- else
- if (pFacility->FCommStatus == "CMS1") nStatus = 1;
- } else continue;
- try {
- String sTitle = "▶▶웹카메라 정보◀◀|RSE ID : " + pObj->WEB_CMRA_ID + "|위치 : " + pObj->ISTL_LCTN_NM + "|상태 : " + sStatusMsg[nStatus];
- xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->WEB_CMRA_ID, "WCAM", sTitle, nStatus+22, 1, 7);
- } catch(...) { }
- }
- }
- __finally
- {
- ItsFacilityManager->FWebCamLists.UnLock();
- }
- }
- if (ChkDrawVds->Checked)
- {
- try
- {
- ItsFacilityManager->FVdsLists.Lock();
- FOR_STL(TItsVds *, pObj, ItsFacilityManager->FVdsLists)
- {
- if (pObj->DEL_YN == "Y") continue;
- nStatus = 2;
- pFacility = ItsFacilityManager->FLists.Find(pObj->CTLR_MNGM_NMBR);
- if (pFacility)
- {
- if (pFacility->FCommStatus == "CMS0") nStatus = 0;
- else
- if (pFacility->FCommStatus == "CMS1") nStatus = 1;
- } else continue;
- try {
- String sTitle = "▶▶VDS-제어기 정보◀◀|VDS ID : " + pObj->VDS_CTLR_ID + "|명칭 : " + pObj->LCTN + "|상태 : " + sStatusMsg[nStatus];
- xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->VDS_CTLR_ID, "VDS", sTitle, nStatus+9, 1, 7);
- } catch(...) { }
- }
- }
- __finally
- {
- ItsFacilityManager->FVdsLists.UnLock();
- }
- }
- if (ChkDrawAvi->Checked)
- {
- try
- {
- ItsFacilityManager->FAviLists.Lock();
- FOR_STL(TItsAvi *, pObj, ItsFacilityManager->FAviLists)
- {
- if (pObj->DEL_YN == "Y") continue;
- nStatus = 2;
- pFacility = ItsFacilityManager->FLists.Find(pObj->AVI_ID);
- if (pFacility)
- {
- if (pFacility->FCommStatus == "CMS0") nStatus = 0;
- else
- if (pFacility->FCommStatus == "CMS1") nStatus = 1;
- } else continue;
- try {
- String sTitle = "▶▶AVI-제어기 정보◀◀|AVI ID : " + pObj->AVI_ID + "|명칭 : " + pObj->AVI_LCTN_NM + "|상태 : " + sStatusMsg[nStatus];
- xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->AVI_ID, "AVI", sTitle, nStatus+12, 1, 7);
- } catch(...) { }
- }
- }
- __finally
- {
- ItsFacilityManager->FAviLists.UnLock();
- }
- }
- if (ChkDrawDsrc->Checked)
- {
- try
- {
- ItsFacilityManager->FDsrcLists.Lock();
- FOR_STL(TItsDsrc *, pObj, ItsFacilityManager->FDsrcLists)
- {
- if (pObj->DEL_YN == "Y") continue;
- nStatus = 2;
- pFacility = ItsFacilityManager->FLists.Find(pObj->ID);
- if (pFacility)
- {
- if (pFacility->FCommStatus == "CMS0") nStatus = 0;
- else
- if (pFacility->FCommStatus == "CMS1") nStatus = 1;
- } else continue;
- try {
- String sTitle = "▶▶DSRC 정보◀◀|DSRC ID : " + pObj->RSE_ID + "|명칭 : " + pObj->ISTL_LCTN_NM + "|상태 : " + sStatusMsg[nStatus];
- xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->LCTN_X, 0), StrToFloatDef(pObj->LCTN_Y, 0)), pObj->RSE_ID, "DSRC", sTitle, nStatus+15, 1, 7);
- } catch(...) { }
- }
- }
- __finally
- {
- ItsFacilityManager->FDsrcLists.UnLock();
- }
- }
- xclntMap->ReDraw();
- }
- //---------------------------------------------------------------------------
- /*
- * 돌발 상태에 따라 이미지를 전자지도에 표출한다.(XiClient->ADDAccEvent)
- * arguments
- *
- * return
- * void
- */
- void __fastcall TITS00MAP::UpdateIncidentStatus()
- {
- static String sStatusMsg[5] = { "사고", "공사", "행사", "기상", "기타", };
- int nStatus = 0;
- xclntMap->ClearAccEvent(true);
- if (ChkDrawIncident->Checked)
- {
- try
- {
- ItsIncidentManager->FLists.Lock();
- FOR_STL(TItsIncident *, pObj, ItsIncidentManager->FLists)
- {
- if (pObj->DISP_INCD == "N") continue;
- if (pObj->INCD_PRGR_STEP_CD == "ISS2")
- {
- nStatus = 4;
- if (pObj->INCD_TYPE_CLSF_CD == "1") nStatus = 0;
- else
- if (pObj->INCD_TYPE_CLSF_CD == "2") nStatus = 1;
- else
- if (pObj->INCD_TYPE_CLSF_CD == "3") nStatus = 2;
- else
- if (pObj->INCD_TYPE_CLSF_CD == "4") nStatus = 3;
- String sTitle = "▶▶돌발 정보◀◀|돌발 ID : " + pObj->INCD_OCRR_ID + "|제목 : " + pObj->INCD_TITL + "|유형 : " + sStatusMsg[nStatus];
- sTitle += "|돌발등록시각: " + ITSUtil_StrToTime(pObj->RGST_DT) + "|돌발시작시각: " + ITSUtil_StrToTime(pObj->FINCD_STRT_DT);
- //돌발유형이 사고,기상인 경우는 돌발종료시각을 표출하지 않도록 함. 돌발유형이 공사,행사인 경우만 돌발종료시각 표출함
- if (nStatus == 1 || nStatus == 2)
- {
- sTitle += "|돌발종료시각: " + ITSUtil_StrToTime(pObj->INCD_END_PRAR_DT);
- }
- xclntMap->ADDAccEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->INCD_OCRR_ID, sTitle, sTitle, "", nStatus+18, false, 1, 7);
- }
- }
- }
- __finally
- {
- ItsIncidentManager->FLists.UnLock();
- }
- }
- xclntMap->ReDraw();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::xclntMapCCTVClick(TMouseButton Button, TShiftState Shift, int CNT, TArr_CCTV_Rec INFO)
- {
- FSelId = "";
- if (Button == mbRight)
- {
- if (CNT < 1) return;
- TCCTV_REC info = INFO[0];
- FSelId = info.fID;
- POINT p;
- GetCursorPos(&p);
- if (info.fAttr == "CCTV")
- {
- pmuCctv->Popup(p.x, p.y);
- }
- else
- if (info.fAttr == "VMS")
- {
- pmuVms->Popup(p.x, p.y);
- }
- else
- if (info.fAttr == "RSE")
- {
- pmuRse->Popup(p.x, p.y);
- }
- else
- if (info.fAttr == "WCAM")
- {
- pmuWebCam->Popup(p.x, p.y);
- }
- else
- if (info.fAttr == "VDS")
- {
- pmuVds->Popup(p.x, p.y);
- }
- else
- if (info.fAttr == "AVI")
- {
- pmuAvi->Popup(p.x, p.y);
- }
- else
- if (info.fAttr == "DSRC")
- {
- pmuDsrc->Popup(p.x, p.y);
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::pmuFacilityPopup(TObject *Sender)
- {
- TPopupMenu *pMenu = (TPopupMenu*)Sender;
- if (pMenu->Tag == 0)
- {
- MnuCctvId->Caption = "[CCTV] " + FSelId;
- }
- else
- if (pMenu->Tag == 1)
- {
- MnuVmsId->Caption = "[VMS] " + FSelId;
- }
- else
- if (pMenu->Tag == 2)
- {
- MnuRseId->Caption = "[RSE] " + FSelId;
- }
- else
- if (pMenu->Tag == 3)
- {
- MnuWebCamId->Caption = "[웹카메라] " + FSelId;
- }
- else
- if (pMenu->Tag == 4)
- {
- MnuVdsId->Caption = "[VDS] " + FSelId;
- }
- else
- if (pMenu->Tag == 5)
- {
- MnuAviId->Caption = "[AVI] " + FSelId;
- }
- else
- if (pMenu->Tag == 6)
- {
- MnuDsrcId->Caption = "[DSRC] " + FSelId;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::mnuFacilityPingClick(TObject *Sender)
- {
- TMenuItem *pMenu = (TMenuItem*)Sender;
- String sIp;
- Application->ProcessMessages();
- if (pMenu->Tag >= 11 && 15 >= pMenu->Tag)
- {
- TItsCctv *pObj = ItsFacilityManager->FCctvLists.Find(FSelId);
- if (pObj)
- {
- switch(pMenu->Tag)
- {
- case 12: sIp = pObj->CCTV_CAPT_IP.Trim(); break;
- case 13: sIp = pObj->CCTV_ENCD_IP.Trim(); break;
- case 14: sIp = pObj->STRM_SVR_IP.Trim(); break;
- case 15: sIp = pObj->CCTV_FIBR_IP.Trim(); break;
- case 11:
- default: sIp = pObj->CCTV_CTLR_IP.Trim(); break;
- }
- }
- }
- else
- if (pMenu->Tag >= 21 && 22 >= pMenu->Tag)
- {
- TItsVms *pObj = ItsFacilityManager->FVmsLists.Find(FSelId);
- if (pObj)
- {
- switch(pMenu->Tag)
- {
- case 22: sIp = pObj->WEB_CMRA_IP.Trim(); break;
- case 21:
- default: sIp = pObj->VMS_CTLR_IP.Trim(); break;
- }
- }
- }
- else
- if (pMenu->Tag == 2)
- {
- TItsRse *pObj = ItsFacilityManager->FRseLists.Find(FSelId);
- if (pObj) sIp = pObj->RSEIP.Trim();
- }
- else
- if (pMenu->Tag == 4)
- {
- #if 1
- TItsVds *pObj = ItsFacilityManager->FVdsLists.Find(FSelId);
- if (pObj) sIp = pObj->TRMN_IP.Trim();
- #else
- TItsVds *pObj = NULL;//ItsFacilityManager->FVdsLists.Find(AId);
- FOR_STL(TItsVds*, pTmp, ItsFacilityManager->FVdsLists)
- {
- if (FSelId == pTmp->VDS_CTLR_ID)
- {
- pObj = pTmp;
- break;
- }
- }
- if (pObj) sIp = pObj->TRMN_IP.Trim();
- #endif
- }
- else
- if (pMenu->Tag == 5)
- {
- #if 1
- TItsAvi *pObj = ItsFacilityManager->FAviLists.Find(FSelId);
- if (pObj) sIp = pObj->AVI_CTLR_IP.Trim();
- #else
- TItsAvi *pObj = NULL;//ItsFacilityManager->FAviLists.Find(AId);
- FOR_STL(TItsAvi*, pTmp, ItsFacilityManager->FAviLists)
- {
- if (FSelId == pTmp->AVI_ID)
- {
- pObj = pTmp;
- break;
- }
- }
- if (pObj) sIp = pObj->AVI_CTLR_IP.Trim();
- #endif
- }
- else
- if (pMenu->Tag == 6)
- {
- #if 1
- TItsDsrc *pObj = ItsFacilityManager->FDsrcLists.Find(FSelId);
- if (pObj) sIp = pObj->IP.Trim();
- #else
- TItsDsrc *pObj = NULL;//ItsFacilityManager->FDsrcLists.Find(FSelId);
- FOR_STL(TItsDsrc*, pTmp, ItsFacilityManager->FDsrcLists)
- {
- if (FSelId == pTmp->RSE_ID)
- {
- pObj = pTmp;
- break;
- }
- }
- if (pObj) sIp = pObj->IP.Trim();
- #endif
- }
- else
- if (pMenu->Tag == 99)
- {
- TItsWebCam *pObj = ItsFacilityManager->FWebCamLists.Find(FSelId);
- if (pObj) sIp = pObj->CMRA_IP.Trim();
- }
- if (sIp.IsEmpty())
- {
- Application->MessageBox(L"IP Address 정보가 없습니다.\r\nIP Address 정보를 확인하세요.",
- L"네크워크 연결확인", MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- ITSUtil_NetworkPing(sIp);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::mnuStopImageClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TPoint pt;
- GetCursorPos(&pt);
- pt = ITS0000M->ScreenToClient(pt);
- ShowCctvStopImage(FSelId, pt);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::mnuCctvCamClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TPoint pt;
- GetCursorPos(&pt);
- pt = ITS0000M->ScreenToClient(pt);
- ShowCctvCamera(FSelId, pt);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::mnuVmsMsgClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TPoint pt;
- GetCursorPos(&pt);
- pt = ITS0000M->ScreenToClient(pt);
- ShowVmsMessage(FSelId, pt);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::mnuVmsCamClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TPoint pt;
- GetCursorPos(&pt);
- pt = ITS0000M->ScreenToClient(pt);
- ShowVmsCamera(FSelId, pt);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ShowCctvStopImage(String AId, TPoint pt)
- {
- TItsCctv *pObj = ItsFacilityManager->FCctvLists.Find(AId);
- if (!pObj) return;
- try {
- if (pObj->FData1)
- {
- TFrmCctvImg *pForm = (TFrmCctvImg *)pObj->FData1;
- pForm->SetFocus();
- pForm->LoadStopImage();
- }
- else
- {
- TFrmCctvImg *pForm = new TFrmCctvImg(ITS0000M);
- pForm->Parent = ITS0000M;
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- pForm->FObj = pObj;
- pObj->FData1 = (void*)pForm;
- pForm->Show();
- }
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ShowCctvCamera(String AId, TPoint pt)
- {
- TItsCctv *pObj = ItsFacilityManager->FCctvLists.Find(AId);
- if (!pObj) return;
- try {
- if (pObj->FData2)
- {
- TFrmCctvCam *pForm = (TFrmCctvCam *)pObj->FData2;
- pForm->SetFocus();
- //pForm->RefreshCctv();
- }
- else
- {
- TFrmCctvCam *pForm = new TFrmCctvCam(ITS0000M);
- pForm->Parent = ITS0000M;
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- pForm->FObj = pObj;
- pObj->FData2 = (void*)pForm;
- pForm->Show();
- }
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ShowVmsMessage(String AId, TPoint pt)
- {
- TItsVms *pObj = ItsFacilityManager->FVmsLists.Find(FSelId);
- if (!pObj) return;
- try {
- if (pObj->FData1)
- {
- TFrmVmsMsg *pForm = (TFrmVmsMsg *)pObj->FData1;
- pForm->SetFocus();
- }
- else
- {
- TFrmVmsMsg *pForm = new TFrmVmsMsg(ITS0000M, pObj);
- pForm->Parent = ITS0000M;
- int nHG = pForm->ClientHeight - pForm->PnlVmsMsgDisp->Height;
- int nWG = pForm->ClientWidth - pForm->PnlVmsMsgDisp->Width;
- #if 0
- pForm->ClientHeight = nHG + pObj->Height;
- pForm->ClientWidth = nWG + pObj->Width;
- #endif
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- pObj->FData1 = (void*)pForm;
- pForm->Show();
- }
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ShowVmsCamera(String AId, TPoint pt)
- {
- TItsVms *pObj = ItsFacilityManager->FVmsLists.Find(FSelId);
- if (!pObj) return;
- try {
- if (pObj->FData2)
- {
- TFrmVmsCam *pForm = (TFrmVmsCam *)pObj->FData2;
- pForm->SetFocus();
- //pForm->RefreshVms();
- }
- else
- {
- TFrmVmsCam *pForm = new TFrmVmsCam(ITS0000M);;
- pForm->Parent = ITS0000M;
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- pForm->FObj = pObj;
- pObj->FData2 = (void*)pForm;
- pForm->Show();
- }
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::RefreshGisLink()
- {
- SelectLinkById(g_SelLink.Level, g_SelLink.Id, true);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::MnuWebCamClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TPoint pt;
- GetCursorPos(&pt);
- pt = ITS0000M->ScreenToClient(pt);
- ShowWebCamera(FSelId, pt);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::ShowWebCamera(String AId, TPoint pt)
- {
- TItsWebCam *pObj = ItsFacilityManager->FWebCamLists.Find(FSelId);
- if (!pObj) return;
- try {
- if (pObj->FData2)
- {
- TFrmWebCam *pForm = (TFrmWebCam *)pObj->FData2;
- #if 0
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- #endif
- pForm->SetFocus();
- }
- else
- {
- TFrmWebCam *pForm = new TFrmWebCam(ITS0000M, pObj);
- pForm->Parent = ITS0000M;
- if ((pt.x + pForm->Width + 5) > this->Width)
- {
- pt.x = this->Width - pForm->Width - 5;
- }
- if ((pt.y + pForm->Height + 5) > this->Height)
- {
- pt.y = this->Height - pForm->Height - 5;
- }
- pForm->Left = Left + pt.x;
- pForm->Top = Top + pt.y;
- pObj->FData2 = (void*)pForm;
- pForm->Show();
- }
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::TmrLblTrafficTimer(TObject *Sender)
- {
- TmrLblTraffic->Enabled = false;
- LblTraffic->Visible = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::UpdateGisRoadRank()
- {
- return;
- int nLyrIdx;
- nLyrIdx = xsrvrMap->GetLayerIndex(LEVEL1_LINK_LAYER_NAME);
- if (nLyrIdx >= 0)
- {
- UpdateGisRoadRank(1, nLyrIdx);
- }
- nLyrIdx = xsrvrMap->GetLayerIndex(LEVEL2_LINK_LAYER_NAME);
- if (nLyrIdx >= 0)
- {
- UpdateGisRoadRank(2, nLyrIdx);
- }
- nLyrIdx = xsrvrMap->GetLayerIndex(LEVEL3_LINK_LAYER_NAME);
- if (nLyrIdx >= 0)
- {
- UpdateGisRoadRank(3, nLyrIdx);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS00MAP::UpdateGisRoadRank(int ALinkLevel, int ALyrIdx)
- {
- System::AnsiString sRoadRankNm = "SD_ROAD_RANK";
- System::AnsiString sLinkIdNm = "SD_LINK_ID";
- int ii, jj, idx;
- int nFldCnt, nTotCnt;
- unsigned char sl;
- TFieldInfos FldInfos;
- char buf[512];
- String sGisLinkId = "";
- String sGisRoadRank = "";
- String sDbRoadRank = "";
- String sUtisRoadRank = "";
- try
- {
- try
- {
- FGisStream = new TMemoryStream();
- FGisStream->LoadFromStream(xsrvrMap->GetLayerAttSTM(ALyrIdx));
- FGisStream->Position = 0;
- FGisStream->ReadBuffer(&nTotCnt, 4);
- FGisStream->ReadBuffer(&nFldCnt,4);
- FldInfos.Length = nFldCnt;
- FGisStream->Position = 8;
- for (ii = 0; ii < nFldCnt; ii++)
- {
- FGisStream->ReadBuffer(&sl, 1);
- memset(buf, 0x00, sizeof(buf));
- FGisStream->ReadBuffer(buf, sl);
- FldInfos[ii].FFieldName = System::AnsiString(buf);
- FGisStream->ReadBuffer(&(FldInfos[ii].FFieldType), sizeof(FldInfos[ii].FFieldType));
- }
- for (ii = 0; ii < nTotCnt; ii++)
- {
- if (FGisStream->Position >= FGisStream->Size) break;
- for (jj = 0; jj < nFldCnt; jj++)
- {
- switch (FldInfos[jj].FFieldType)
- {
- case ftSmallint : FGisStream->Position += sizeof(short); break;
- case ftFloat : FGisStream->Position += sizeof(double); break;
- case ftWord : FGisStream->Position += sizeof(unsigned short); break;
- case ftBoolean : FGisStream->Position += sizeof(bool); break;
- case ftDate :
- case ftTime :
- case ftDateTime : FGisStream->Position += sizeof(TDateTime); break;
- case ftInteger : FGisStream->Position += sizeof(int); break;
- case ftString :
- case ftWideString :
- FGisStream->ReadBuffer(&sl, 1);
- if (sl <= 1)
- {
- if (sl == 1)
- FGisStream->Position += sl;
- else
- continue;
- }
- else
- {
- memset(buf, 0x00, sizeof(buf));
- FGisStream->ReadBuffer(buf, sl);
- if (FldInfos[jj].FFieldName == sLinkIdNm)
- {
- sGisLinkId = String(buf);
- }
- else
- if (FldInfos[jj].FFieldName == sRoadRankNm)
- {
- if (sl == 4)
- {
- sDbRoadRank = "";
- switch(ALinkLevel)
- {
- case 1: //레벨1 링크(표준링크)
- {
- TItsLink *pLink = ItsLinkManager->FLists.Find(sGisLinkId);
- if (pLink) sDbRoadRank = pLink->SECT_GRAD_CD;
- }
- break;
- case 2: //레벨2 링크(서비스링크)
- {
- TItsServiceLink *pLink = ItsServiceLinkManager->FLists.Find(sGisLinkId);
- if (pLink) sDbRoadRank = pLink->SECT_GRAD_CD;
- }
- break;
- case 3: //도로
- {
- TItsRoad *pLink = ItsRoadManager->FLists.Find(sGisLinkId);
- if (pLink) sDbRoadRank = pLink->SECT_GRAD_CD;
- }
- break;
- }
- if (sDbRoadRank != "")
- {
- sUtisRoadRank = "10" + sDbRoadRank.SubString(4,1);
- sGisRoadRank = String(buf);
- if (sUtisRoadRank != sGisRoadRank)
- {
- FGisStream->Position -= sl;
- FGisStream->WriteBuffer(AnsiString(sUtisRoadRank).c_str(), sl);
- }
- }
- #if 0
- if (sDbRoadRank == "SRT1") sUtisRoadRank = "101";
- else
- if (sDbRoadRank == "SRT2") sUtisRoadRank = "102";
- else
- if (sDbRoadRank == "SRT3") sUtisRoadRank = "103";
- else
- if (sDbRoadRank == "SRT4") sUtisRoadRank = "104";
- else
- if (sDbRoadRank == "SRT5") sUtisRoadRank = "105";
- else
- if (sDbRoadRank == "SRT6") sUtisRoadRank = "106";
- else
- if (sDbRoadRank == "SRT7") sUtisRoadRank = "107";
- #endif
- }
- }
- }
- break;
- default:
- break;
- }
- }
- }
- xsrvrMap->SetLayerAttSTM(ALyrIdx, FGisStream);
- }
- catch(Exception &e)
- {
- }
- }
- __finally
- {
- if (FGisStream) delete FGisStream;
- }
- }
- //---------------------------------------------------------------------------
|