GeoGlobeJS.min.js 643 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967
  1. (function() {
  2. window.GeoGlobe = window.GeoGlobe || {};
  3. GeoGlobe.LngLatBounds = {};
  4. GeoGlobe.LngLat = {};
  5. GeoGlobe.Point = mapboxgl.Point;
  6. GeoGlobe.BoxHandler = mapboxgl.BoxHandler;
  7. GeoGlobe.Class = {};
  8. GeoGlobe.Layer = {};
  9. GeoGlobe.Source = {};
  10. GeoGlobe.Event = {};
  11. GeoGlobe.Control = {};
  12. GeoGlobe.Marker = {};
  13. GeoGlobe.Popup = {};
  14. GeoGlobe.Filter = {};
  15. GeoGlobe.Format = {};
  16. GeoGlobe.Analysis = {};
  17. GeoGlobe.Protocol = {};
  18. GeoGlobe.Query = {};
  19. GeoGlobe.Statistic = {};
  20. GeoGlobe.LayerGroup = {};
  21. GeoGlobe.Protocol = {};
  22. GeoGlobe.Service = {};
  23. GeoGlobe.DynamicFeature = {};
  24. GeoGlobe.DynamicTrace = {};
  25. GeoGlobe.DSS = {};
  26. GeoGlobe.Widget = {};
  27. GeoGlobe.imagesPath = "";
  28. GeoGlobe.VERSION_NUMBER = "GeoGlobeJSAPI 2020 -- $Version: 1.3.2 build-20020312 $"
  29. })();
  30. GeoGlobe.Class = function() {
  31. var a = arguments.length,
  32. b = arguments[0],
  33. c = arguments[a - 1],
  34. d = typeof c.initialize == "function" ? c.initialize : function() {
  35. b.prototype.initialize.apply(this, arguments)
  36. };
  37. a > 1 ? [d, b].concat(Array.prototype.slice.call(arguments).slice(1, a - 1), c) : d.prototype = c;
  38. return d
  39. };
  40. GeoGlobe.Class4OL = function() {
  41. var a = arguments.length,
  42. b = arguments[0],
  43. c = arguments[a - 1],
  44. d = typeof c.initialize == "function" ? c.initialize : function() {
  45. b.prototype.initialize.apply(this, arguments)
  46. };
  47. a > 1 ? (a = [d, b].concat(Array.prototype.slice.call(arguments).slice(1, a - 1), c), GeoGlobe.inherit.apply(null, a)) : d.prototype = c;
  48. return d
  49. };
  50. GeoGlobe.inherit = function(a, b) {
  51. var c = function() {};
  52. c.prototype = b.prototype;
  53. a.prototype = new c;
  54. var d, e, c = 2;
  55. for (d = arguments.length; c < d; c++) {
  56. e = arguments[c];
  57. if (typeof e === "function") e = e.prototype;
  58. GeoGlobe.Util.extend(a.prototype, e)
  59. }
  60. };
  61. GeoGlobe.Util = GeoGlobe.Util || {};
  62. GeoGlobe.Util.extend = function(a, b) {
  63. a = a || {};
  64. if (b) {
  65. for (var c in b) {
  66. var d = b[c];
  67. d !== void 0 && (a[c] = d)
  68. }
  69. if (!(typeof window.Event == "function" && b instanceof window.Event) && b.hasOwnProperty && b.hasOwnProperty("toString")) a.toString = b.toString
  70. }
  71. return a
  72. };
  73. GeoGlobe.Util.deepExtend = function(a) {
  74. for (var b = 1; b < arguments.length; b++)
  75. for (var c in arguments[b])
  76. if (arguments[b].hasOwnProperty(c)) switch (GeoGlobe.Util.getType(arguments[b][c])) {
  77. case "array":
  78. a.hasOwnProperty(c) && GeoGlobe.Util.getType(a[c]) === "array" ? GeoGlobe.Util.deepExtend(a[c], arguments[b][c]) : a[c] = GeoGlobe.Util.deepExtend([], arguments[b][c]);
  79. break;
  80. case "object":
  81. a.hasOwnProperty(c) && GeoGlobe.Util.getType(a[c]) === "object" ? GeoGlobe.Util.deepExtend(a[c], arguments[b][c]) : a[c] = GeoGlobe.Util.deepExtend({},
  82. arguments[b][c]);
  83. break;
  84. default:
  85. a[c] = arguments[b][c]
  86. }
  87. return a
  88. };
  89. GeoGlobe.Serializable = GeoGlobe.Class({
  90. initialize: function() {},
  91. serialize: function() {
  92. throw "please extend this method";
  93. },
  94. CLASS_NAME: "GeoGlobe.Serializable"
  95. });
  96. (function() {
  97. function a(a) {
  98. for (var b = 0; b < a.length; b++)
  99. if (a[b] in c) return a[b];
  100. return a[0]
  101. }
  102. function b(a) {
  103. a.preventDefault();
  104. a.stopPropagation();
  105. window.removeEventListener("click", b, !0)
  106. }
  107. GeoGlobe.DOM = GeoGlobe.DOM || {};
  108. GeoGlobe.DOM.create = function(a, b, c) {
  109. a = window.document.createElement(a);
  110. if (b) a.className = b;
  111. c && c.appendChild(a);
  112. return a
  113. };
  114. var c = window.document.documentElement.style,
  115. d = a(["userSelect", "MozUserSelect", "WebkitUserSelect", "msUserSelect"]),
  116. e;
  117. GeoGlobe.DOM.disableDrag = function() {
  118. d && (e = c[d], c[d] =
  119. "none")
  120. };
  121. GeoGlobe.DOM.enableDrag = function() {
  122. d && (c[d] = e)
  123. };
  124. var f = a(["transform", "WebkitTransform"]);
  125. GeoGlobe.DOM.setTransform = function(a, b) {
  126. a.style[f] = b
  127. };
  128. GeoGlobe.DOM.suppressClick = function() {
  129. window.addEventListener("click", b, !0);
  130. window.setTimeout(function() {
  131. window.removeEventListener("click", b, !0)
  132. }, 0)
  133. };
  134. GeoGlobe.DOM.mousePos = function(a, b) {
  135. var c = a.getBoundingClientRect(),
  136. b = b.touches ? b.touches[0] : b;
  137. return new mapboxgl.Point(b.clientX - c.left - a.clientLeft, b.clientY - c.top - a.clientTop)
  138. };
  139. GeoGlobe.DOM.touchPos =
  140. function(a, b) {
  141. for (var c = a.getBoundingClientRect(), d = [], e = b.type === "touchend" ? b.changedTouches : b.touches, f = 0; f < e.length; f++) d.push(new mapboxgl.Point(e[f].clientX - c.left - a.clientLeft, e[f].clientY - c.top - a.clientTop));
  142. return d
  143. };
  144. GeoGlobe.DOM.remove = function(a) {
  145. a.parentNode && a.parentNode.removeChild(a)
  146. }
  147. })();
  148. GeoGlobe.Util = GeoGlobe.Util || {};
  149. GeoGlobe.Util.getElement = function() {
  150. for (var a = [], b = 0, c = arguments.length; b < c; b++) {
  151. var d = arguments[b];
  152. typeof d == "string" && (d = document.getElementById(d));
  153. if (arguments.length == 1) return d;
  154. a.push(d)
  155. }
  156. return a
  157. };
  158. GeoGlobe.Util.isElement = function(a) {
  159. return !!(a && a.nodeType === 1)
  160. };
  161. GeoGlobe.Util.isArray = function(a) {
  162. return Object.prototype.toString.call(a) === "[object Array]"
  163. };
  164. GeoGlobe.Util.removeItem = function(a, b) {
  165. for (var c = a.length - 1; c >= 0; c--) a[c] == b && a.splice(c, 1);
  166. return a
  167. };
  168. GeoGlobe.Util.indexOf = function(a, b) {
  169. if (typeof a.indexOf == "function") return a.indexOf(b);
  170. else {
  171. for (var c = 0, d = a.length; c < d; c++)
  172. if (a[c] == b) return c;
  173. return -1
  174. }
  175. };
  176. GeoGlobe.Util.dotless = /\./g;
  177. GeoGlobe.IMAGE_RELOAD_ATTEMPTS = 0;
  178. GeoGlobe.Util.alphaHackNeeded = null;
  179. GeoGlobe.Util.alphaHack = function() {
  180. if (GeoGlobe.Util.alphaHackNeeded == null) {
  181. var a = navigator.appVersion.split("MSIE"),
  182. a = parseFloat(a[1]),
  183. b = !1;
  184. try {
  185. b = !!document.body.filters
  186. } catch (c) {}
  187. GeoGlobe.Util.alphaHackNeeded = b && a >= 5.5 && a < 7
  188. }
  189. return GeoGlobe.Util.alphaHackNeeded
  190. };
  191. GeoGlobe.Util.upperCaseObject = function(a) {
  192. var b = {},
  193. c;
  194. for (c in a) b[c.toUpperCase()] = a[c];
  195. return b
  196. };
  197. GeoGlobe.Util.applyDefaults = function(a, b) {
  198. var a = a || {},
  199. c = typeof window.Event == "function" && b instanceof window.Event,
  200. d;
  201. for (d in b)
  202. if (a[d] === void 0 || !c && b.hasOwnProperty && b.hasOwnProperty(d) && !a.hasOwnProperty(d)) a[d] = b[d];
  203. if (!c && b && b.hasOwnProperty && b.hasOwnProperty("toString") && !a.hasOwnProperty("toString")) a.toString = b.toString;
  204. return a
  205. };
  206. GeoGlobe.Util.getParameterString = function(a, b) {
  207. var b = b !== void 0 ? !!b : !1,
  208. c = [],
  209. d;
  210. for (d in a) {
  211. var e = a[d];
  212. if (e != null && typeof e != "function") {
  213. if (typeof e == "object" && e.constructor == Array) {
  214. for (var f = [], g, h = 0, j = e.length; h < j; h++) g = e[h], f.push(encodeURIComponent(g === null || g === void 0 ? "" : g));
  215. e = f.join(",")
  216. } else e = encodeURIComponent(e);
  217. b ? c.push(encodeURIComponent(d) + "=" + e) : c.push(d.toUpperCase() + "=" + decodeURIComponent(e))
  218. }
  219. }
  220. return c.join("&")
  221. };
  222. GeoGlobe.Util.urlAppend = function(a, b) {
  223. var c = a;
  224. if (b) {
  225. var d = (a + " ").split(/[?&]/);
  226. c += d.pop() === " " ? b : d.length ? "&" + b : "?" + b
  227. }
  228. return c
  229. };
  230. GeoGlobe.Util.getImagesLocation = function() {
  231. return GeoGlobe.ImgPath || GeoGlobe._getScriptLocation() + "img/"
  232. };
  233. GeoGlobe.Util.getImageLocation = function(a) {
  234. return GeoGlobe.Util.getImagesLocation() + a
  235. };
  236. GeoGlobe.Util.Try = function() {
  237. for (var a = null, b = 0, c = arguments.length; b < c; b++) {
  238. var d = arguments[b];
  239. try {
  240. a = d();
  241. break
  242. } catch (e) {}
  243. }
  244. return a
  245. };
  246. GeoGlobe.Util.getXmlNodeValue = function(a) {
  247. var b = null;
  248. GeoGlobe.Util.Try(function() {
  249. b = a.text;
  250. if (!b) b = a.textContent;
  251. if (!b) b = a.firstChild.nodeValue
  252. }, function() {
  253. b = a.textContent
  254. });
  255. return b
  256. };
  257. GeoGlobe.Util.mouseLeft = function(a, b) {
  258. for (var c = a.relatedTarget ? a.relatedTarget : a.toElement; c != b && c != null;) c = c.parentNode;
  259. return c != b
  260. };
  261. GeoGlobe.Util.DEFAULT_PRECISION = 14;
  262. GeoGlobe.Util.toFloat = function(a, b) {
  263. if (b == null) b = GeoGlobe.Util.DEFAULT_PRECISION;
  264. typeof a !== "number" && (a = parseFloat(a));
  265. return b === 0 ? a : parseFloat(a.toPrecision(b))
  266. };
  267. GeoGlobe.Util.rad = function(a) {
  268. return a * Math.PI / 180
  269. };
  270. GeoGlobe.Util.deg = function(a) {
  271. return a * 180 / Math.PI
  272. };
  273. GeoGlobe.Util.VincentyConstants = {
  274. a: 6378137,
  275. b: 6356752.3142,
  276. f: 1 / 298.257223563
  277. };
  278. GeoGlobe.Util.distVincenty = function(a, b) {
  279. for (var c = GeoGlobe.Util.VincentyConstants, d = c.a, e = c.b, c = c.f, f = GeoGlobe.Util.rad(b.lng - a.lng), g = Math.atan((1 - c) * Math.tan(GeoGlobe.Util.rad(a.lat))), h = Math.atan((1 - c) * Math.tan(GeoGlobe.Util.rad(b.lat))), j = Math.sin(g), g = Math.cos(g), l = Math.sin(h), h = Math.cos(h), m = f, n = 2 * Math.PI, p = 20; Math.abs(m - n) > 1.0E-12 && --p > 0;) {
  280. var q = Math.sin(m),
  281. o = Math.cos(m),
  282. s = Math.sqrt(h * q * h * q + (g * l - j * h * o) * (g * l - j * h * o));
  283. if (s == 0) return 0;
  284. var o = j * l + g * h * o,
  285. r = Math.atan2(s, o),
  286. t = Math.asin(g * h * q / s),
  287. u =
  288. Math.cos(t) * Math.cos(t),
  289. q = o - 2 * j * l / u,
  290. v = c / 16 * u * (4 + c * (4 - 3 * u)),
  291. n = m,
  292. m = f + (1 - v) * c * Math.sin(t) * (r + v * s * (q + v * o * (-1 + 2 * q * q)))
  293. }
  294. if (p == 0) return NaN;
  295. d = u * (d * d - e * e) / (e * e);
  296. c = d / 1024 * (256 + d * (-128 + d * (74 - 47 * d)));
  297. return (e * (1 + d / 16384 * (4096 + d * (-768 + d * (320 - 175 * d)))) * (r - c * s * (q + c / 4 * (o * (-1 + 2 * q * q) - c / 6 * q * (-3 + 4 * s * s) * (-3 + 4 * q * q))))).toFixed(3) / 1E3
  298. };
  299. GeoGlobe.Util.destinationVincenty = function(a, b, c) {
  300. for (var d = GeoGlobe.Util, e = d.VincentyConstants, f = e.a, g = e.b, e = e.f, h = a.lng, j = a.lat, a = d.rad(b), b = Math.sin(a), a = Math.cos(a), l = (1 - e) * Math.tan(d.rad(j)), j = 1 / Math.sqrt(1 + l * l), m = l * j, n = Math.atan2(l, a), l = j * b, p = 1 - l * l, f = p * (f * f - g * g) / (g * g), q = 1 + f / 16384 * (4096 + f * (-768 + f * (320 - 175 * f))), o = f / 1024 * (256 + f * (-128 + f * (74 - 47 * f))), f = c / (g * q), s = 2 * Math.PI; Math.abs(f - s) > 1.0E-12;) var r = Math.cos(2 * n + f),
  301. t = Math.sin(f),
  302. u = Math.cos(f),
  303. v = o * t * (r + o / 4 * (u * (-1 + 2 * r * r) - o / 6 * r * (-3 + 4 * t * t) * (-3 + 4 * r * r))),
  304. s = f,
  305. f = c / (g * q) + v;
  306. c = m * t - j * u * a;
  307. c = Math.atan2(m * u + j * t * a, (1 - e) * Math.sqrt(l * l + c * c));
  308. g = e / 16 * p * (4 + e * (4 - 3 * p));
  309. return new GeoGlobe.LngLat(h + d.deg(Math.atan2(t * b, j * u - m * t * a) - (1 - g) * e * l * (f + g * t * (r + g * u * (-1 + 2 * r * r)))), d.deg(c))
  310. };
  311. GeoGlobe.Util.getParameters = function(a, b) {
  312. var b = b || {},
  313. a = a === null || a === void 0 ? window.location.href : a,
  314. c = "";
  315. if (GeoGlobe.String.contains(a, "?")) var d = a.indexOf("?") + 1,
  316. c = GeoGlobe.String.contains(a, "#") ? a.indexOf("#") : a.length,
  317. c = a.substring(d, c);
  318. for (var d = {}, c = c.split(/[&;]/), e = 0, f = c.length; e < f; ++e) {
  319. var g = c[e].split("=");
  320. if (g[0]) {
  321. var h = g[0];
  322. try {
  323. h = decodeURIComponent(h)
  324. } catch (j) {
  325. h = unescape(h)
  326. }
  327. g = (g[1] || "").replace(/\+/g, " ");
  328. try {
  329. g = decodeURIComponent(g)
  330. } catch (l) {
  331. g = unescape(g)
  332. }
  333. b.splitArgs !== !1 && (g = g.split(","));
  334. g.length == 1 && (g = g[0]);
  335. d[h] = g
  336. }
  337. }
  338. return d
  339. };
  340. GeoGlobe.Util.lastSeqID = 0;
  341. GeoGlobe.Util.createUniqueID = function(a) {
  342. a = a == null ? "id_" : a.replace(GeoGlobe.Util.dotless, "_");
  343. GeoGlobe.Util.lastSeqID += 1;
  344. return a + GeoGlobe.Util.lastSeqID
  345. };
  346. GeoGlobe.INCHES_PER_UNIT = {
  347. inches: 1,
  348. ft: 12,
  349. mi: 63360,
  350. m: 1 / 0.0254,
  351. km: 39370,
  352. dd: 4374754,
  353. yd: 36
  354. };
  355. GeoGlobe.INCHES_PER_UNIT["in"] = GeoGlobe.INCHES_PER_UNIT.inches;
  356. GeoGlobe.INCHES_PER_UNIT.degrees = GeoGlobe.INCHES_PER_UNIT.dd;
  357. GeoGlobe.INCHES_PER_UNIT.nmi = 1852 * GeoGlobe.INCHES_PER_UNIT.m;
  358. GeoGlobe.METERS_PER_INCH = 0.0254000508001016;
  359. GeoGlobe.Util.extend(GeoGlobe.INCHES_PER_UNIT, {
  360. Inch: GeoGlobe.INCHES_PER_UNIT.inches,
  361. Meter: 1 / GeoGlobe.METERS_PER_INCH,
  362. Foot: 0.3048006096012192 / GeoGlobe.METERS_PER_INCH,
  363. IFoot: 0.3048 / GeoGlobe.METERS_PER_INCH,
  364. ClarkeFoot: 0.3047972651151 / GeoGlobe.METERS_PER_INCH,
  365. SearsFoot: 0.30479947153867626 / GeoGlobe.METERS_PER_INCH,
  366. GoldCoastFoot: 0.3047997101815088 / GeoGlobe.METERS_PER_INCH,
  367. IInch: 0.0254 / GeoGlobe.METERS_PER_INCH,
  368. MicroInch: 2.54E-5 / GeoGlobe.METERS_PER_INCH,
  369. Mil: 2.54E-8 / GeoGlobe.METERS_PER_INCH,
  370. Centimeter: 0.01 /
  371. GeoGlobe.METERS_PER_INCH,
  372. Kilometer: 1E3 / GeoGlobe.METERS_PER_INCH,
  373. Yard: 0.9144018288036576 / GeoGlobe.METERS_PER_INCH,
  374. SearsYard: 0.914398414616029 / GeoGlobe.METERS_PER_INCH,
  375. IndianYard: 0.9143985307444408 / GeoGlobe.METERS_PER_INCH,
  376. IndianYd37: 0.91439523 / GeoGlobe.METERS_PER_INCH,
  377. IndianYd62: 0.9143988 / GeoGlobe.METERS_PER_INCH,
  378. IndianYd75: 0.9143985 / GeoGlobe.METERS_PER_INCH,
  379. IndianFoot: 0.30479951 / GeoGlobe.METERS_PER_INCH,
  380. IndianFt37: 0.30479841 / GeoGlobe.METERS_PER_INCH,
  381. IndianFt62: 0.3047996 / GeoGlobe.METERS_PER_INCH,
  382. IndianFt75: 0.3047995 /
  383. GeoGlobe.METERS_PER_INCH,
  384. Mile: 1609.3472186944373 / GeoGlobe.METERS_PER_INCH,
  385. IYard: 0.9144 / GeoGlobe.METERS_PER_INCH,
  386. IMile: 1609.344 / GeoGlobe.METERS_PER_INCH,
  387. NautM: 1852 / GeoGlobe.METERS_PER_INCH,
  388. "Lat-66": 110943.31648893273 / GeoGlobe.METERS_PER_INCH,
  389. "Lat-83": 110946.25736872235 / GeoGlobe.METERS_PER_INCH,
  390. Decimeter: 0.1 / GeoGlobe.METERS_PER_INCH,
  391. Millimeter: 0.001 / GeoGlobe.METERS_PER_INCH,
  392. Dekameter: 10 / GeoGlobe.METERS_PER_INCH,
  393. Decameter: 10 / GeoGlobe.METERS_PER_INCH,
  394. Hectometer: 100 / GeoGlobe.METERS_PER_INCH,
  395. GermanMeter: 1.0000135965 /
  396. GeoGlobe.METERS_PER_INCH,
  397. CaGrid: 0.999738 / GeoGlobe.METERS_PER_INCH,
  398. ClarkeChain: 20.1166194976 / GeoGlobe.METERS_PER_INCH,
  399. GunterChain: 20.11684023368047 / GeoGlobe.METERS_PER_INCH,
  400. BenoitChain: 20.116782494375872 / GeoGlobe.METERS_PER_INCH,
  401. SearsChain: 20.11676512155 / GeoGlobe.METERS_PER_INCH,
  402. ClarkeLink: 0.201166194976 / GeoGlobe.METERS_PER_INCH,
  403. GunterLink: 0.2011684023368047 / GeoGlobe.METERS_PER_INCH,
  404. BenoitLink: 0.20116782494375873 / GeoGlobe.METERS_PER_INCH,
  405. SearsLink: 0.2011676512155 / GeoGlobe.METERS_PER_INCH,
  406. Rod: 5.02921005842012 /
  407. GeoGlobe.METERS_PER_INCH,
  408. IntnlChain: 20.1168 / GeoGlobe.METERS_PER_INCH,
  409. IntnlLink: 0.201168 / GeoGlobe.METERS_PER_INCH,
  410. Perch: 5.02921005842012 / GeoGlobe.METERS_PER_INCH,
  411. Pole: 5.02921005842012 / GeoGlobe.METERS_PER_INCH,
  412. Furlong: 201.1684023368046 / GeoGlobe.METERS_PER_INCH,
  413. Rood: 3.778266898 / GeoGlobe.METERS_PER_INCH,
  414. CapeFoot: 0.3047972615 / GeoGlobe.METERS_PER_INCH,
  415. Brealey: 375 / GeoGlobe.METERS_PER_INCH,
  416. ModAmFt: 0.304812252984506 / GeoGlobe.METERS_PER_INCH,
  417. Fathom: 1.8288 / GeoGlobe.METERS_PER_INCH,
  418. "NautM-UK": 1853.184 / GeoGlobe.METERS_PER_INCH,
  419. "50kilometers": 5E4 / GeoGlobe.METERS_PER_INCH,
  420. "150kilometers": 15E4 / GeoGlobe.METERS_PER_INCH
  421. });
  422. GeoGlobe.Util.extend(GeoGlobe.INCHES_PER_UNIT, {
  423. mm: GeoGlobe.INCHES_PER_UNIT.Meter / 1E3,
  424. cm: GeoGlobe.INCHES_PER_UNIT.Meter / 100,
  425. dm: GeoGlobe.INCHES_PER_UNIT.Meter * 100,
  426. km: GeoGlobe.INCHES_PER_UNIT.Meter * 1E3,
  427. kmi: GeoGlobe.INCHES_PER_UNIT.nmi,
  428. fath: GeoGlobe.INCHES_PER_UNIT.Fathom,
  429. ch: GeoGlobe.INCHES_PER_UNIT.IntnlChain,
  430. link: GeoGlobe.INCHES_PER_UNIT.IntnlLink,
  431. "us-in": GeoGlobe.INCHES_PER_UNIT.inches,
  432. "us-ft": GeoGlobe.INCHES_PER_UNIT.Foot,
  433. "us-yd": GeoGlobe.INCHES_PER_UNIT.Yard,
  434. "us-ch": GeoGlobe.INCHES_PER_UNIT.GunterChain,
  435. "us-mi": GeoGlobe.INCHES_PER_UNIT.Mile,
  436. "ind-yd": GeoGlobe.INCHES_PER_UNIT.IndianYd37,
  437. "ind-ft": GeoGlobe.INCHES_PER_UNIT.IndianFt37,
  438. "ind-ch": 20.11669506 / GeoGlobe.METERS_PER_INCH
  439. });
  440. GeoGlobe.DOTS_PER_INCH = 96;
  441. GeoGlobe.Util.normalizeScale = function(a) {
  442. return a > 1 ? 1 / a : a
  443. };
  444. GeoGlobe.Util.getResolutionFromScale = function(a, b) {
  445. var c;
  446. a && (b == null && (b = "degrees"), c = 1 / (GeoGlobe.Util.normalizeScale(a) * GeoGlobe.INCHES_PER_UNIT[b] * GeoGlobe.DOTS_PER_INCH));
  447. return c
  448. };
  449. GeoGlobe.Util.getScaleFromResolution = function(a, b) {
  450. b == null && (b = "degrees");
  451. return a * GeoGlobe.INCHES_PER_UNIT[b] * GeoGlobe.DOTS_PER_INCH
  452. };
  453. GeoGlobe.Util.pagePosition = function(a) {
  454. var b = [0, 0],
  455. c = GeoGlobe.Util.getViewportElement();
  456. if (!a || a == window || a == c) return b;
  457. var d = GeoGlobe.IS_GECKO && document.getBoxObjectFor && GeoGlobe.Element.getStyle(a, "position") == "absolute" && (a.style.top == "" || a.style.left == ""),
  458. e = null;
  459. if (a.getBoundingClientRect) a = a.getBoundingClientRect(), e = window.pageYOffset || c.scrollTop, b[0] = a.left + (window.pageXOffset || c.scrollLeft), b[1] = a.top + e;
  460. else if (document.getBoxObjectFor && !d) a = document.getBoxObjectFor(a), c = document.getBoxObjectFor(c),
  461. b[0] = a.screenX - c.screenX, b[1] = a.screenY - c.screenY;
  462. else {
  463. b[0] = a.offsetLeft;
  464. b[1] = a.offsetTop;
  465. e = a.offsetParent;
  466. if (e != a)
  467. for (; e;) b[0] += e.offsetLeft, b[1] += e.offsetTop, e = e.offsetParent;
  468. c = GeoGlobe.BROWSER_NAME;
  469. if (c == "opera" || c == "safari" && GeoGlobe.Element.getStyle(a, "position") == "absolute") b[1] -= document.body.offsetTop;
  470. for (e = a.offsetParent; e && e != document.body;) {
  471. b[0] -= e.scrollLeft;
  472. if (c != "opera" || e.tagName != "TR") b[1] -= e.scrollTop;
  473. e = e.offsetParent
  474. }
  475. }
  476. return b
  477. };
  478. GeoGlobe.Util.getViewportElement = function() {
  479. var a = arguments.callee.viewportElement;
  480. if (a == void 0) a = GeoGlobe.BROWSER_NAME == "msie" && document.compatMode != "CSS1Compat" ? document.body : document.documentElement, arguments.callee.viewportElement = a;
  481. return a
  482. };
  483. GeoGlobe.Util.isEquivalentUrl = function(a, b, c) {
  484. c = c || {};
  485. GeoGlobe.Util.applyDefaults(c, {
  486. ignoreCase: !0,
  487. ignorePort80: !0,
  488. ignoreHash: !0,
  489. splitArgs: !1
  490. });
  491. var a = GeoGlobe.Util.createUrlObject(a, c),
  492. b = GeoGlobe.Util.createUrlObject(b, c),
  493. d;
  494. for (d in a)
  495. if (d !== "args" && a[d] != b[d]) return !1;
  496. for (d in a.args) {
  497. if (a.args[d] != b.args[d]) return !1;
  498. delete b.args[d]
  499. }
  500. for (d in b.args) return !1;
  501. return !0
  502. };
  503. GeoGlobe.Util.createUrlObject = function(a, b) {
  504. b = b || {};
  505. if (!/^\w+:\/\//.test(a)) {
  506. var c = window.location,
  507. d = c.port ? ":" + c.port : "",
  508. d = c.protocol + "//" + c.host.split(":").shift() + d;
  509. a.indexOf("/") === 0 ? a = d + a : (c = c.pathname.split("/"), c.pop(), a = d + c.join("/") + "/" + a)
  510. }
  511. b.ignoreCase && (a = a.toLowerCase());
  512. c = document.createElement("a");
  513. c.href = a;
  514. d = {};
  515. d.host = c.host.split(":").shift();
  516. d.protocol = c.protocol;
  517. d.port = b.ignorePort80 ? c.port == "80" || c.port == "0" ? "" : c.port : c.port == "" || c.port == "0" ? "80" : c.port;
  518. d.hash = b.ignoreHash || c.hash ===
  519. "#" ? "" : c.hash;
  520. var e = c.search;
  521. e || (e = a.indexOf("?"), e = e != -1 ? a.substr(e) : "");
  522. d.args = GeoGlobe.Util.getParameters(e, {
  523. splitArgs: b.splitArgs
  524. });
  525. d.pathname = c.pathname.charAt(0) == "/" ? c.pathname : "/" + c.pathname;
  526. return d
  527. };
  528. GeoGlobe.Util.removeTail = function(a) {
  529. var b = null,
  530. b = a.indexOf("?"),
  531. c = a.indexOf("#");
  532. return b = b == -1 ? c != -1 ? a.substr(0, c) : a : c != -1 ? a.substr(0, Math.min(b, c)) : a.substr(0, b)
  533. };
  534. GeoGlobe.IS_GECKO = function() {
  535. var a = navigator.userAgent.toLowerCase();
  536. return a.indexOf("webkit") == -1 && a.indexOf("gecko") != -1
  537. }();
  538. GeoGlobe.CANVAS_SUPPORTED = function() {
  539. var a = document.createElement("canvas");
  540. return !(!a.getContext || !a.getContext("2d"))
  541. }();
  542. GeoGlobe.BROWSER_NAME = function() {
  543. var a = "",
  544. b = navigator.userAgent.toLowerCase();
  545. b.indexOf("opera") != -1 ? a = "opera" : b.indexOf("msie") != -1 ? a = "msie" : b.indexOf("safari") != -1 ? a = "safari" : b.indexOf("mozilla") != -1 && (a = b.indexOf("firefox") != -1 ? "firefox" : "mozilla");
  546. return a
  547. }();
  548. GeoGlobe.Util.getBrowserName = function() {
  549. return GeoGlobe.BROWSER_NAME
  550. };
  551. GeoGlobe.Util.getRenderedDimensions = function(a, b, c) {
  552. var d, e, f = document.createElement("div");
  553. f.style.visibility = "hidden";
  554. for (var g = c && c.containerElement ? c.containerElement : document.body, h = !1, j = null, l = g; l && l.tagName.toLowerCase() != "body";) {
  555. var m = GeoGlobe.Element.getStyle(l, "position");
  556. if (m == "absolute") {
  557. h = !0;
  558. break
  559. } else if (m && m != "static") break;
  560. l = l.parentNode
  561. }
  562. if (h && (g.clientHeight === 0 || g.clientWidth === 0)) j = document.createElement("div"), j.style.visibility = "hidden", j.style.position = "absolute", j.style.overflow =
  563. "visible", j.style.width = document.body.clientWidth + "px", j.style.height = document.body.clientHeight + "px", j.appendChild(f);
  564. f.style.position = "absolute";
  565. if (b)
  566. if (b.w) d = b.w, f.style.width = d + "px";
  567. else if (b.h) e = b.h, f.style.height = e + "px";
  568. if (c && c.displayClass) f.className = c.displayClass;
  569. b = document.createElement("div");
  570. b.innerHTML = a;
  571. b.style.overflow = "visible";
  572. if (b.childNodes) {
  573. a = 0;
  574. for (c = b.childNodes.length; a < c; a++)
  575. if (b.childNodes[a].style) b.childNodes[a].style.overflow = "visible"
  576. }
  577. f.appendChild(b);
  578. j ? g.appendChild(j) :
  579. g.appendChild(f);
  580. if (!d) d = parseInt(b.scrollWidth), f.style.width = d + "px";
  581. e || (e = parseInt(b.scrollHeight));
  582. f.removeChild(b);
  583. j ? (j.removeChild(f), g.removeChild(j)) : g.removeChild(f);
  584. return new GeoGlobe.Size(d, e)
  585. };
  586. GeoGlobe.Util.getScrollbarWidth = function() {
  587. var a = GeoGlobe.Util._scrollbarWidth;
  588. if (a == null) {
  589. var b = null,
  590. c = null,
  591. b = a = 0,
  592. b = document.createElement("div");
  593. b.style.position = "absolute";
  594. b.style.top = "-1000px";
  595. b.style.left = "-1000px";
  596. b.style.width = "100px";
  597. b.style.height = "50px";
  598. b.style.overflow = "hidden";
  599. c = document.createElement("div");
  600. c.style.width = "100%";
  601. c.style.height = "200px";
  602. b.appendChild(c);
  603. document.body.appendChild(b);
  604. a = c.offsetWidth;
  605. b.style.overflow = "scroll";
  606. b = c.offsetWidth;
  607. document.body.removeChild(document.body.lastChild);
  608. GeoGlobe.Util._scrollbarWidth = a - b;
  609. a = GeoGlobe.Util._scrollbarWidth
  610. }
  611. return a
  612. };
  613. GeoGlobe.Util.randomStr = function(a) {
  614. for (var b = "", c = [], d = 0; d < a; d++) c.push(String.fromCharCode(97 + Math.ceil(Math.random() * 25)));
  615. for (d = 0; d < a; d++) b += c[d];
  616. return b
  617. };
  618. GeoGlobe.Util.globalEval = function(a) {
  619. a && GeoGlobe.String.trim(a) && (window.execScript || function(a) {
  620. window.eval.call(window, a)
  621. })(a)
  622. };
  623. GeoGlobe.Util.getResolutionFromScale_DPI = function(a, b, c) {
  624. var d;
  625. a && (b == null && (b = "degrees"), d = 1 / (GeoGlobe.Util.normalizeScale(a) * GeoGlobe.INCHES_PER_UNIT[b] * c));
  626. return d
  627. };
  628. GeoGlobe.Util.getScaleFromResolution_DPI = function(a, b, c) {
  629. b == null && (b = "degrees");
  630. return a * GeoGlobe.INCHES_PER_UNIT[b] * c
  631. };
  632. GeoGlobe.Util.getMapLevelFormResolution = function(a, b) {
  633. if (!b) return 0;
  634. var c, d, e = Number.POSITIVE_INFINITY,
  635. f = a.getResolutions();
  636. c = 0;
  637. for (len = f.length; c < len; c++) {
  638. d = Math.abs(f[c] - b);
  639. if (d > e) break;
  640. e = d
  641. }
  642. return Math.max(0, c - 1)
  643. };
  644. GeoGlobe.Util.getMapLevelFormScale = function(a, b, c, d) {
  645. b = GeoGlobe.Util.getResolutionFromScale_DPI(b, c ? c : "degrees", d ? d : 96);
  646. return GeoGlobe.Util.getMapLevelFormResolution(a, b)
  647. };
  648. GeoGlobe.Util.delayFun = function(a, b, c) {
  649. var d;
  650. return function() {
  651. var e = this,
  652. f = arguments,
  653. g = c && !d;
  654. clearTimeout(d);
  655. d = setTimeout(function() {
  656. d = null;
  657. c || a.apply(e, f)
  658. }, b);
  659. g && a.apply(e, f)
  660. }
  661. };
  662. GeoGlobe.Util.clone = function(a) {
  663. if (typeof a != "object") return a;
  664. if (a == null) return a;
  665. var b = a.constructor == Array ? [] : {},
  666. c;
  667. for (c in a) b[c] = GeoGlobe.Util.clone(a[c]);
  668. return b
  669. };
  670. GeoGlobe.Util.getType = function(a) {
  671. if (a instanceof Element) return "element";
  672. return {
  673. "[object Boolean]": "boolean",
  674. "[object Number]": "number",
  675. "[object String]": "string",
  676. "[object Function]": "function",
  677. "[object Array]": "array",
  678. "[object Date]": "date",
  679. "[object RegExp]": "regExp",
  680. "[object Undefined]": "undefined",
  681. "[object Null]": "null",
  682. "[object Object]": "object"
  683. }[Object.prototype.toString.call(a)]
  684. };
  685. GeoGlobe.Util.formatNumberToThousands = function(a, b, c) {
  686. a = a.toString().replace(/\$|\,/g, "");
  687. isNaN(a) && (a = "0");
  688. for (var d = a === (a = Math.abs(a)), a = Math.floor(a * Math.pow(10, b) + 0.50000000001), e = a % Math.pow(10, b), a = Math.floor(a / Math.pow(10, b)).toString(), e = e.toString(); e.length < b;) e = "0" + e;
  689. if (c)
  690. for (c = 0; c < Math.floor((a.length - (1 + c)) / 3); c++) a = a.substring(0, a.length - (4 * c + 3)) + "," + a.substring(a.length - (4 * c + 3));
  691. return b > 0 ? (d ? "" : "-") + a + "." + e : (d ? "" : "-") + a
  692. };
  693. GeoGlobe.Util.getFormattedString = function(a, b) {
  694. var c;
  695. c = b.replace(/{a}/g, a.a);
  696. c = c.replace(/{b}/g, a.b);
  697. if (c.contains("{c"))
  698. for (var d = c.split("{c"), e = 0, f = 0; f < d.length - 1; f++) e = d[f + 1].split("}")[0], c = c.replace(RegExp("{c" + e + "}", "g"), GeoGlobe.Util.formatNumberToThousands(parseFloat(a.c), e === "" ? 2 : e, !0));
  699. return c
  700. };
  701. GeoGlobe.Util.getGradientImageData = function(a) {
  702. var b = document.createElement("canvas"),
  703. c = b.getContext("2d");
  704. b.width = 1;
  705. b.height = 256;
  706. var b = c.createLinearGradient(0, 0, 0, 256),
  707. d = 1,
  708. e;
  709. for (e in a) a.hasOwnProperty(e) && Number(e) > d && (d = Number(e));
  710. for (e in a) a.hasOwnProperty(e) && b.addColorStop(Number(e) / d, a[e]);
  711. c.fillStyle = b;
  712. c.fillRect(0, 0, 1, 256);
  713. return c.getImageData(0, 0, 1, 256).data
  714. };
  715. GeoGlobe.Util.getRgbColor = function(a) {
  716. var a = a.toLowerCase(),
  717. b = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  718. if (a && b.test(a)) {
  719. if (a.length === 4) {
  720. for (var b = "#", c = 1; c < 4; c += 1) b += a.slice(c, c + 1).concat(a.slice(c, c + 1));
  721. a = b
  722. }
  723. b = [];
  724. for (c = 1; c < 7; c += 2) b.push(parseInt("0x" + a.slice(c, c + 2)));
  725. return "rgb(" + b.join(",") + ")"
  726. } else {
  727. if (a.startsWith("rgba") || a.startsWith("hsla")) return a.substring(0, 3) + a.substring(4, a.lastIndexOf(",")) + ")";
  728. if (a.startsWith("rgb") || a.startsWith("hsl")) return a;
  729. return ""
  730. }
  731. };
  732. GeoGlobe.Util.getShadeColor = function(a, b) {
  733. var a = GeoGlobe.Util.getHexColor(a),
  734. a = a.substr(1),
  735. c = parseInt(a, 16),
  736. d = Math.round(2.55 * b),
  737. e = (c >> 16) + d,
  738. f = (c >> 8 & 255) + d,
  739. c = (c & 255) + d;
  740. return "#" + (16777216 + (e < 255 ? e < 1 ? 0 : e : 255) * 65536 + (f < 255 ? f < 1 ? 0 : f : 255) * 256 + (c < 255 ? c < 1 ? 0 : c : 255)).toString(16).slice(1)
  741. };
  742. GeoGlobe.Util.getHexColor = function(a) {
  743. a = a.toLowerCase();
  744. if (/^(rgb|rgba)/.test(a)) {
  745. for (var b = a.split("(")[1].split(")")[0].split(","), c = "#", d = 0; d < 3; d++) {
  746. var e = Number(b[d]).toString(16);
  747. e === "0" && (e += e);
  748. e.length === 1 && (e = "0" + e);
  749. c += e
  750. }
  751. c.length !== 7 && (c = a);
  752. return c
  753. } else if (/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(a))
  754. if (b = a.replace(/#/, "").split(""), b.length === 6) return a;
  755. else {
  756. if (b.length === 3) {
  757. a = "#";
  758. for (d = 0; d < b.length; d += 1) a += b[d] + b[d];
  759. return a
  760. }
  761. }
  762. else return a
  763. };
  764. GeoGlobe.Util.transferToLonLat = function(a) {
  765. return a[1] === -2.3810769323182276E8 ? [a[0] / 2.003750834E7 * 180, -90] : [a[0] / 2.003750834E7 * 180, 180 / Math.PI * (2 * Math.atan(Math.exp(a[1] / 2.003750834E7 * 180 * Math.PI / 180)) - Math.PI / 2)]
  766. };
  767. GeoGlobe.Util.transferToMercator = function(a) {
  768. return a[1] === -90 ? [a[0] * 2.003750834E7 / 180, -2.3810769323182276E8] : [a[0] * 2.003750834E7 / 180, Math.log(Math.tan((90 + a[1]) * Math.PI / 360)) / (Math.PI / 180) * 2.003750834E7 / 180]
  769. };
  770. GeoGlobe.Util.formatDate = function(a, b) {
  771. var c = {
  772. "M+": a.getMonth() + 1,
  773. "d+": a.getDate(),
  774. "h+": a.getHours() % 12 === 0 ? 12 : a.getHours() % 12,
  775. "H+": a.getHours(),
  776. "m+": a.getMinutes(),
  777. "s+": a.getSeconds(),
  778. "q+": Math.floor((a.getMonth() + 3) / 3),
  779. S: a.getMilliseconds()
  780. },
  781. d = {
  782. "0": "/u65e5",
  783. "1": "/u4e00",
  784. "2": "/u4e8c",
  785. "3": "/u4e09",
  786. "4": "/u56db",
  787. "5": "/u4e94",
  788. "6": "/u516d"
  789. };
  790. /(y+)/.test(b) && (b = b.replace(RegExp.$1, (a.getFullYear() + "").substr(4 - RegExp.$1.length)));
  791. /(E+)/.test(b) && (b = b.replace(RegExp.$1, (RegExp.$1.length > 1 ? RegExp.$1.length >
  792. 2 ? "/u661f/u671f" : "/u5468" : "") + d[a.getDay() + ""]));
  793. for (var e in c) RegExp("(" + e + ")").test(b) && (b = b.replace(RegExp.$1, RegExp.$1.length === 1 ? c[e] : ("00" + c[e]).substr(("" + c[e]).length)));
  794. return b
  795. };
  796. GeoGlobe.Util.pointArrayToSpriteGeoJson = function(a, b, c, d) {
  797. if (window.turf) {
  798. c === void 0 && (c = 10);
  799. d === void 0 && (d = 1);
  800. var e = {
  801. type: "FeatureCollection",
  802. features: []
  803. };
  804. if (!a || a && a.units == "degrees") {
  805. for (var a = [], f = [], g = 0; g < b.length - 1; g++) {
  806. var h = turf.point(b[g]),
  807. j = turf.point(b[g + 1]),
  808. h = turf.distance(h, j, {
  809. units: "kilometers"
  810. });
  811. f.push(h * 1E3)
  812. }
  813. g = Math.min.apply(null, f);
  814. c > g && (c = g);
  815. for (g = 0; g < b.length - 1; g++) {
  816. var h = Math.round(f[g] / c),
  817. j = b[g + 1][0] - b[g][0],
  818. l = b[g + 1][1] - b[g][1];
  819. if (h !== 0)
  820. for (var m = 0; m <= h; m++) a.push([b[g][0] + j /
  821. h * m, b[g][1] + l / h * m
  822. ])
  823. }
  824. } else {
  825. a = [];
  826. f = [];
  827. for (g = 0; g < b.length - 1; g++) h = turf.point(b[g]), j = turf.point(b[g + 1]), h = Math.sqrt(Math.pow(h[0] - j[0], 2) + Math.pow(h[1] - j[1], 2)), f.push(h);
  828. g = Math.min.apply(null, f);
  829. c > g && (c = g);
  830. for (g = 0; g < b.length - 1; g++)
  831. if (h = Math.round(f[g] / c), j = b[g + 1][0] - b[g][0], l = b[g + 1][1] - b[g][1], h !== 0)
  832. for (m = 0; m <= h; m++) a.push([b[g][0] + j / h * m, b[g][1] + l / h * m])
  833. }
  834. for (b = 0; b < a.length - 4; b++) c = {
  835. type: "Feature",
  836. geometry: {
  837. type: "LineString",
  838. coordinates: [a[b], a[b + 1], a[b + 2], a[b + 3]]
  839. },
  840. properties: {
  841. link_seq: b,
  842. status: d
  843. }
  844. }, e.features.push(c);
  845. return e
  846. } else console.error("\u672a\u5f15\u5165turf.js\u5e93\uff01")
  847. };
  848. GeoGlobe.Util.pick = function(a, b, c) {
  849. var d = {};
  850. if (c === !0)
  851. for (var e in a) d[e.toUpperCase()] = a[e];
  852. else d = a;
  853. a = {};
  854. for (e = 0; e < b.length; e++) {
  855. var f = b[e];
  856. c && (f = f.toUpperCase());
  857. f in d && (a[f] = d[f])
  858. }
  859. return a
  860. };
  861. GeoGlobe.Util.pick2 = function(a, b) {
  862. var c = {},
  863. d;
  864. for (d in a) {
  865. var e = a[d];
  866. if (d.indexOf(b) === 0) {
  867. var f = d.slice(b.length),
  868. f = f[0].toLowerCase() + f.slice(1);
  869. c[f] = e
  870. }
  871. }
  872. return c
  873. };
  874. GeoGlobe.Util.merge2Obj = function(a, b) {
  875. if (b) {
  876. if (!a) return b
  877. } else return a;
  878. for (var c in b)
  879. if (b[c] && b[c].constructor == Object) a[c] = GeoGlobe.Util.merge2Obj(a[c], b[c]);
  880. else if (b[c] && b[c] instanceof Array) {
  881. if (!a[c] || a[c] instanceof Array) {
  882. a[c] || (a[c] = []);
  883. for (var d = 0; d < b[c].length; d++) {
  884. var e = b[c][d];
  885. a[c].indexOf(e) === -1 && a[c].push(e)
  886. }
  887. }
  888. } else a[c] = b[c];
  889. return a
  890. };
  891. GeoGlobe.Util.download = function(a, b) {
  892. var c;
  893. if (GeoGlobe.Util.getType(a) === "string") {
  894. c = atob(a.split(",")[1] || a.split(",")[0]);
  895. for (var d = c.length, e = new Uint8Array(d), f = 0; f < d; f++) e[f] = c.charCodeAt(f);
  896. a = new Blob([e])
  897. }
  898. if (a instanceof Blob) {
  899. if (a.size === 0) throw "\u6587\u4ef6\u4e0b\u8f7d\uff1a\u7a7a\u6570\u636e\uff01";
  900. c = URL.createObjectURL(a)
  901. } else throw "\u4e0d\u652f\u6301\u7684\u6587\u4ef6\u4e0b\u8f7d\uff01";
  902. window.navigator.msSaveBlob ? (window.navigator.msSaveBlob(c, b), URL.revokeObjectURL(c)) : (d = document.createElement("a"),
  903. d.style.display = "none", d.href = c, d.download = b, document.body.appendChild(d), d.click(), URL.revokeObjectURL(d.href), document.body.removeChild(d))
  904. };
  905. (function(a) {
  906. typeof exports === "object" && typeof module !== "undefined" ? module.exports = a() : typeof define === "function" && define.amd ? define([], a) : (typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : this).proj4cn = a()
  907. })(function() {
  908. return function b(c, d, e) {
  909. function f(h, l) {
  910. if (!d[h]) {
  911. if (!c[h]) {
  912. var m = typeof require == "function" && require;
  913. if (!l && m) return m(h, !0);
  914. if (g) return g(h, !0);
  915. m = Error("Cannot find module '" + h + "'");
  916. throw m.code = "MODULE_NOT_FOUND", m;
  917. }
  918. m = d[h] = {
  919. exports: {}
  920. };
  921. c[h][0].call(m.exports, function(b) {
  922. var d = c[h][1][b];
  923. return f(d ? d : b)
  924. }, m, m.exports, b, c, d, e)
  925. }
  926. return d[h].exports
  927. }
  928. for (var g = typeof require == "function" && require, h = 0; h < e.length; h++) f(e[h]);
  929. return f
  930. }({
  931. 1: [function(b, c, d) {
  932. var c = b("../util").forEachPoint,
  933. e = b("./gcj-02"),
  934. f = Math.PI * 3E3 / 180,
  935. g = d.toGCJ02 = c(function(b, c, d) {
  936. var e = b[d] - 0.0065,
  937. g = b[d + 1] - 0.006,
  938. b = Math.sqrt(e * e + g * g) - 2.0E-5 * Math.sin(g * f),
  939. e = Math.atan2(g, e) - 3.0E-6 * Math.cos(e * f);
  940. c[d] = b * Math.cos(e);
  941. c[d + 1] = b * Math.sin(e);
  942. return c
  943. }),
  944. h = d.fromGCJ02 = c(function(b,
  945. c, d) {
  946. var e = b[d],
  947. g = b[d + 1],
  948. b = Math.sqrt(e * e + g * g) + 2.0E-5 * Math.sin(g * f),
  949. e = Math.atan2(g, e) + 3.0E-6 * Math.cos(e * f);
  950. c[d] = b * Math.cos(e) + 0.0065;
  951. c[d + 1] = b * Math.sin(e) + 0.006;
  952. return c
  953. });
  954. d.toWGS84 = function(b, c, d) {
  955. b = g(b, c, d);
  956. return e.toWGS84(b, b, d)
  957. };
  958. d.fromWGS84 = function(b, c, d) {
  959. b = e.fromWGS84(b, c, d);
  960. return h(b, b, d)
  961. }
  962. }, {
  963. "../util": 8,
  964. "./gcj-02": 2
  965. }],
  966. 2: [function(b, c, d) {
  967. function e(b, c) {
  968. var d, e = b - 105,
  969. f = c - 35;
  970. d = -100 + 2 * e + 3 * f + 0.2 * f * f + 0.1 * e * f + 0.2 * Math.sqrt(Math.abs(e));
  971. d += (20 * Math.sin(6 * e * g) + 20 * Math.sin(2 * e * g)) * 2 / 3;
  972. d += (20 * Math.sin(f *
  973. g) + 40 * Math.sin(f / 3 * g)) * 2 / 3;
  974. d += (160 * Math.sin(f / 12 * g) + 320 * Math.sin(f * g / 30)) * 2 / 3;
  975. f = b - 105;
  976. e = c - 35;
  977. e = 300 + f + 2 * e + 0.1 * f * f + 0.1 * f * e + 0.1 * Math.sqrt(Math.abs(f));
  978. e += (20 * Math.sin(6 * f * g) + 20 * Math.sin(2 * f * g)) * 2 / 3;
  979. e += (20 * Math.sin(f * g) + 40 * Math.sin(f / 3 * g)) * 2 / 3;
  980. e += (150 * Math.sin(f / 12 * g) + 300 * Math.sin(f / 30 * g)) * 2 / 3;
  981. var f = c / 180 * g,
  982. o = Math.sin(f),
  983. o = 1 - j * o * o,
  984. s = Math.sqrt(o);
  985. d = d * 180 / (h * (1 - j) / (o * s) * g);
  986. e = e * 180 / (h / s * Math.cos(f) * g);
  987. return [e, d]
  988. }
  989. function f(b, c) {
  990. if (b < 72.004 || b > 137.8347) return !0;
  991. if (c < 0.8293 || c > 55.8271) return !0;
  992. return !1
  993. }
  994. var b =
  995. b("../util").forEachPoint,
  996. g = Math.PI,
  997. h = 6378245,
  998. j = 0.006693421622965943;
  999. d.toWGS84 = b(function(b, c, d) {
  1000. var g = b[d],
  1001. b = b[d + 1];
  1002. if (!f(g, b)) {
  1003. var h = e(g, b);
  1004. g -= h[0];
  1005. b -= h[1]
  1006. }
  1007. c[d] = g;
  1008. c[d + 1] = b
  1009. });
  1010. d.fromWGS84 = b(function(b, c, d) {
  1011. var g = b[d],
  1012. b = b[d + 1];
  1013. if (!f(g, b)) {
  1014. var h = e(g, b);
  1015. g += h[0];
  1016. b += h[1]
  1017. }
  1018. c[d] = g;
  1019. c[d + 1] = b
  1020. })
  1021. }, {
  1022. "../util": 8
  1023. }],
  1024. 3: [function(b, c, d) {
  1025. d.bd09 = b("./bd-09");
  1026. d.gcj02 = b("./gcj-02")
  1027. }, {
  1028. "./bd-09": 1,
  1029. "./gcj-02": 2
  1030. }],
  1031. 4: [function(b, c, d) {
  1032. var e = b("./projection/index"),
  1033. f = b("./datum/index");
  1034. d.smerc2bmerc = function(b, c, d) {
  1035. b = e.sphericalMercator.inverse(b,
  1036. c, d);
  1037. b = f.bd09.fromWGS84(b, b, d);
  1038. return e.baiduMercator.forward(b, b, d)
  1039. };
  1040. d.bmerc2smerc = function(b, c, d) {
  1041. b = e.baiduMercator.inverse(b, c, d);
  1042. b = f.bd09.toWGS84(b, b, d);
  1043. return e.sphericalMercator.forward(b, b, d)
  1044. };
  1045. d.bmerc2ll = function(b, c, d) {
  1046. b = e.baiduMercator.inverse(b, c, d);
  1047. return f.bd09.toWGS84(b, b, d)
  1048. };
  1049. d.ll2bmerc = function(b, c, d) {
  1050. b = f.bd09.fromWGS84(b, c, d);
  1051. return e.baiduMercator.forward(b, b, d)
  1052. };
  1053. d.ll2smerc = e.sphericalMercator.forward;
  1054. d.smerc2ll = e.sphericalMercator.inverse;
  1055. d.datum = f;
  1056. d.projection = e;
  1057. d.gcj02towgs84 = function(b,
  1058. c, d) {
  1059. return f.gcj02.toWGS84(b, c, d)
  1060. };
  1061. d.wgs84togcj02 = function(b, c, d) {
  1062. return f.gcj02.fromWGS84(b, c, d)
  1063. }
  1064. }, {
  1065. "./datum/index": 3,
  1066. "./projection/index": 6
  1067. }],
  1068. 5: [function(b, c, d) {
  1069. function e(b, c, d, e) {
  1070. var f = b[d],
  1071. b = b[d + 1],
  1072. g = Math.abs(b) / e[9],
  1073. g = e[2] + e[3] * g + e[4] * g * g + e[5] * g * g * g + e[6] * g * g * g * g + e[7] * g * g * g * g * g + e[8] * g * g * g * g * g * g;
  1074. c[d] = (e[0] + e[1] * Math.abs(f)) * (f < 0 ? -1 : 1);
  1075. c[d + 1] = g * (b < 0 ? -1 : 1)
  1076. }
  1077. var b = b("../util").forEachPoint,
  1078. f = [1.289059486E7, 8362377.87, 5591021, 3481989.83, 1678043.12, 0],
  1079. g = [75, 60, 45, 30, 15, 0],
  1080. h = [
  1081. [1.410526172116255E-8,
  1082. 8.98305509648872E-6, -1.9939833816331, 200.9824383106796, -187.2403703815547, 91.6087516669843, -23.38765649603339, 2.57121317296198, -0.03801003308653, 1.73379812E7
  1083. ],
  1084. [-7.435856389565537E-9, 8.983055097726239E-6, -0.78625201886289, 96.32687599759846, -1.85204757529826, -59.36935905485877, 47.40033549296737, -16.50741931063887, 2.28786674699375, 1.026014486E7],
  1085. [-3.030883460898826E-8, 8.98305509983578E-6, 0.30071316287616, 59.74293618442277, 7.357984074871, -25.38371002664745, 13.45380521110908, -3.29883767235584, 0.32710905363475,
  1086. 6856817.37
  1087. ],
  1088. [-1.981981304930552E-8, 8.983055099779535E-6, 0.03278182852591, 40.31678527705744, 0.65659298677277, -4.44255534477492, 0.85341911805263, 0.12923347998204, -0.04625736007561, 4482777.06],
  1089. [3.09191371068437E-9, 8.983055096812155E-6, 6.995724062E-5, 23.10934304144901, -2.3663490511E-4, -0.6321817810242, -0.00663494467273, 0.03430082397953, -0.00466043876332, 2555164.4],
  1090. [2.890871144776878E-9, 8.983055095805407E-6, -3.068298E-8, 7.47137025468032, -3.53937994E-6, -0.02145144861037, -1.234426596E-5, 1.0322952773E-4, -3.23890364E-6, 826088.5]
  1091. ],
  1092. j = [
  1093. [-0.0015702102444, 111320.7020616939, 1704480524535203, -10338987376042340, 26112667856603880, -35149669176653700, 26595700718403920, -10725012454188240, 1800819912950474, 82.5],
  1094. [8.277824516172526E-4, 111320.7020463578, 6.477955746671607E8, -4.082003173641316E9, 1.077490566351142E10, -1.517187553151559E10, 1.205306533862167E10, -5.124939663577472E9, 9.133119359512032E8, 67.5],
  1095. [0.00337398766765, 111320.7020202162, 4481351.045890365, -2.339375119931662E7, 7.968221547186455E7, -1.159649932797253E8,
  1096. 9.723671115602145E7, -4.366194633752821E7, 8477230.501135234, 52.5
  1097. ],
  1098. [0.00220636496208, 111320.7020209128, 51751.86112841131, 3796837.749470245, 992013.7397791013, -1221952.21711287, 1340652.697009075, -620943.6990984312, 144416.9293806241, 37.5],
  1099. [-3.441963504368392E-4, 111320.7020576856, 278.2353980772752, 2485758.690035394, 6070.750963243378, 54821.18345352118, 9540.606633304236, -2710.55326746645, 1405.483844121726, 22.5],
  1100. [-3.218135878613132E-4, 111320.7020701615, 0.00369383431289, 823725.6402795718, 0.46104986909093, 2351.343141331292,
  1101. 1.58060784298199, 8.77738589078284, 0.37238884252424, 7.45
  1102. ]
  1103. ];
  1104. d.forward = b(function(b, c, d) {
  1105. for (var f = b[d]; f > 180;) f -= 360;
  1106. for (; f < -180;) f += 360;
  1107. var b = b[d + 1],
  1108. b = Math.max(b, -74),
  1109. b = Math.min(b, 74),
  1110. h = null,
  1111. o;
  1112. for (o = 0; o < g.length; ++o)
  1113. if (b >= g[o]) {
  1114. h = j[o];
  1115. break
  1116. }
  1117. if (h === null)
  1118. for (o = g.length - 1; o >= 0; --o)
  1119. if (b <= -g[o]) {
  1120. h = j[o];
  1121. break
  1122. }
  1123. c[d] = f;
  1124. c[d + 1] = b;
  1125. e(c, c, d, h)
  1126. });
  1127. d.inverse = b(function(b, c, d) {
  1128. for (var g = Math.abs(b[d + 1]), j = null, o = 0; o < f.length; o++)
  1129. if (g >= f[o]) {
  1130. j = h[o];
  1131. break
  1132. }
  1133. e(b, c, d, j)
  1134. })
  1135. }, {
  1136. "../util": 8
  1137. }],
  1138. 6: [function(b, c, d) {
  1139. d.baiduMercator =
  1140. b("./baidu-mercator");
  1141. d.sphericalMercator = b("./spherical-mercator")
  1142. }, {
  1143. "./baidu-mercator": 5,
  1144. "./spherical-mercator": 7
  1145. }],
  1146. 7: [function(b, c, d) {
  1147. var b = b("../util").forEachPoint,
  1148. e = Math.PI / 180;
  1149. d.forward = b(function(b, c, d) {
  1150. var j = Math.sin(Math.max(Math.min(85.0511287798, b[d + 1]), -85.0511287798) * e);
  1151. c[d] = 6378137 * b[d] * e;
  1152. c[d + 1] = 6378137 * Math.log((1 + j) / (1 - j)) / 2
  1153. });
  1154. d.inverse = b(function(b, c, d) {
  1155. c[d] = b[d] / 6378137 / e;
  1156. c[d + 1] = (2 * Math.atan(Math.exp(b[d + 1] / 6378137)) - Math.PI / 2) / e
  1157. })
  1158. }, {
  1159. "../util": 8
  1160. }],
  1161. 8: [function(b, c, d) {
  1162. d.forEachPoint =
  1163. function(b) {
  1164. return function(c, d, h) {
  1165. for (var j = c.length, h = h ? h : 2, d = d ? d : h !== 2 ? c.slice() : Array(j), l = 0; l < j; l += h) b(c, d, l);
  1166. return d
  1167. }
  1168. }
  1169. }, {}]
  1170. }, {}, [4])(4)
  1171. });
  1172. if (GeoGlobe) GeoGlobe.Proj4cn = proj4cn;
  1173. GeoGlobe.ProjAxisOrder = {
  1174. AXIS_ORDER_EN: !0,
  1175. AXIS_ORDER_NE: !1
  1176. };
  1177. GeoGlobe.ProjAxisOrder.AxisOrder = {
  1178. "EPSG:900913": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1179. WGS84: GeoGlobe.ProjAxisOrder.AXIS_ORDER_NE,
  1180. "IGNF:WGS84G": GeoGlobe.ProjAxisOrder.AXIS_ORDER_NE,
  1181. "EPSG:4326": GeoGlobe.ProjAxisOrder.AXIS_ORDER_NE,
  1182. "EPSG:4490": GeoGlobe.ProjAxisOrder.AXIS_ORDER_NE,
  1183. "EPSG:4269": GeoGlobe.ProjAxisOrder.AXIS_ORDER_NE,
  1184. "EPSG:2361": GeoGlobe.ProjAxisOrder.AXIS_ORDER_NE,
  1185. "EPSG:27700": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1186. "EPSG:904490": GeoGlobe.ProjAxisOrder.AXIS_ORDER_NE,
  1187. "EPSG:4171": GeoGlobe.ProjAxisOrder.AXIS_ORDER_NE,
  1188. "EPSG:32637": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1189. "EPSG:32638": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1190. "EPSG:32639": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1191. "EPSG:32640": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1192. "EPSG:32641": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1193. "EPSG:28991": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1194. "EPSG:28992": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1195. "EPSG:31300": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1196. "EPSG:31370": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1197. "EPSG:2176": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1198. "EPSG:2177": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1199. "EPSG:2178": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1200. "EPSG:2179": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1201. "EPSG:2180": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1202. "EPSG:2154": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1203. "EPSG:3346": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1204. "EPSG:3857": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN,
  1205. "EPSG:2065": GeoGlobe.ProjAxisOrder.AXIS_ORDER_EN
  1206. };
  1207. GeoGlobe.SpatialReference = GeoGlobe.Class({
  1208. proj: null,
  1209. projCode: null,
  1210. titleRegEx: /\+title=[^\+]*/,
  1211. initialize: function(a, b) {
  1212. GeoGlobe.Util.extend(this, b);
  1213. this.projCode = a;
  1214. if (typeof Proj4js == "object") this.proj = new Proj4js.Proj(a)
  1215. },
  1216. getCode: function() {
  1217. return this.proj ? this.proj.srsCode : this.projCode
  1218. },
  1219. getUnits: function() {
  1220. return this.proj ? this.proj.units : null
  1221. },
  1222. toString: function() {
  1223. return this.getCode()
  1224. },
  1225. equals: function(a) {
  1226. var b = !1;
  1227. a && (a instanceof GeoGlobe.SpatialReference || (a = new GeoGlobe.SpatialReference(a)),
  1228. typeof Proj4js == "object" && this.proj.defData && a.proj.defData ? b = this.proj.defData.replace(this.titleRegEx, "") == a.proj.defData.replace(this.titleRegEx, "") : a.getCode && (b = this.getCode(), a = a.getCode(), b = b == a || !!GeoGlobe.SpatialReference.transforms[b] && GeoGlobe.SpatialReference.transforms[b][a] === GeoGlobe.SpatialReference.nullTransform));
  1229. return b
  1230. },
  1231. destroy: function() {
  1232. delete this.proj;
  1233. delete this.projCode
  1234. },
  1235. CLASS_NAME: "GeoGlobe.SpatialReference"
  1236. });
  1237. GeoGlobe.SpatialReference.transforms = {};
  1238. GeoGlobe.SpatialReference.defaults = {
  1239. "EPSG:4326": {
  1240. units: "degrees",
  1241. maxExtent: [-180, -90, 180, 90],
  1242. yx: !0
  1243. },
  1244. "CRS:84": {
  1245. units: "degrees",
  1246. maxExtent: [-180, -90, 180, 90]
  1247. },
  1248. "EPSG:900913": {
  1249. units: "m",
  1250. maxExtent: [-2.003750834E7, -2.003750834E7, 2.003750834E7, 2.003750834E7]
  1251. }
  1252. };
  1253. GeoGlobe.SpatialReference.addTransform = function(a, b, c) {
  1254. if (c === GeoGlobe.SpatialReference.nullTransform) {
  1255. var d = GeoGlobe.SpatialReference.defaults[a];
  1256. d && !GeoGlobe.SpatialReference.defaults[b] && (GeoGlobe.SpatialReference.defaults[b] = d)
  1257. }
  1258. GeoGlobe.SpatialReference.transforms[a] || (GeoGlobe.SpatialReference.transforms[a] = {});
  1259. GeoGlobe.SpatialReference.transforms[a][b] = c
  1260. };
  1261. GeoGlobe.SpatialReference.transform = function(a, b, c) {
  1262. if (b && c)
  1263. if (b instanceof GeoGlobe.SpatialReference || (b = new GeoGlobe.SpatialReference(b)), c instanceof GeoGlobe.SpatialReference || (c = new GeoGlobe.SpatialReference(c)), b.proj && c.proj) a = Proj4js.transform(b.proj, c.proj, a);
  1264. else {
  1265. var b = b.getCode(),
  1266. c = c.getCode(),
  1267. d = GeoGlobe.SpatialReference.transforms;
  1268. if (d[b] && d[b][c]) d[b][c](a)
  1269. }
  1270. return a
  1271. };
  1272. GeoGlobe.SpatialReference.nullTransform = function(a) {
  1273. return a
  1274. };
  1275. (function() {
  1276. function a(a) {
  1277. a.x = 180 * a.x / d;
  1278. a.y = 180 / Math.PI * (2 * Math.atan(Math.exp(a.y / d * Math.PI)) - Math.PI / 2);
  1279. return a
  1280. }
  1281. function b(a) {
  1282. a.x = a.x * d / 180;
  1283. a.y = Math.max(-2.003750834E7, Math.min(Math.log(Math.tan((90 + a.y) * Math.PI / 360)) / Math.PI * d, 2.003750834E7));
  1284. return a
  1285. }
  1286. function c(c, d) {
  1287. var e = GeoGlobe.SpatialReference.addTransform,
  1288. f = GeoGlobe.SpatialReference.nullTransform,
  1289. g, p, q, o, s;
  1290. g = 0;
  1291. for (p = d.length; g < p; ++g) {
  1292. q = d[g];
  1293. e(c, q, b);
  1294. e(q, c, a);
  1295. for (s = g + 1; s < p; ++s) o = d[s], e(q, o, f), e(o, q, f)
  1296. }
  1297. }
  1298. var d = 2.003750834E7,
  1299. e = ["EPSG:900913",
  1300. "EPSG:3857", "EPSG:102113", "EPSG:102100"
  1301. ],
  1302. f = ["CRS:84", "urn:ogc:def:crs:EPSG:6.6:4326", "EPSG:4326"],
  1303. g;
  1304. for (g = e.length - 1; g >= 0; --g) c(e[g], f);
  1305. for (g = f.length - 1; g >= 0; --g) c(f[g], e)
  1306. })();
  1307. GeoGlobe.String = {
  1308. startsWith: function(a, b) {
  1309. return a.indexOf(b) == 0
  1310. },
  1311. contains: function(a, b) {
  1312. return a.indexOf(b) != -1
  1313. },
  1314. trim: function(a) {
  1315. return a.replace(/^\s\s*/, "").replace(/\s\s*$/, "")
  1316. },
  1317. camelize: function(a) {
  1318. for (var a = a.split("-"), b = a[0], c = 1, d = a.length; c < d; c++) {
  1319. var e = a[c];
  1320. b += e.charAt(0).toUpperCase() + e.substring(1)
  1321. }
  1322. return b
  1323. },
  1324. format: function(a, b, c) {
  1325. b || (b = window);
  1326. return a.replace(GeoGlobe.String.tokenRegEx, function(a, e) {
  1327. for (var f, g = e.split(/\.+/), h = 0; h < g.length; h++) {
  1328. h == 0 && (f = b);
  1329. if (f === void 0) break;
  1330. f = f[g[h]]
  1331. }
  1332. typeof f ==
  1333. "function" && (f = c ? f.apply(null, c) : f());
  1334. return typeof f == "undefined" ? "undefined" : f
  1335. })
  1336. },
  1337. tokenRegEx: /\$\{([\w.]+?)\}/g,
  1338. numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
  1339. isNumeric: function(a) {
  1340. return GeoGlobe.String.numberRegEx.test(a)
  1341. },
  1342. numericIf: function(a, b) {
  1343. var c = a;
  1344. b === !0 && a != null && a.replace && (a = a.replace(/^\s*|\s*$/g, ""));
  1345. return GeoGlobe.String.isNumeric(a) ? parseFloat(a) : c
  1346. }
  1347. };
  1348. GeoGlobe.Number = {
  1349. decimalSeparator: ".",
  1350. thousandsSeparator: ",",
  1351. limitSigDigs: function(a, b) {
  1352. var c = 0;
  1353. b > 0 && (c = parseFloat(a.toPrecision(b)));
  1354. return c
  1355. },
  1356. format: function(a, b, c, d) {
  1357. b = typeof b != "undefined" ? b : 0;
  1358. c = typeof c != "undefined" ? c : GeoGlobe.Number.thousandsSeparator;
  1359. d = typeof d != "undefined" ? d : GeoGlobe.Number.decimalSeparator;
  1360. b != null && (a = parseFloat(a.toFixed(b)));
  1361. var e = a.toString().split(".");
  1362. e.length == 1 && b == null && (b = 0);
  1363. a = e[0];
  1364. if (c)
  1365. for (var f = /(-?[0-9]+)([0-9]{3})/; f.test(a);) a = a.replace(f, "$1" + c + "$2");
  1366. b == 0 ?
  1367. b = a : (c = e.length > 1 ? e[1] : "0", b != null && (c += Array(b - c.length + 1).join("0")), b = a + d + c);
  1368. return b
  1369. },
  1370. zeroPad: function(a, b, c) {
  1371. for (a = a.toString(c || 10); a.length < b;) a = "0" + a;
  1372. return a
  1373. }
  1374. };
  1375. GeoGlobe.Function = {
  1376. bind: function(a, b) {
  1377. var c = Array.prototype.slice.apply(arguments, [2]);
  1378. return function() {
  1379. var d = c.concat(Array.prototype.slice.apply(arguments, [0]));
  1380. return a.apply(b, d)
  1381. }
  1382. },
  1383. bindAsEventListener: function(a, b) {
  1384. return function(c) {
  1385. return a.call(b, c || window.event)
  1386. }
  1387. },
  1388. False: function() {
  1389. return !1
  1390. },
  1391. True: function() {
  1392. return !0
  1393. },
  1394. Void: function() {}
  1395. };
  1396. GeoGlobe.Array = {
  1397. filter: function(a, b, c) {
  1398. var d = [];
  1399. if (Array.prototype.filter) d = a.filter(b, c);
  1400. else {
  1401. var e = a.length;
  1402. if (typeof b != "function") throw new TypeError;
  1403. for (var f = 0; f < e; f++)
  1404. if (f in a) {
  1405. var g = a[f];
  1406. b.call(c, g, f, a) && d.push(g)
  1407. }
  1408. }
  1409. return d
  1410. }
  1411. };
  1412. if (!String.prototype.endsWith) String.prototype.endsWith = function(a, b) {
  1413. var c = this.toString();
  1414. if (typeof b !== "number" || !isFinite(b) || Math.floor(b) !== b || b > c.length) b = c.length;
  1415. b -= a.length;
  1416. c = c.lastIndexOf(a, b);
  1417. return c !== -1 && c === b
  1418. };
  1419. GeoGlobe.Pixel = GeoGlobe.Class4OL({
  1420. x: 0,
  1421. y: 0,
  1422. initialize: function(a, b) {
  1423. this.x = parseFloat(a);
  1424. this.y = parseFloat(b)
  1425. },
  1426. toString: function() {
  1427. return "x=" + this.x + ",y=" + this.y
  1428. },
  1429. clone: function() {
  1430. return new GeoGlobe.Pixel(this.x, this.y)
  1431. },
  1432. equals: function(a) {
  1433. var b = !1;
  1434. a != null && (b = this.x == a.x && this.y == a.y || isNaN(this.x) && isNaN(this.y) && isNaN(a.x) && isNaN(a.y));
  1435. return b
  1436. },
  1437. distanceTo: function(a) {
  1438. return Math.sqrt(Math.pow(this.x - a.x, 2) + Math.pow(this.y - a.y, 2))
  1439. },
  1440. add: function(a, b) {
  1441. if (a == null || b == null) throw new TypeError("Pixel.add cannot receive null values");
  1442. return new GeoGlobe.Pixel(this.x + a, this.y + b)
  1443. },
  1444. offset: function(a) {
  1445. var b = this.clone();
  1446. a && (b = this.add(a.x, a.y));
  1447. return b
  1448. },
  1449. CLASS_NAME: "GeoGlobe.Pixel"
  1450. });
  1451. GeoGlobe.Size = GeoGlobe.Class4OL({
  1452. w: 0,
  1453. h: 0,
  1454. initialize: function(a, b) {
  1455. this.w = parseFloat(a);
  1456. this.h = parseFloat(b)
  1457. },
  1458. toString: function() {
  1459. return "w=" + this.w + ",h=" + this.h
  1460. },
  1461. clone: function() {
  1462. return new GeoGlobe.Size(this.w, this.h)
  1463. },
  1464. equals: function(a) {
  1465. var b = !1;
  1466. a != null && (b = this.w == a.w && this.h == a.h || isNaN(this.w) && isNaN(this.h) && isNaN(a.w) && isNaN(a.h));
  1467. return b
  1468. },
  1469. CLASS_NAME: "GeoGlobe.Size"
  1470. });
  1471. GeoGlobe.Date = {
  1472. dateRegEx: /^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/,
  1473. toISOString: function() {
  1474. return "toISOString" in Date.prototype ? function(a) {
  1475. return a.toISOString()
  1476. } : function(a) {
  1477. return isNaN(a.getTime()) ? "Invalid Date" : a.getUTCFullYear() + "-" + GeoGlobe.Number.zeroPad(a.getUTCMonth() + 1, 2) + "-" + GeoGlobe.Number.zeroPad(a.getUTCDate(), 2) + "T" + GeoGlobe.Number.zeroPad(a.getUTCHours(), 2) + ":" + GeoGlobe.Number.zeroPad(a.getUTCMinutes(),
  1478. 2) + ":" + GeoGlobe.Number.zeroPad(a.getUTCSeconds(), 2) + "." + GeoGlobe.Number.zeroPad(a.getUTCMilliseconds(), 3) + "Z"
  1479. }
  1480. }(),
  1481. parse: function(a) {
  1482. var b;
  1483. if ((a = a.match(this.dateRegEx)) && (a[1] || a[7])) {
  1484. b = parseInt(a[1], 10) || 0;
  1485. var c = parseInt(a[2], 10) - 1 || 0,
  1486. d = parseInt(a[3], 10) || 1;
  1487. b = new Date(Date.UTC(b, c, d));
  1488. if (c = a[7]) {
  1489. var d = parseInt(a[4], 10),
  1490. e = parseInt(a[5], 10),
  1491. f = parseFloat(a[6]),
  1492. g = f | 0;
  1493. b.setUTCHours(d, e, g, Math.round(1E3 * (f - g)));
  1494. c !== "Z" && (c = parseInt(c, 10), a = parseInt(a[8], 10) || 0, b = new Date(b.getTime() + -1E3 * (60 * c * 60 + a * 60)))
  1495. }
  1496. } else b =
  1497. new Date("invalid");
  1498. return b
  1499. }
  1500. };
  1501. GeoGlobe.Console = {
  1502. log: function() {},
  1503. debug: function() {},
  1504. info: function() {},
  1505. warn: function() {},
  1506. error: function() {},
  1507. userError: function(a) {
  1508. alert(a)
  1509. },
  1510. assert: function() {},
  1511. dir: function() {},
  1512. dirxml: function() {},
  1513. trace: function() {},
  1514. group: function() {},
  1515. groupEnd: function() {},
  1516. time: function() {},
  1517. timeEnd: function() {},
  1518. profile: function() {},
  1519. profileEnd: function() {},
  1520. count: function() {},
  1521. CLASS_NAME: "GeoGlobe.Console"
  1522. };
  1523. (function() {
  1524. for (var a = document.getElementsByTagName("script"), b = 0, c = a.length; b < c; ++b)
  1525. if (a[b].src.indexOf("firebug.js") != -1 && console) {
  1526. GeoGlobe.Util.extend(GeoGlobe.Console, console);
  1527. break
  1528. }
  1529. })();
  1530. GeoGlobe.ProxyHost = "";
  1531. GeoGlobe.timeout = 0;
  1532. if (!GeoGlobe.Request) GeoGlobe.Request = {};
  1533. GeoGlobe.Util.extend(GeoGlobe.Request, {
  1534. DEFAULT_CONFIG: {
  1535. method: "GET",
  1536. url: window.location.href,
  1537. async: !0,
  1538. user: void 0,
  1539. password: void 0,
  1540. params: null,
  1541. proxy: GeoGlobe.ProxyHost,
  1542. timeout: GeoGlobe.timeout,
  1543. headers: {},
  1544. data: null,
  1545. callback: function() {},
  1546. success: null,
  1547. failure: null,
  1548. scope: null
  1549. },
  1550. URL_SPLIT_REGEX: /([^:]*:)\/\/([^:]*:?[^@]*@)?([^:\/\?]*):?([^\/\?]*)/,
  1551. makeSameOrigin: function(a, b) {
  1552. var c = a.indexOf("http") !== 0,
  1553. d = !c && a.match(this.URL_SPLIT_REGEX);
  1554. if (d) {
  1555. var e = window.location,
  1556. c = d[1] == e.protocol && d[3] == e.hostname,
  1557. d = d[4],
  1558. e = e.port;
  1559. if (d != 80 && d != "" || e != "80" && e != "") c = c && d == e
  1560. }
  1561. c || b && (a = typeof b == "function" ? b(a) : a.indexOf("cts?") >= 0 ? b + a : b + encodeURIComponent(a));
  1562. return a
  1563. },
  1564. issue: function(a) {
  1565. var b = a.noProxy === !0 ? GeoGlobe.Util.extend(this.DEFAULT_CONFIG, {
  1566. timeout: GeoGlobe.timeout
  1567. }) : GeoGlobe.Util.extend(this.DEFAULT_CONFIG, {
  1568. proxy: GeoGlobe.ProxyHost,
  1569. timeout: GeoGlobe.timeout
  1570. }),
  1571. a = a || {};
  1572. a.headers = a.headers || {};
  1573. a = GeoGlobe.Util.applyDefaults(a, b);
  1574. a.headers = GeoGlobe.Util.applyDefaults(a.headers, b.headers);
  1575. var b = !1,
  1576. c;
  1577. for (c in a.headers) a.headers.hasOwnProperty(c) &&
  1578. c.toLowerCase() === "x-requested-with" && (b = !0);
  1579. b === !1 && (a.headers["X-Requested-With"] = "XMLHttpRequest");
  1580. var d = new GeoGlobe.Request.XMLHttpRequest;
  1581. a.url = encodeURI(a.url);
  1582. var e = GeoGlobe.Util.urlAppend(a.url, GeoGlobe.Util.getParameterString(a.params || {}, !0)),
  1583. e = GeoGlobe.Request.makeSameOrigin(e, a.proxy);
  1584. d.open(a.method, e, a.async, a.user, a.password);
  1585. for (var f in a.headers);
  1586. var g = this;
  1587. d.onreadystatechange = function() {
  1588. d.readyState == GeoGlobe.Request.XMLHttpRequest.DONE && null !== !1 && g.runCallbacks({
  1589. request: d,
  1590. config: a,
  1591. requestUrl: e
  1592. })
  1593. };
  1594. a.async && d.setTimeout(a.timeout);
  1595. a.async === !1 ? d.send(a.data) : window.setTimeout(function() {
  1596. d.readyState !== 0 && d.send(a.data)
  1597. }, 0);
  1598. return d
  1599. },
  1600. runCallbacks: function(a) {
  1601. var b = a.request,
  1602. a = a.config,
  1603. c = a.scope ? GeoGlobe.Function.bind(a.callback, a.scope) : a.callback,
  1604. d;
  1605. a.success && (d = a.scope ? GeoGlobe.Function.bind(a.success, a.scope) : a.success);
  1606. var e;
  1607. a.failure && (e = a.scope ? GeoGlobe.Function.bind(a.failure, a.scope) : a.failure);
  1608. if (GeoGlobe.Util.createUrlObject(a.url).protocol == "file:" && b.responseText) b.status =
  1609. 200;
  1610. c(b);
  1611. (!b.status || b.status >= 200 && b.status < 300) && d && d(b);
  1612. b.status && (b.status < 200 || b.status >= 300) && e && e(b)
  1613. },
  1614. GET: function(a) {
  1615. a = GeoGlobe.Util.extend(a, {
  1616. method: "GET"
  1617. });
  1618. return GeoGlobe.Request.issue(a)
  1619. },
  1620. POST: function(a) {
  1621. a = GeoGlobe.Util.extend(a, {
  1622. method: "POST"
  1623. });
  1624. a.headers = a.headers ? a.headers : {};
  1625. "CONTENT-TYPE" in GeoGlobe.Util.upperCaseObject(a.headers) || (a.headers["Content-Type"] = "application/xml");
  1626. return GeoGlobe.Request.issue(a)
  1627. },
  1628. PUT: function(a) {
  1629. a = GeoGlobe.Util.extend(a, {
  1630. method: "PUT"
  1631. });
  1632. a.headers = a.headers ?
  1633. a.headers : {};
  1634. "CONTENT-TYPE" in GeoGlobe.Util.upperCaseObject(a.headers) || (a.headers["Content-Type"] = "application/xml");
  1635. return GeoGlobe.Request.issue(a)
  1636. },
  1637. DELETE: function(a) {
  1638. a = GeoGlobe.Util.extend(a, {
  1639. method: "DELETE"
  1640. });
  1641. return GeoGlobe.Request.issue(a)
  1642. },
  1643. HEAD: function(a) {
  1644. a = GeoGlobe.Util.extend(a, {
  1645. method: "HEAD"
  1646. });
  1647. return GeoGlobe.Request.issue(a)
  1648. },
  1649. OPTIONS: function(a) {
  1650. a = GeoGlobe.Util.extend(a, {
  1651. method: "OPTIONS"
  1652. });
  1653. return GeoGlobe.Request.issue(a)
  1654. }
  1655. });
  1656. GeoGlobe.nullHandler = function(a) {
  1657. GeoGlobe.Console.userError(GeoGlobe.i18n("unhandledRequest", {
  1658. statusText: a.statusText
  1659. }))
  1660. };
  1661. GeoGlobe.loadURL = function(a, b, c, d, e) {
  1662. typeof b == "string" && (b = GeoGlobe.Util.getParameters(b));
  1663. return GeoGlobe.Request.GET({
  1664. url: a,
  1665. params: b,
  1666. success: d ? d : GeoGlobe.nullHandler,
  1667. failure: e ? e : GeoGlobe.nullHandler,
  1668. scope: c
  1669. })
  1670. };
  1671. GeoGlobe.Request.setProxyHost = function(a) {
  1672. GeoGlobe.ProxyHost = a
  1673. };
  1674. GeoGlobe.Request.getProxyHost = function() {
  1675. return GeoGlobe.ProxyHost
  1676. };
  1677. GeoGlobe.Request.setTimeout = function(a) {
  1678. GeoGlobe.timeout = a
  1679. };
  1680. GeoGlobe.appendToProxy = function(a) {
  1681. var a = a.split("?"),
  1682. b = GeoGlobe.ProxyHost + encodeURI(encodeURI(a[0]));
  1683. a.length === 2 && (b += "?" + a[1]);
  1684. return b
  1685. };
  1686. GeoGlobe.loadScript = function(a) {
  1687. GeoGlobe.Request.GET({
  1688. url: a,
  1689. async: !1,
  1690. headers: {
  1691. Accept: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"
  1692. },
  1693. success: function(a) {
  1694. GeoGlobe.Util.globalEval(a.responseText)
  1695. },
  1696. failure: function() {
  1697. alert("\u52a0\u8f7d:" + a + " \u5931\u8d25\u3002")
  1698. }
  1699. })
  1700. };
  1701. (function() {
  1702. function a() {
  1703. this._object = f && !j ? new f : new window.ActiveXObject("Microsoft.XMLHTTP");
  1704. this._listeners = []
  1705. }
  1706. function b() {
  1707. return new a
  1708. }
  1709. function c(a) {
  1710. b.onreadystatechange && b.onreadystatechange.apply(a);
  1711. a.dispatchEvent({
  1712. type: "readystatechange",
  1713. bubbles: !1,
  1714. cancelable: !1,
  1715. timeStamp: new Date + 0
  1716. })
  1717. }
  1718. function d(a) {
  1719. try {
  1720. a.responseText = a._object.responseText
  1721. } catch (b) {}
  1722. try {
  1723. var c;
  1724. var d = a._object,
  1725. e = d.responseXML,
  1726. f = d.responseText;
  1727. if (h && f && e && !e.documentElement && d.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)) e =
  1728. new window.ActiveXObject("Microsoft.XMLDOM"), e.async = !1, e.validateOnParse = !1, e.loadXML(f);
  1729. c = e && (h && e.parseError != 0 || !e.documentElement || e.documentElement && e.documentElement.tagName == "parsererror") ? null : e;
  1730. a.responseXML = c
  1731. } catch (g) {}
  1732. try {
  1733. a.status = a._object.status
  1734. } catch (j) {}
  1735. try {
  1736. a.statusText = a._object.statusText
  1737. } catch (t) {}
  1738. }
  1739. function e(a) {
  1740. a._object.onreadystatechange = new window.Function
  1741. }
  1742. var f = window.XMLHttpRequest,
  1743. g = !!window.controllers,
  1744. h = window.document.all && !window.opera,
  1745. j = h && window.navigator.userAgent.match(/MSIE 7.0/);
  1746. b.prototype = a.prototype;
  1747. if (g && f.wrapped) b.wrapped = f.wrapped;
  1748. b.UNSENT = 0;
  1749. b.OPENED = 1;
  1750. b.HEADERS_RECEIVED = 2;
  1751. b.LOADING = 3;
  1752. b.DONE = 4;
  1753. b.prototype.readyState = b.UNSENT;
  1754. b.prototype.responseText = "";
  1755. b.prototype.responseXML = null;
  1756. b.prototype.status = 0;
  1757. b.prototype.statusText = "";
  1758. b.prototype.priority = "NORMAL";
  1759. b.prototype.onreadystatechange = null;
  1760. b.onreadystatechange = null;
  1761. b.onopen = null;
  1762. b.onsend = null;
  1763. b.onabort = null;
  1764. b.prototype.open = function(a, f, j, p, q) {
  1765. delete this._headers;
  1766. arguments.length < 3 && (j = !0);
  1767. this._async = j;
  1768. var o = this,
  1769. s = this.readyState,
  1770. r;
  1771. h && j && (r = function() {
  1772. s != b.DONE && (e(o), o.abort())
  1773. }, window.attachEvent("onunload", r));
  1774. b.onopen && b.onopen.apply(this, arguments);
  1775. arguments.length > 4 ? this._object.open(a, f, j, p, q) : arguments.length > 3 ? this._object.open(a, f, j, p) : this._object.open(a, f, j);
  1776. try {
  1777. this._object.responseType = "msxml-document"
  1778. } catch (t) {}
  1779. this.readyState = b.OPENED;
  1780. c(this);
  1781. this._object.onreadystatechange = function() {
  1782. if (!g || j) o.readyState = o._object.readyState, d(o), o._aborted ? o.readyState = b.UNSENT : (o.readyState == b.DONE && (delete o._data,
  1783. e(o), h && j && window.detachEvent("onunload", r)), s != o.readyState && c(o), s = o.readyState)
  1784. }
  1785. };
  1786. b.prototype.setTimeout = function(a) {
  1787. this._object.timeout = a
  1788. };
  1789. b.prototype.send = function(a) {
  1790. b.onsend && b.onsend.apply(this, arguments);
  1791. arguments.length || (a = null);
  1792. a && a.nodeType && (a = window.XMLSerializer ? (new window.XMLSerializer).serializeToString(a) : a.xml, this._headers["Content-Type"] || this._object.setRequestHeader("Content-Type", "application/xml"));
  1793. this._data = a;
  1794. this._object.send(this._data);
  1795. if (g && !this._async) {
  1796. this.readyState =
  1797. b.OPENED;
  1798. for (d(this); this.readyState < b.DONE;)
  1799. if (this.readyState++, c(this), this._aborted) break
  1800. }
  1801. };
  1802. b.prototype.abort = function() {
  1803. b.onabort && b.onabort.apply(this, arguments);
  1804. if (this.readyState > b.UNSENT) this._aborted = !0;
  1805. this._object.abort();
  1806. e(this);
  1807. this.readyState = b.UNSENT;
  1808. delete this._data
  1809. };
  1810. b.prototype.getAllResponseHeaders = function() {
  1811. return this._object.getAllResponseHeaders()
  1812. };
  1813. b.prototype.getResponseHeader = function(a) {
  1814. return this._object.getResponseHeader(a)
  1815. };
  1816. b.prototype.setRequestHeader = function(a, b) {
  1817. if (!this._headers) this._headers = {};
  1818. this._headers[a] = b;
  1819. return this._object.setRequestHeader(a, b)
  1820. };
  1821. b.prototype.addEventListener = function(a, b, c) {
  1822. for (var d = 0, e; e = this._listeners[d]; d++)
  1823. if (e[0] == a && e[1] == b && e[2] == c) return;
  1824. this._listeners.push([a, b, c])
  1825. };
  1826. b.prototype.removeEventListener = function(a, b, c) {
  1827. for (var d = 0, e; e = this._listeners[d]; d++)
  1828. if (e[0] == a && e[1] == b && e[2] == c) break;
  1829. e && this._listeners.splice(d, 1)
  1830. };
  1831. b.prototype.dispatchEvent = function(a) {
  1832. a = {
  1833. type: a.type,
  1834. target: this,
  1835. currentTarget: this,
  1836. eventPhase: 2,
  1837. bubbles: a.bubbles,
  1838. cancelable: a.cancelable,
  1839. timeStamp: a.timeStamp,
  1840. stopPropagation: function() {},
  1841. preventDefault: function() {},
  1842. initEvent: function() {}
  1843. };
  1844. a.type == "readystatechange" && this.onreadystatechange && (this.onreadystatechange.handleEvent || this.onreadystatechange).apply(this, [a]);
  1845. for (var b = 0, c; c = this._listeners[b]; b++) c[0] == a.type && !c[2] && (c[1].handleEvent || c[1]).apply(this, [a])
  1846. };
  1847. b.prototype.toString = function() {
  1848. return "[object XMLHttpRequest]"
  1849. };
  1850. b.toString = function() {
  1851. return "[XMLHttpRequest]"
  1852. };
  1853. if (!window.Function.prototype.apply) window.Function.prototype.apply =
  1854. function(a, b) {
  1855. b || (b = []);
  1856. a.__func = this;
  1857. a.__func(b[0], b[1], b[2], b[3], b[4]);
  1858. delete a.__func
  1859. };
  1860. if (!GeoGlobe.Request) GeoGlobe.Request = {};
  1861. GeoGlobe.Request.XMLHttpRequest = b
  1862. })();
  1863. GeoGlobe.Map = GeoGlobe.Class(mapboxgl.FreeCRSMap, {
  1864. is3Dpitching: !1,
  1865. pitch3Dzoom: 16,
  1866. skipLevelOfZooming: !1,
  1867. units: null,
  1868. initialize: function(a) {
  1869. a = GeoGlobe.Util.extend(GeoGlobe.Util.pick2(a, "is"), a);
  1870. a = GeoGlobe.Util.extend({
  1871. intScrollZoom: !0,
  1872. attributionControl: !1,
  1873. preserveDrawingBuffer: !0
  1874. }, a);
  1875. if (typeof a.style !== "string") a.style = GeoGlobe.Util.merge2Obj({
  1876. version: 8,
  1877. glyphs: "mapbox://fonts/mapbox/{fontstack}/{range}.pbf",
  1878. sources: {},
  1879. layers: []
  1880. }, a.style);
  1881. var b = new mapboxgl.FreeCRSMap(a),
  1882. a = GeoGlobe.Util.extend({
  1883. units: "degrees",
  1884. isConstrain: !1,
  1885. is3Dpitching: !1,
  1886. pitch3Dzoom: 16
  1887. }, GeoGlobe.Util.pick(a, ["units", "isConstrain", "is3Dpitching", "pitch3Dzoom"]));
  1888. a.isConstrain === !0 && b.setIsConstrain(a.isConstrain);
  1889. b.pitch3Dzoom = a.pitch3Dzoom;
  1890. b.setIs3DPZoom(a.is3Dpitching);
  1891. if (b.units !== a.units) b.units = a.units;
  1892. return b
  1893. },
  1894. CLASS_NAME: "GeoGlobe.Map"
  1895. });
  1896. mapboxgl.accessToken = "pk.eyJ1IjoiamFrZWpvdWUiLCJhIjoiY2p2M2dneXJ3MTI3ZjQzcDkwcTk0azg3ZyJ9.KpuPwDUSsQKf2Qs7mu7bww";
  1897. mapboxgl.FreeCRSMap.prototype.setGlyphs = function(a) {
  1898. this.style.setGlyphs(a)
  1899. };
  1900. mapboxgl.FreeCRSMap.prototype.loadSprite = function(a, b) {
  1901. this.style.loadSprite(a, b)
  1902. };
  1903. mapboxgl.FreeCRSMap.prototype.removeAllImages = function() {
  1904. var a = this.style.imageManager,
  1905. b;
  1906. for (b in a.images) a.removeImage(b)
  1907. };
  1908. mapboxgl.FreeCRSMap.prototype.setIs3DPZoom = function(a) {
  1909. if (a) this.on("zoom", this.setZoompitch);
  1910. else this.off("zoom", this.setZoompitch)
  1911. };
  1912. mapboxgl.FreeCRSMap.prototype.set3Dzoom = function(a) {
  1913. if (a) this.pitch3Dzoom = a
  1914. };
  1915. mapboxgl.FreeCRSMap.prototype.setZoompitch = function() {
  1916. var a = this.getZoom(),
  1917. b = this.pitch3Dzoom;
  1918. parseInt(a) == b && this.setPitch(60)
  1919. };
  1920. mapboxgl.FreeCRSMap.prototype.setIsConstrain = function(a) {
  1921. this.isConstrain = a;
  1922. this.transform._constraining = !this.isConstrain
  1923. };
  1924. mapboxgl.FreeCRSMap.prototype.addCanvasLayer = function(a) {
  1925. a.addTo(this)
  1926. };
  1927. mapboxgl.FreeCRSMap.prototype.removeCanvasLayer = function(a) {
  1928. a.remove()
  1929. };
  1930. mapboxgl.FreeCRSMap.prototype.getLayer = function(a) {
  1931. var b = this.style.getLayer(a);
  1932. if (!b && this._visuals)
  1933. for (var c = 0; c < this._visuals.length; c++)
  1934. if (b = this._visuals[c].getLayer(a)) break;
  1935. return b
  1936. };
  1937. mapboxgl.FreeCRSMap.prototype.addLayer = function(a, b) {
  1938. a.layerType && ["VTS", "VVTS", "ArcgisVTS"].indexOf(a.layerType) !== -1 && !(a instanceof GeoGlobe.Layer) && (a = new GeoGlobe.Layer(a));
  1939. if (a instanceof GeoGlobe.Layer) a.onAdd(this, b);
  1940. else return this.style.addLayer(a, b), this._update(!0), this
  1941. };
  1942. mapboxgl.FreeCRSMap.prototype.addLayers = function(a, b) {
  1943. if (a.length > 0)
  1944. for (var c = 0; c < a.length; c++) this.addLayer(a[c], b)
  1945. };
  1946. mapboxgl.FreeCRSMap.prototype.moveLayer = function(a, b) {
  1947. var c = this.getLayer(a),
  1948. d = this.getLayer(b);
  1949. if (c)
  1950. if (b && !d) this.fire("error", {
  1951. error: Error("\u56fe\u5c42'" + b + "'\u4e0d\u5b58\u5728\u3002")
  1952. });
  1953. else if (!c._parent && (!d || !d._parent)) return this.style.moveLayer(a, b), this._update(!0), this;
  1954. else if (c._parent && (!d || d._parent))
  1955. if (!d || c._parent.type === d._parent.type) return c._parent.moveLayer(a, b), this;
  1956. else this.fire("error", {
  1957. error: Error("\u6682\u4e0d\u652f\u6301\u4e0d\u540c\u7c7b\u522b\u53ef\u89c6\u5316\u56fe\u5c42\u95f4\u7684\u79fb\u52a8\u3002")
  1958. });
  1959. else this.fire("error", {
  1960. error: Error("\u6682\u4e0d\u652f\u6301mapbox\u56fe\u5c42\u4e0e\u53ef\u89c6\u5316\u56fe\u5c42\u95f4\u7684\u79fb\u52a8\u3002")
  1961. });
  1962. else this.fire("error", {
  1963. error: Error(a ? "\u56fe\u5c42'" + a + "'\u4e0d\u5b58\u5728\uff0c\u56e0\u6b64\u4e0d\u80fd\u88ab\u79fb\u52a8\u3002" : "\u56fe\u5c42ID\u4e0d\u80fd\u4e3a\u7a7a\u3002")
  1964. })
  1965. };
  1966. mapboxgl.FreeCRSMap.prototype.removeLayer = function(a) {
  1967. if (a instanceof GeoGlobe.Layer) a.onRemove();
  1968. else {
  1969. var b = this.getLayer(a);
  1970. if (b) return b._parent ? b._parent.removeLayer(a) : (this.style.removeLayer(a), this._update(!0)), this;
  1971. else this.fire("error", {
  1972. error: Error(a ? "\u56fe\u5c42'" + a + "'\u4e0d\u5b58\u5728\uff0c\u56e0\u6b64\u4e0d\u80fd\u88ab\u79fb\u9664\u3002" : "\u56fe\u5c42ID\u4e0d\u80fd\u4e3a\u7a7a\u3002")
  1973. })
  1974. }
  1975. };
  1976. mapboxgl.FreeCRSMap.prototype.removeLayers = function(a) {
  1977. if (a.length > 0)
  1978. for (var b = 0; b < a.length; b++) this.removeLayer(a[b])
  1979. };
  1980. mapboxgl.FreeCRSMap.prototype.removeLayerAndSource = function(a) {
  1981. if (this.getLayer(a)) this.removeLayer(a), this.removeSource(a);
  1982. else throw Error("Layer not found");
  1983. };
  1984. mapboxgl.FreeCRSMap.prototype.removeAllLayers = function() {
  1985. var a = this.style._layers,
  1986. b;
  1987. for (b in a) this.removeLayer(b)
  1988. };
  1989. mapboxgl.FreeCRSMap.prototype.removeAllSources = function() {
  1990. var a = this.style.sourceCaches,
  1991. b;
  1992. for (b in a) this.removeSource(b)
  1993. };
  1994. mapboxgl.FreeCRSMap.prototype.getLayerContainer = function(a) {
  1995. for (var b = 0; b < this.eleContainer.childNodes.length; b++)
  1996. if (a === this.eleContainer.childNodes[b].className) return this.eleContainer.childNodes[b]
  1997. };
  1998. mapboxgl.FreeCRSMap.prototype.moveLayerContainer = function(a, b) {
  1999. if (this.getLayerContainer(a)) {
  2000. var c = [];
  2001. this.eleContainer.childNodes.forEach(function(a) {
  2002. c.push(a.className)
  2003. });
  2004. var d = c.indexOf(a);
  2005. c.splice(d, 1);
  2006. d = b ? c.indexOf(b) : c.length;
  2007. if (b && d === -1) this.fire("error", {
  2008. error: Error('layer_container with id "' + b + '" does not exist on this map.')
  2009. });
  2010. else {
  2011. c.splice(d, 0, a);
  2012. for (d = 0; d < c.length; d++)
  2013. for (var e = 0; e < this.eleContainer.childNodes.length; e++)
  2014. if (c[d] === this.eleContainer.childNodes[e].className) this.eleContainer.childNodes[e].style.zIndex =
  2015. d
  2016. }
  2017. } else this.fire("error", {
  2018. error: Error("The layer_container '" + a + "' does not exist in the map's style and cannot be moved.")
  2019. })
  2020. };
  2021. mapboxgl.FreeCRSMap.prototype.addWidget = function(a, b) {
  2022. a.onAdd(this, b)
  2023. };
  2024. mapboxgl.FreeCRSMap.prototype.removeWidget = function(a) {
  2025. a.onRemove(null)
  2026. };
  2027. mapboxgl.FreeCRSMap.prototype.getResolutions = function() {
  2028. for (var a = [], b = 0; b <= 20; b++) a.push(this.getResolutionForLevel(b));
  2029. return a
  2030. };
  2031. mapboxgl.FreeCRSMap.prototype.getResolutionForLevel = function(a, b) {
  2032. var c = Math.abs(this._tileExtent[2] - this._tileExtent[0]);
  2033. c === 360 && (c = 4.00750166855784E7);
  2034. return c / (b || 256) / Math.pow(2, a)
  2035. };
  2036. mapboxgl.FreeCRSMap.prototype.addLayerGroup = function(a, b, c) {
  2037. if (!GeoGlobe.Util.isArray(a)) throw Error("\u53c2\u6570 ${layerArr} \u7c7b\u578b\u9519\u8bef.");
  2038. a.push({
  2039. id: "GeoGlobe" + b,
  2040. source: {
  2041. type: "geojson",
  2042. data: {
  2043. type: "FeatureCollection",
  2044. features: []
  2045. }
  2046. },
  2047. type: "circle"
  2048. });
  2049. for (var d = this.getStyle().layers, e = 0; e < d.length; e++)
  2050. if (d[e].metadata && d[e].metadata.group === b) return !1;
  2051. mapboxgl.LayerGroup.addGroup(this, b, a, c)
  2052. };
  2053. mapboxgl.FreeCRSMap.prototype.removeLayerGroup = function(a) {
  2054. for (var b = this.getStyle().layers, c = 0; c < b.length; c++) b[c].metadata && b[c].metadata.group === a && this.removeLayer(b[c].id);
  2055. this.removeLayer("GeoGlobe" + a)
  2056. };
  2057. mapboxgl.FreeCRSMap.prototype.removeLayerFromGroup = function(a, b) {
  2058. for (var c = this.getStyle().layers, d = 0; d < c.length; d++) c[d].metadata && c[d].metadata.group === b && c[d].id == a && this.removeLayer(c[d].id)
  2059. };
  2060. mapboxgl.FreeCRSMap.prototype.addLayerToGroup = function(a, b) {
  2061. if (!this.getLayer(a.id))
  2062. for (var c = this.getStyle().layers, d = 0; d < c.length; d++)
  2063. if (c[d].metadata && c[d].metadata.group === b) {
  2064. if (a.layers) {
  2065. var c = a.layers,
  2066. e;
  2067. for (e in c) c[e].metadata = c[e].metadata || {}, c[e].metadata.group = b
  2068. } else a.metadata = a.metadata || {}, a.metadata.group = b;
  2069. this.addLayer(a, "GeoGlobe" + b);
  2070. break
  2071. }
  2072. };
  2073. mapboxgl.FreeCRSMap.prototype.moveGroup = function(a, b) {
  2074. this.getStyle();
  2075. var c = mapboxgl.LayerGroup.getLayersfromGroup(this, a),
  2076. d = mapboxgl.LayerGroup.getLayersfromGroup(this, b);
  2077. if (c.length == 0) this.fire("error", {
  2078. error: Error(a ? "\u56fe\u5c42\u7ec4'" + a + "'\u4e0d\u5b58\u5728\uff0c\u56e0\u6b64\u4e0d\u80fd\u88ab\u79fb\u52a8\u3002" : "\u56fe\u5c42\u7ec4ID\u4e0d\u80fd\u4e3a\u7a7a\u3002")
  2079. });
  2080. else if (d.length == 0) this.fire("error", {
  2081. error: Error(b ? "\u56fe\u5c42\u7ec4'" + b + "'\u4e0d\u5b58\u5728\uff0c\u56e0\u6b64\u4e0d\u80fd\u88ab\u79fb\u52a8\u3002" :
  2082. "\u56fe\u5c42\u7ec4ID\u4e0d\u80fd\u4e3a\u7a7a\u3002")
  2083. });
  2084. else
  2085. for (var e = 0; e < c.length; e++) this.moveLayer(c[e].id, d[0].id)
  2086. };
  2087. mapboxgl.FreeCRSMap.prototype.moveLayerInGroup = function(a, b) {
  2088. var c = this.getLayer(a),
  2089. d = this.getLayer(b);
  2090. c ? d ? c.metadata != null && d.metadata != null && c.metadata.group === d.metadata.group ? this.moveLayer(a, b) : this.fire("error", {
  2091. error: Error(a + "\u56fe\u5c42\u548c" + b + "\u56fe\u5c42\u4e0d\u5c5e\u4e8e\u540c\u4e00\u7ec4\u3002")
  2092. }) : this.fire("error", {
  2093. error: Error(b ? "\u56fe\u5c42'" + b + "'\u4e0d\u5b58\u5728\uff0c\u56e0\u6b64\u4e0d\u80fd\u88ab\u79fb\u52a8\u3002" : "\u56fe\u5c42ID\u4e0d\u80fd\u4e3a\u7a7a\u3002")
  2094. }) : this.fire("error", {
  2095. error: Error(a ? "\u56fe\u5c42'" + a + "'\u4e0d\u5b58\u5728\uff0c\u56e0\u6b64\u4e0d\u80fd\u88ab\u79fb\u52a8\u3002" : "\u56fe\u5c42ID\u4e0d\u80fd\u4e3a\u7a7a\u3002")
  2096. })
  2097. };
  2098. mapboxgl.FreeCRSMap.prototype.getLayersfromGroup = function(a) {
  2099. for (var b = mapboxgl.LayerGroup.getLayersfromGroup(this, a), c = 0; c < b.length; c++)
  2100. if (b[c].id === "GeoGlobe" + a) {
  2101. b.splice(c, 1);
  2102. break
  2103. }
  2104. return b
  2105. };
  2106. mapboxgl.FreeCRSMap.prototype.clearGroup = function(a) {
  2107. for (var a = this.getLayersfromGroup(a), b = 0; b < a.length; b++) this.removeLayer(a[b].id)
  2108. };
  2109. mapboxgl.FreeCRSMap.prototype.showLayer = function(a) {
  2110. if (!this.getLayer(a)) throw Error(a + " Layer not found");
  2111. this.setLayoutProperty(a, "visibility", "visible")
  2112. };
  2113. mapboxgl.FreeCRSMap.prototype.hideLayer = function(a) {
  2114. if (!this.getLayer(a)) throw Error(a + " Layer not found");
  2115. this.setLayoutProperty(a, "visibility", "none")
  2116. };
  2117. mapboxgl.FreeCRSMap.prototype.setOpacity = function(a, b) {
  2118. var c = this.getLayer(a);
  2119. if (!c) throw Error(a + " Layer not found");
  2120. if (typeof b != "number") throw Error(b + " must be number");
  2121. this.setPaintProperty(a, c.type + "-opacity", b)
  2122. };
  2123. GeoGlobe.LngLatBounds = mapboxgl.LngLatBounds;
  2124. mapboxgl.LngLatBounds.prototype.clone = function() {
  2125. return new mapboxgl.LngLatBounds(this._sw, this._ne)
  2126. };
  2127. mapboxgl.LngLatBounds.prototype.contains = function(a, b, c) {
  2128. c == null && (c = !0);
  2129. if (a == null || b == null) return !1;
  2130. var a = GeoGlobe.Util.toFloat(a),
  2131. b = GeoGlobe.Util.toFloat(b),
  2132. d = !1;
  2133. return d = c ? a >= this._sw.lng && a <= this._ne.lng && b >= this._sw.lat && b <= this._ne.lat : a > this._sw.lng && a < this._ne.lng && b > this._sw.lat && b < this._ne.lat
  2134. };
  2135. mapboxgl.LngLatBounds.prototype.getWidth = function() {
  2136. return this._ne.lng - this._sw.lng
  2137. };
  2138. mapboxgl.LngLatBounds.prototype.containsLonLat = function(a, b) {
  2139. typeof b === "boolean" && (b = {
  2140. inclusive: b
  2141. });
  2142. var b = b || {},
  2143. c = this.contains(a.lng, a.lat, b.inclusive),
  2144. d = b.worldBounds;
  2145. d && !c && (c = d.getWidth(), c = this.containsLonLat({
  2146. lng: a.lng - Math.round((a.lng - (d._sw.lng + d._ne.lng) / 2) / c) * c,
  2147. lat: a.lat
  2148. }, {
  2149. inclusive: b.inclusive
  2150. }));
  2151. return c
  2152. };
  2153. mapboxgl.LngLatBounds.prototype.equals = function(a) {
  2154. var b = !1;
  2155. a != null && (b = this._sw.lng == a._sw.lng && this._ne.lng == a._ne.lng && this._ne.lat == a._ne.lat && this._sw.lat == a._sw.lat);
  2156. return b
  2157. };
  2158. mapboxgl.LngLatBounds.prototype.toBBOX = function(a, b) {
  2159. a == null && (a = 6);
  2160. var c = Math.pow(10, a),
  2161. d = Math.round(this._sw.lng * c) / c,
  2162. e = Math.round(this._sw.lat * c) / c,
  2163. f = Math.round(this._ne.lng * c) / c,
  2164. c = Math.round(this._ne.lat * c) / c;
  2165. return b === !0 ? e + "," + d + "," + c + "," + f : d + "," + e + "," + f + "," + c
  2166. };
  2167. mapboxgl.LngLatBounds.prototype.toGeometry = function() {
  2168. return new GeoGlobe.Geometry.Polygon([new GeoGlobe.Geometry.LinearRing([new GeoGlobe.Geometry.Point(this._sw.lng, this._sw.lat), new GeoGlobe.Geometry.Point(this._ne.lng, this._sw.lat), new GeoGlobe.Geometry.Point(this._ne.lng, this._ne.lat), new GeoGlobe.Geometry.Point(this._sw.lng, this._ne.lat)])])
  2169. };
  2170. mapboxgl.LngLatBounds.prototype.getCenterLonLat = function() {
  2171. if (!this.centerLonLat) this.centerLonLat = new GeoGlobe.LngLat((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2);
  2172. return this.centerLonLat
  2173. };
  2174. mapboxgl.LngLatBounds.prototype.CLASS_NAME = "GeoGlobe.LngLatBounds";
  2175. GeoGlobe.LngLatBounds.fromString = function(a, b) {
  2176. var c = a.split(",");
  2177. return GeoGlobe.LngLatBounds.fromArray(c, b)
  2178. };
  2179. GeoGlobe.LngLatBounds.fromArray = function(a, b) {
  2180. return b === !0 ? new GeoGlobe.LngLatBounds(new GeoGlobe.LngLat(a[1], a[0]), new GeoGlobe.LngLat(a[3], a[2])) : new GeoGlobe.LngLatBounds(new GeoGlobe.LngLat(a[0], a[1]), new GeoGlobe.LngLat(a[2], a[3]))
  2181. };
  2182. GeoGlobe.LngLatBounds.toGeometryByTwoPixel = function(a, b, c) {
  2183. for (var a = [mapboxgl.Point.convert(a), mapboxgl.Point.convert(b)], a = [a[0], new mapboxgl.Point(a[1].x, a[0].y), a[1], new mapboxgl.Point(a[0].x, a[1].y)], b = [], d = 0; d < a.length; d++) {
  2184. var e = c.unproject(a[d]),
  2185. e = new GeoGlobe.Geometry.Point(e.lng, e.lat);
  2186. b.push(e)
  2187. }
  2188. return new GeoGlobe.Geometry.Polygon([new GeoGlobe.Geometry.LinearRing(b)])
  2189. };
  2190. GeoGlobe.LngLat = mapboxgl.LngLat;
  2191. GeoGlobe.Layer = GeoGlobe.Class({
  2192. map: null,
  2193. source_id: null,
  2194. source: null,
  2195. sources: null,
  2196. layer: null,
  2197. layers: null,
  2198. initialize: function(a) {
  2199. GeoGlobe.Util.extend(this, a)
  2200. },
  2201. onAdd: function(a, b) {
  2202. if (a)
  2203. if (this.map = a, this.addTo) this.addTo(a, b);
  2204. else {
  2205. this.source_id && this.source && a.addSource(this.source_id, this.source);
  2206. if (this.sources)
  2207. for (var c in this.sources) a.addSource(c, this.sources[c]);
  2208. this.layer && a.addLayer(this.layer, b);
  2209. this.layers && a.addLayers(this.layers, b)
  2210. }
  2211. },
  2212. onRemove: function() {
  2213. var a = this.map;
  2214. if (a)
  2215. if (delete this.map,
  2216. this.destroy) this.destroy();
  2217. else if (this.layer && a.removeLayer(this.layer.id), this.layers && a.removeLayers(this.layers.map(function(a) {
  2218. return a.id
  2219. })), this.source_id && this.source && a.removeSource(this.source_id), this.sources)
  2220. for (var b in this.sources) a.removeSource(b)
  2221. },
  2222. CLASS_NAME: "GeoGlobe.Layer"
  2223. });
  2224. GeoGlobe.Layer.WMTS = GeoGlobe.Class4OL({
  2225. url: null,
  2226. layer: null,
  2227. name: null,
  2228. format: null,
  2229. matrixSet: null,
  2230. style: null,
  2231. zoomOffset: null,
  2232. initialize: function(a) {
  2233. return this._getWMTSLayer(a)
  2234. },
  2235. _getWMTSLayer: function(a) {
  2236. var b = GeoGlobe.Util.pick(a, ["layer", "format", "version", "style"], !0);
  2237. if (a.matrixSet) b.TILEMATRIXSET = a.matrixSet;
  2238. GeoGlobe.Util.applyDefaults(b, {
  2239. service: "WMTS",
  2240. request: "GetTile",
  2241. TILEMATRIX: "{z}",
  2242. TILEROW: "{y}",
  2243. TILECOL: "{x}"
  2244. });
  2245. b = GeoGlobe.Util.urlAppend(a.url, GeoGlobe.Util.getParameterString(b || {}));
  2246. b = GeoGlobe.appendToProxy(b);
  2247. b.indexOf("tianditu") !== -1 && (b += "&tk=" + (a.token || "e90d56e5a09d1767899ad45846b0cefd"));
  2248. var c = "wmts_" + a.layer + "_" + GeoGlobe.Util.randomStr(8);
  2249. if (!a.zoomOffset) a.zoomOffset = 0;
  2250. if (a.noFadingParent === void 0) a.noFadingParent = !0;
  2251. return {
  2252. id: c,
  2253. type: "raster",
  2254. source: {
  2255. type: "raster",
  2256. tiles: [b],
  2257. tileSize: 256,
  2258. zoomOffset: a.zoomOffset,
  2259. noFadingParent: a.noFadingParent
  2260. }
  2261. }
  2262. },
  2263. CLASS_NAME: "GeoGlobe.Layer.WMTS"
  2264. });
  2265. GeoGlobe.Layer.WMS = GeoGlobe.Class4OL(GeoGlobe.Layer, {
  2266. url: null,
  2267. layer: null,
  2268. format: null,
  2269. version: null,
  2270. width: 256,
  2271. height: 256,
  2272. SRS: null,
  2273. initialize: function(a) {
  2274. if (a.isTile != void 0 && a.isTile === !1) this.layerOption = this._getWMSLayer(a);
  2275. else return this._getWMSTileLayer(a)
  2276. },
  2277. addTo: function(a, b) {
  2278. this.map = a;
  2279. this.move = GeoGlobe.Function.bind(GeoGlobe.Util.delayFun(this.moveend, 300), this);
  2280. this.map.on("moveend", this.move);
  2281. this.width = a.getCanvas().width;
  2282. this.height = a.getCanvas().height;
  2283. var c = a.getBounds(),
  2284. d = c._ne.lng,
  2285. e = c._ne.lat,
  2286. f = c._sw.lng,
  2287. c = c._sw.lat;
  2288. this.layerOption.source.url = this.layerOption.source.url.replace("{bbox}", f + "," + c + "," + d + "," + e).replace("{width}", this.width).replace("{height}", this.height);
  2289. this.layerOption.source.coordinates = [
  2290. [f, e],
  2291. [d, e],
  2292. [d, c],
  2293. [f, c]
  2294. ];
  2295. a.addLayer(this.layerOption, b)
  2296. },
  2297. _getWMSLayer: function(a) {
  2298. a.transparent || a.transparent === !1 ? this.options.transparent = a.transparent : a.transparent = !0;
  2299. this.options = a;
  2300. this.url = a.url;
  2301. var b = this.getParamString({
  2302. SERVICE: "WMS",
  2303. REQUEST: "GetMap",
  2304. VERSION: a.version,
  2305. LAYERS: a.layer,
  2306. styles: a.styles,
  2307. FORMAT: a.format,
  2308. TRANSPARENT: a.transparent,
  2309. BBOX: "{bbox}",
  2310. WIDTH: "{width}",
  2311. HEIGHT: "{height}",
  2312. SRS: a.SRS
  2313. }),
  2314. c = "",
  2315. c = this.url.endsWith("?") || this.url.endsWith("&") ? this.url + b : this.url + "?" + b,
  2316. c = GeoGlobe.appendToProxy(c),
  2317. b = GeoGlobe.Util.randomStr(10),
  2318. d = {
  2319. name: a.layer,
  2320. srs: a.SRS,
  2321. type: "wms",
  2322. isTile: a.isTile,
  2323. format: a.formats
  2324. };
  2325. this.id = "layer_" + a.layer + "_" + b;
  2326. return {
  2327. id: this.id,
  2328. source: {
  2329. type: "image",
  2330. url: c,
  2331. coordinates: []
  2332. },
  2333. metadata: d,
  2334. type: "raster"
  2335. }
  2336. },
  2337. _getWMSTileLayer: function(a) {
  2338. var b = {};
  2339. if (a.layer) b.LAYERS =
  2340. a.layer;
  2341. if (a.format) b.FORMAT = a.format;
  2342. b.TRANSPARENT = a.transparent || a.transparent === !1 ? a.transparent : !0;
  2343. if (a.styles) b.styles = a.styles;
  2344. if (!a.tileSize) a.tileSize = 256;
  2345. b.HEIGHT = a.tileSize;
  2346. b.WIDTH = a.tileSize;
  2347. if (a.version) b.VERSION = a.version;
  2348. if (a.SRS) b.SRS = a.SRS;
  2349. b.BBOX = "{bbox-epsg-3857}";
  2350. GeoGlobe.Util.applyDefaults(b, {
  2351. service: "WMS",
  2352. request: "GetMap"
  2353. });
  2354. var c = {
  2355. name: a.layer,
  2356. srs: a.SRS,
  2357. bbox: a.bbox,
  2358. format: a.format
  2359. },
  2360. d = "wms_" + a.layer + "_" + GeoGlobe.Util.randomStr(8),
  2361. b = GeoGlobe.Util.urlAppend(a.url, GeoGlobe.Util.getParameterString(b || {})),
  2362. b = GeoGlobe.appendToProxy(b);
  2363. return {
  2364. id: d,
  2365. type: "raster",
  2366. source: {
  2367. type: "raster",
  2368. tiles: [b],
  2369. tileSize: a.tileSize
  2370. },
  2371. metadata: c
  2372. }
  2373. },
  2374. moveend: function() {
  2375. if (this.map.style._layers[this.id] && (this.map.style._layers[this.id].layout && this.map.style._layers[this.id].layout.visibility != "none" || this.map.style._layers[this.id].visibility && this.map.style._layers[this.id].visibility != "none")) {
  2376. var a = this.map.getBounds(),
  2377. b = a._ne.lng,
  2378. c = a._ne.lat,
  2379. d = a._sw.lng,
  2380. e = a._sw.lat,
  2381. a = d + "," + e + "," + b + "," + c;
  2382. this.width = this.map.getCanvas().width;
  2383. this.height = this.map.getCanvas().height;
  2384. var f = GeoGlobe.Util.getParameterString({
  2385. SERVICE: "WMS",
  2386. REQUEST: "GetMap",
  2387. VERSION: this.options.version,
  2388. LAYERS: this.options.layer,
  2389. styles: this.options.styles,
  2390. FORMAT: this.options.format,
  2391. TRANSPARENT: this.options.transparent,
  2392. BBOX: a,
  2393. WIDTH: this.width,
  2394. HEIGHT: this.height,
  2395. SRS: this.options.SRS
  2396. }),
  2397. a = "",
  2398. a = this.url.endsWith("?") || url.endsWith("&") ? this.url + f : this.url + "?" + f,
  2399. a = GeoGlobe.appendToProxy(a),
  2400. b = [
  2401. [d, c],
  2402. [b, c],
  2403. [b, e],
  2404. [d, e]
  2405. ],
  2406. c = this.map.getSource(this.id);
  2407. c.url = a;
  2408. c.options.url =
  2409. a;
  2410. c.coordinates = b;
  2411. c.options.coordinates = b;
  2412. c.isReload = !0;
  2413. c.load()
  2414. }
  2415. },
  2416. clone: function(a) {
  2417. a == null && (a = new GeoGlobe.Layer.WMS(this.id, this.tileSize, this.filter, this.opacity, this.visible, this.name, this.url));
  2418. return a
  2419. },
  2420. getParamString: function(a) {
  2421. var b = [],
  2422. c;
  2423. for (c in a) {
  2424. var d = a[c];
  2425. d != null && typeof d != "function" && b.push(c + "=" + d)
  2426. }
  2427. return b.join("&")
  2428. },
  2429. CLASS_NAME: "GeoGlobe.Layer.WMS"
  2430. });
  2431. GeoGlobe.Layer.VTS = GeoGlobe.Class4OL(GeoGlobe.Layer, {
  2432. url: null,
  2433. layer: null,
  2434. format: null,
  2435. matrixSet: null,
  2436. style: null,
  2437. name: null,
  2438. resolutions: null,
  2439. zoomOffset: null,
  2440. matrixIds: null,
  2441. tileOrigin: null,
  2442. tileFullExtent: null,
  2443. initialize: function(a) {
  2444. this.source_id = "source_vts_" + GeoGlobe.Util.randomStr(6);
  2445. this.layers = this._getVTSLayer(a);
  2446. this.source = {
  2447. type: "vector",
  2448. tiles: [this.url_tmpl]
  2449. }
  2450. },
  2451. _getVTSLayer: function(a) {
  2452. this.url = a.url;
  2453. var b = {};
  2454. if (a.layer) b.LAYER = a.layer;
  2455. if (a.format) b.FORMAT = a.format;
  2456. if (a.matrixSet) b.TILEMATRIXSET =
  2457. a.matrixSet;
  2458. if (a.version) b.VERSION = a.version;
  2459. if (a.tileSize) b.WIDTH = a.tileSize, b.HEIGHT = a.tileSize;
  2460. GeoGlobe.Util.applyDefaults(b, {
  2461. service: "WMTS",
  2462. request: "GetTile",
  2463. TILEMATRIX: "{z}",
  2464. TILEROW: "{y}",
  2465. TILECOL: "{x}"
  2466. });
  2467. var c = GeoGlobe.ProxyHost + GeoGlobe.Util.urlAppend(a.url, GeoGlobe.Util.getParameterString(b || {}));
  2468. this.url_tmpl = c;
  2469. var d = [],
  2470. e = this;
  2471. this.GetStyle(a.styleName, function(c) {
  2472. var g = c.sprite ? GeoGlobe.ProxyHost + c.sprite : "",
  2473. h = c.glyphs ? GeoGlobe.ProxyHost + c.glyphs : "";
  2474. e.sprite = g;
  2475. e.glyphs = h;
  2476. g = {
  2477. sprite: g,
  2478. glyphs: h,
  2479. styleName: c.name,
  2480. layerIdentifier: b.LAYER,
  2481. matrixSet: b.TILEMATRIXSET,
  2482. format: b.FORMAT,
  2483. bbox: a.tileBBox ? a.tileBBox : "",
  2484. minZoom: a.minZoom ? a.minZoom : "",
  2485. maxZoom: a.maxZoom ? a.maxZoom : ""
  2486. };
  2487. if (c.styleData)
  2488. for (h = 0; h < c.styleData.layers.length; h++) c.styleData.layers[h].metadata = g, c.styleData.layers[h].source = e.source_id, d[h] = c.styleData.layers[h];
  2489. else
  2490. for (h = 0; h < c.layers.length; h++) c.layers[h].source = e.source_id, c.layers[h].metadata = g, d[h] = c.layers[h]
  2491. }, function() {
  2492. alert("WMTS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" +
  2493. c + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  2494. });
  2495. return d
  2496. },
  2497. GetStyle: function(a, b, c) {
  2498. var d = this.url;
  2499. if (a == "" || a == void 0) alert("\u8bf7\u67e5\u770b\u6837\u5f0f\u540d\u79f0\u662f\u5426\u5b58\u5728");
  2500. else {
  2501. var e = {
  2502. REQUEST: "GetStyle",
  2503. SERVICE: "WMTS",
  2504. VERSION: "1.0.0",
  2505. STYLENAME: a
  2506. };
  2507. c || (c = function() {
  2508. this.failFn(e.REQUEST)
  2509. });
  2510. GeoGlobe.Request.GET({
  2511. url: d,
  2512. params: e,
  2513. scope: this,
  2514. async: !1,
  2515. success: function(a) {
  2516. a = a.responseText;
  2517. if (!a) return c(), !1;
  2518. a = (new GeoGlobe.Format.JSON).read(a);
  2519. b(a)
  2520. },
  2521. failure: c
  2522. })
  2523. }
  2524. },
  2525. clone: function(a) {
  2526. a ==
  2527. null && (a = new GeoGlobe.Layer.VTS(this.id, this.tileSize, this.filter, this.opacity, this.visible, this.name, this.url));
  2528. return a
  2529. },
  2530. getMatrix: function() {
  2531. var a;
  2532. if (!this.matrixIds || this.matrixIds.length === 0) a = {
  2533. identifier: this.getIdentifier()
  2534. };
  2535. else if ("scaleDenominator" in this.matrixIds[0])
  2536. for (var b = GeoGlobe.METERS_PER_INCH * GeoGlobe.INCHES_PER_UNIT[this.units] * this.getServerResolution() / 2.8E-4, c = Number.POSITIVE_INFINITY, d, e = 0, f = this.matrixIds.length; e < f; ++e) d = Math.abs(1 - this.matrixIds[e].scaleDenominator / b),
  2537. d < c && (c = d, a = this.matrixIds[e]);
  2538. else a = this.matrixIds[this.getIdentifier()];
  2539. return a
  2540. },
  2541. CLASS_NAME: "GeoGlobe.Layer.VTS"
  2542. });
  2543. GeoGlobe.Layer.ArcgisVTS = GeoGlobe.Class4OL(GeoGlobe.Layer, {
  2544. url: null,
  2545. sprite: null,
  2546. glyphs: null,
  2547. sources: {},
  2548. layers: [],
  2549. initialize: function(a) {
  2550. this.options = GeoGlobe.Util.clone(a);
  2551. this._loadArcgisVTSStyle(this.options)
  2552. },
  2553. _loadArcgisVTSStyle: function(a) {
  2554. var b = this,
  2555. c = a.url;
  2556. this.url = c;
  2557. var d = a.tileSize || 256,
  2558. e = "-" + GeoGlobe.Util.randomStr(6),
  2559. f = function(f) {
  2560. var h = function(a) {
  2561. if (a.sprite) b.sprite = GeoGlobe.ProxyHost + b._getAbsoluteUrl(a.sprite);
  2562. if (a.glyphs) b.glyphs = GeoGlobe.ProxyHost + b._getAbsoluteUrl(a.glyphs);
  2563. b.sources = {};
  2564. for (var c in a.sources) {
  2565. var h = a.sources[c];
  2566. c += e;
  2567. b.sources[c] = {
  2568. type: "vector",
  2569. tiles: [GeoGlobe.ProxyHost + b._getAbsoluteUrl(h.url) + "/tile/{z}/{y}/{x}.pbf"],
  2570. tileSize: d,
  2571. maxzoom: f
  2572. }
  2573. }
  2574. b.layers = a.layers.map(function(a) {
  2575. a.id += e;
  2576. typeof a.source === "string" && (a.source += e);
  2577. return a
  2578. })
  2579. };
  2580. a.style ? h(a.style) : b.GetStyle(c, h, function() {
  2581. b.sources = {};
  2582. b.layers = [];
  2583. alert("ArcGisVST\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" +
  2584. c + "/resources/styles/root.json")
  2585. })
  2586. };
  2587. this.getServerInfo(c, function(b) {
  2588. var c = a.offset,
  2589. b = b.maxLOD,
  2590. b = isNaN(c) ? b : b - c;
  2591. f(b)
  2592. }, function() {
  2593. this.sources = {};
  2594. this.layers = [];
  2595. alert("ArcGisVST\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + c + "?f=pjson")
  2596. })
  2597. },
  2598. getServerInfo: function(a, b, c) {
  2599. var d = this;
  2600. GeoGlobe.Request.GET({
  2601. url: a + "?f=pjson",
  2602. async: !1,
  2603. success: function(a) {
  2604. a =
  2605. a.responseText;
  2606. if (!a) return c(), !1;
  2607. a = (new GeoGlobe.Format.JSON).read(a);
  2608. b.call(d, a)
  2609. },
  2610. failure: c
  2611. })
  2612. },
  2613. GetStyle: function(a, b, c) {
  2614. var d = this;
  2615. GeoGlobe.Request.GET({
  2616. url: a + "/resources/styles/root.json",
  2617. async: !1,
  2618. success: function(a) {
  2619. a = a.responseText;
  2620. if (!a) return c(), !1;
  2621. a = (new GeoGlobe.Format.JSON).read(a);
  2622. b.call(d, a)
  2623. },
  2624. failure: c
  2625. })
  2626. },
  2627. _getAbsoluteUrl: function(a) {
  2628. if (/^(http|https):\/\//.test(a)) return a;
  2629. var b = [this.url, "resources", "styles"];
  2630. a.split("/").forEach(function(a) {
  2631. a !== "" && (a === ".." ? b.pop() : b.push(a))
  2632. });
  2633. return b.join("/")
  2634. },
  2635. clone: function(a) {
  2636. a == null && (a = new GeoGlobe.Layer.ArcgisVTS(this.options));
  2637. return a
  2638. },
  2639. CLASS_NAME: "GeoGlobe.Layer.ArcgisVTS"
  2640. });
  2641. GeoGlobe.Layer.MultidateVTS = GeoGlobe.Class4OL(GeoGlobe.Layer, {
  2642. url: null,
  2643. layer: null,
  2644. format: null,
  2645. matrixSet: null,
  2646. style: null,
  2647. name: null,
  2648. zoomOffset: null,
  2649. matrixIds: null,
  2650. initialize: function(a) {
  2651. this.source_id = "source_MultidateVTS_" + GeoGlobe.Util.randomStr(6);
  2652. this.layers = this._getMultidateVTSLayer(a);
  2653. if (a.format !== "protobuf") return this.layers;
  2654. this.source = {
  2655. type: "vector",
  2656. tiles: [url]
  2657. }
  2658. },
  2659. _getMultidateVTSLayer: function(a) {
  2660. this.url = a.url;
  2661. var b = {};
  2662. if (a.layer) b.LAYER = a.layer;
  2663. if (a.format) b.FORMAT = a.format;
  2664. if (a.matrixSet) b.TILEMATRIXSET =
  2665. a.matrixSet;
  2666. if (a.version) b.VERSION = a.version;
  2667. if (a.format !== "protobuf" && a.styleName) b.STYLENAME = a.styleName;
  2668. if (a.time) b.TIME = a.time;
  2669. if (a.useRecent) b.USERECENT = a.useRecent;
  2670. if (a.tileSize) b.WIDTH = a.tileSize, b.HEIGHT = a.tileSize;
  2671. GeoGlobe.Util.applyDefaults(b, {
  2672. service: "WMTS",
  2673. request: "GetTile",
  2674. TILEMATRIX: "{z}",
  2675. TILEROW: "{y}",
  2676. TILECOL: "{x}"
  2677. });
  2678. var c = GeoGlobe.ProxyHost + GeoGlobe.Util.urlAppend(a.url, GeoGlobe.Util.getParameterString(b || {}));
  2679. if (b.FORMAT !== "protobuf") return {
  2680. id: "geowmts",
  2681. type: "raster",
  2682. source: {
  2683. type: "raster",
  2684. tiles: [c],
  2685. tileSize: 256
  2686. },
  2687. maxzoom: 22,
  2688. minzoom: 0
  2689. };
  2690. var d = "source_MultidateVTS_" + GeoGlobe.Util.randomStr(6);
  2691. this.source_id = d;
  2692. var e = this,
  2693. f = [];
  2694. this.GetStyle(a.styleName, function(c) {
  2695. var h = "",
  2696. j = "";
  2697. c.sprite && (h = GeoGlobe.ProxyHost + c.sprite);
  2698. c.glyphs ? j = GeoGlobe.ProxyHost + c.glyphs : a.glyphs && (j = GeoGlobe.ProxyHost + a.glyphs + "?SERVICE=FLS&VERSION=1.0&REQUEST=GetFont&FONTNAME={fontstack}&RANGE={range}.pbf");
  2699. e.sprite = h;
  2700. e.glyphs = j;
  2701. h = {
  2702. sprite: h,
  2703. glyphs: j,
  2704. styleName: c.name,
  2705. layerIdentifier: b.LAYER,
  2706. matrixSet: b.TILEMATRIXSET,
  2707. format: b.FORMAT,
  2708. bbox: a.tileBBox ? a.tileBBox : "",
  2709. minZoom: a.minZoom ? a.minZoom : "",
  2710. maxZoom: a.maxZoom ? a.maxZoom : ""
  2711. };
  2712. if (c.styleData)
  2713. for (j = 0; j < c.styleData.layers.length; j++) c.styleData.layers[j].metadata = h, c.styleData.layers[j].source = d, f[j] = c.styleData.layers[j];
  2714. else
  2715. for (j = 0; j < c.layers.length; j++) c.layers[j].source = d, c.layers[j].metadata = h, f[j] = c.layers[j]
  2716. }, function() {
  2717. alert("WMTS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" +
  2718. c + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  2719. });
  2720. return f
  2721. },
  2722. GetStyle: function(a, b, c) {
  2723. var d = this.url;
  2724. if (a == "" || a == void 0) alert("\u8bf7\u67e5\u770b\u6837\u5f0f\u540d\u79f0\u662f\u5426\u5b58\u5728");
  2725. else {
  2726. var e = {
  2727. REQUEST: "GetStyle",
  2728. SERVICE: "WMTS",
  2729. VERSION: "1.0.0",
  2730. STYLENAME: a
  2731. };
  2732. c || (c = function() {
  2733. this.failFn(e.REQUEST)
  2734. });
  2735. GeoGlobe.Request.GET({
  2736. url: d,
  2737. params: e,
  2738. scope: this,
  2739. async: !1,
  2740. success: function(a) {
  2741. a = a.responseText;
  2742. if (!a) return c(), !1;
  2743. a = (new GeoGlobe.Format.JSON).read(a);
  2744. b(a)
  2745. },
  2746. failure: c
  2747. })
  2748. }
  2749. },
  2750. clone: function(a) {
  2751. a ==
  2752. null && (a = new GeoGlobe.Layer.MultidateVTS(this.id, this.tileSize, this.filter, this.opacity, this.visible, this.name, this.url));
  2753. return a
  2754. },
  2755. CLASS_NAME: "GeoGlobe.Layer.MultidateVTS"
  2756. });
  2757. GeoGlobe.Layer.Export = GeoGlobe.Class4OL({
  2758. url: null,
  2759. f: null,
  2760. format: null,
  2761. size: 256,
  2762. transparent: !0,
  2763. initialize: function(a) {
  2764. return this._getExportTileLayer(a)
  2765. },
  2766. _getExportTileLayer: function(a) {
  2767. DEFAULT_PARAMS = {};
  2768. var b = {
  2769. BBOX: "{bbox-epsg-3857}"
  2770. };
  2771. b.format = a.format ? a.format : "image/png";
  2772. b.transparent = a.transparent || a.transparent === !1 ? a.transparent : !0;
  2773. b.f = a.f ? a.f : "image";
  2774. b.size = a.size ? a.size + "," + a.size : "256,256";
  2775. GeoGlobe.Util.applyDefaults(b, DEFAULT_PARAMS);
  2776. var c = {
  2777. url: a.url,
  2778. transparent: b.transparent,
  2779. size: b.size,
  2780. bbox: b.BBOX,
  2781. format: b.format,
  2782. f: b.f
  2783. },
  2784. d = GeoGlobe.Util.urlAppend(a.url, GeoGlobe.Util.getParameterString(b || {}));
  2785. GeoGlobe.ProxyHost && (d = GeoGlobe.appendToProxy(d));
  2786. return {
  2787. id: a.id ? a.id : "GEO_ARCGIS_EXPORT",
  2788. type: "raster",
  2789. source: {
  2790. type: "raster",
  2791. tiles: [d],
  2792. tileSize: b.size.split(",")[0] * 1
  2793. },
  2794. metadata: c
  2795. }
  2796. },
  2797. CLASS_NAME: "GeoGlobe.Layer.Export"
  2798. });
  2799. GeoGlobe.Layer.GeoTileLayer = GeoGlobe.Class4OL(GeoGlobe.Layer, {
  2800. id: null,
  2801. tileSize: 256,
  2802. url: null,
  2803. minzoom: null,
  2804. maxzoom: null,
  2805. initialize: function(a) {
  2806. this.url = a.url;
  2807. this.extent = a.maxextent;
  2808. var b = this.convertUrl(this.url);
  2809. return {
  2810. id: a.id,
  2811. name: a.name,
  2812. type: a.type,
  2813. source: {
  2814. type: a.type,
  2815. tiles: [b[0] + "?T=" + b[1] + "&X={x}&Y={y}&L={z}"],
  2816. tileSize: a.tileSize
  2817. },
  2818. maxzoom: parseInt(a.maxzoom),
  2819. minzoom: parseInt(a.minzoom),
  2820. paint: {
  2821. "raster-opacity": a.opacity == null ? 1 : a.opacity
  2822. },
  2823. layout: {
  2824. visibility: a.visibility == null ? "visible" : a.visibility
  2825. }
  2826. }
  2827. },
  2828. convertUrl: function(a) {
  2829. var b = [],
  2830. c = a.split("/services/");
  2831. if (c[0] && c[1]) return b.push(c[0] + "/DataServer"), b.push(c[1]), b;
  2832. else alert("\u89e3\u6790\u670d\u52a1\u5730\u5740\u9519\u8bef:" + a)
  2833. },
  2834. selectUrl: function(a, b) {
  2835. return b[a % b.length]
  2836. },
  2837. getDataExtent: function() {
  2838. if (this.maxExtent) return this.maxExtent.clone()
  2839. },
  2840. clone: function(a) {
  2841. return a = new GeoGlobe.Layer.GeoTileLayer(this.name, this.url, this.options)
  2842. },
  2843. CLASS_NAME: "GeoGlobe.Layer.GeoTileLayer"
  2844. });
  2845. GeoGlobe.Layer.GeoWMTSLayer = GeoGlobe.Class4OL(GeoGlobe.Layer.WMTS, {
  2846. time: "9999-01-01 00:00:00",
  2847. userecent: !0,
  2848. initialize: function(a) {
  2849. var b = new GeoGlobe.Layer.WMTS(a);
  2850. b.source.tiles[0] += "&" + GeoGlobe.Util.getParameterString({
  2851. time: a.time,
  2852. userecent: !!a.userecent || !0
  2853. });
  2854. if (a.minzoom) b.minzoom = a.minzoom;
  2855. if (a.maxzoom) b.maxzoom = a.maxzoom;
  2856. return b
  2857. },
  2858. CLASS_NAME: "GeoGlobe.Layer.GeoWMTSLayer"
  2859. });
  2860. GeoGlobe.Layer.RasterLayer = GeoGlobe.Class4OL(GeoGlobe.Layer, {
  2861. initialize: function(a) {
  2862. return a
  2863. },
  2864. CLASS_NAME: "GeoGlobe.Layer.RasterLayer"
  2865. });
  2866. GeoGlobe.Layer.VectorLayer = GeoGlobe.Class4OL(GeoGlobe.Layer, {
  2867. LAYER_TYPE: null,
  2868. initialize: function(a) {
  2869. if ("data" in a) {
  2870. if (a.data instanceof Array) a.data = {
  2871. type: "FeatureCollection",
  2872. features: a.data
  2873. };
  2874. var b = {
  2875. type: "geojson",
  2876. data: a.data
  2877. };
  2878. delete a.data;
  2879. return GeoGlobe.Util.applyDefaults(a, {
  2880. id: this.LAYER_TYPE + "-" + GeoGlobe.Util.randomStr(6),
  2881. type: this.LAYER_TYPE,
  2882. source: b
  2883. })
  2884. } else return a
  2885. },
  2886. CLASS_NAME: "GeoGlobe.Layer.VectorLayer"
  2887. });
  2888. GeoGlobe.Layer.CircleLayer = GeoGlobe.Class4OL(GeoGlobe.Layer.VectorLayer, {
  2889. LAYER_TYPE: "circle",
  2890. initialize: function() {
  2891. return GeoGlobe.Layer.VectorLayer.prototype.initialize.apply(this, arguments)
  2892. },
  2893. CLASS_NAME: "GeoGlobe.Layer.CircleLayer"
  2894. });
  2895. GeoGlobe.Layer.SymbolLayer = GeoGlobe.Class4OL(GeoGlobe.Layer.VectorLayer, {
  2896. LAYER_TYPE: "symbol",
  2897. initialize: function() {
  2898. return GeoGlobe.Layer.VectorLayer.prototype.initialize.apply(this, arguments)
  2899. },
  2900. CLASS_NAME: "GeoGlobe.Layer.SymbolLayer"
  2901. });
  2902. GeoGlobe.Layer.LineLayer = GeoGlobe.Class4OL(GeoGlobe.Layer.VectorLayer, {
  2903. LAYER_TYPE: "line",
  2904. initialize: function() {
  2905. return GeoGlobe.Layer.VectorLayer.prototype.initialize.apply(this, arguments)
  2906. },
  2907. CLASS_NAME: "GeoGlobe.Layer.LineLayer"
  2908. });
  2909. GeoGlobe.Layer.FillLayer = GeoGlobe.Class4OL(GeoGlobe.Layer.VectorLayer, {
  2910. LAYER_TYPE: "fill",
  2911. initialize: function() {
  2912. return GeoGlobe.Layer.VectorLayer.prototype.initialize.apply(this, arguments)
  2913. },
  2914. CLASS_NAME: "GeoGlobe.Layer.FillLayer"
  2915. });
  2916. GeoGlobe.Layer.FillExtrusionLayer = GeoGlobe.Class4OL(GeoGlobe.Layer.VectorLayer, {
  2917. LAYER_TYPE: "fill-extrusion",
  2918. initialize: function() {
  2919. return GeoGlobe.Layer.VectorLayer.prototype.initialize.apply(this, arguments)
  2920. },
  2921. CLASS_NAME: "GeoGlobe.Layer.FillExtrusionLayer"
  2922. });
  2923. GeoGlobe.Layer.FillExtrusionLayer2 = GeoGlobe.Class4OL(GeoGlobe.Layer.VectorLayer, {
  2924. LAYER_TYPE: "fill-extrusion",
  2925. initialize: function(a) {
  2926. this.options = a;
  2927. a.data = this._splitData(a.data || []);
  2928. var b = GeoGlobe.Layer.VectorLayer.prototype.initialize.apply(this, arguments);
  2929. if (!b.paint) b.paint = {};
  2930. GeoGlobe.Util.extend(b.paint, {
  2931. "fill-extrusion-base": ["get", "_base"],
  2932. "fill-extrusion-height": ["get", "_height"],
  2933. "fill-extrusion-color": ["get", "_value"]
  2934. });
  2935. a.isPattern && (b.paint["fill-extrusion-pattern"] = ["get", "_value"]);
  2936. this.layer =
  2937. b
  2938. },
  2939. _splitData: function(a) {
  2940. var b = GeoGlobe.Util.pick(this.options, ["heightProperty", "gradient", "roof"]),
  2941. c = [];
  2942. a instanceof Array ? c = a : a.type === "FeatureCollection" ? c = a.features : a.type === "Feature" && (c = [a]);
  2943. for (var a = [], d = 0; d < c.length; d++) a = a.concat(this._splitFeature(c[d], b.heightProperty || "height", b.gradient, b.roof));
  2944. return a
  2945. },
  2946. _splitFeature: function(a, b, c, d) {
  2947. var e = [],
  2948. f = c.length / 2,
  2949. b = a.properties[b];
  2950. if (d) {
  2951. var g = JSON.parse(JSON.stringify(a));
  2952. GeoGlobe.Util.extend(g.properties, {
  2953. _base: b,
  2954. _height: b + 0.01,
  2955. _value: d
  2956. });
  2957. e.push(g)
  2958. }
  2959. for (d = f - 1; d >= 0; d--) {
  2960. var f = c[d * 2],
  2961. h = c[d * 2 + 1];
  2962. b - f > 0 && (g = JSON.parse(JSON.stringify(a)), GeoGlobe.Util.extend(g.properties, {
  2963. _base: f,
  2964. _height: b,
  2965. _value: h
  2966. }), e.push(g), b = f)
  2967. }
  2968. return e
  2969. },
  2970. setData: function(a) {
  2971. a = {
  2972. type: "FeatureCollection",
  2973. features: this._splitData(a)
  2974. };
  2975. this.layer.source = {
  2976. type: "geojson",
  2977. data: a
  2978. };
  2979. this.map && this.map.getSource(this.layer.id).setData(a)
  2980. },
  2981. CLASS_NAME: "GeoGlobe.Layer.FillExtrusionLayer2"
  2982. });
  2983. GeoGlobe.Layer.BackgroundLayer = GeoGlobe.Class4OL(GeoGlobe.Layer, {
  2984. "background-color": null,
  2985. "background-pattern": null,
  2986. "background-opacity": null,
  2987. initialize: function(a) {
  2988. return a
  2989. },
  2990. CLASS_NAME: "GeoGlobe.Layer.BackgroundLayer"
  2991. });
  2992. GeoGlobe.Layer.ThematicTileLayer = GeoGlobe.Class4OL(GeoGlobe.Layer, {
  2993. map: null,
  2994. version: "1.0.0",
  2995. id: null,
  2996. layerID: null,
  2997. chartID: null,
  2998. maxExtent: null,
  2999. format: "png",
  3000. colorSchemeID: null,
  3001. hasLegend: !1,
  3002. legendType: 0,
  3003. legendPosition: "br",
  3004. hasEdge: !1,
  3005. hasLabel: !1,
  3006. hasBaseMap: !1,
  3007. hasBaseMapLegend: !1,
  3008. baseMapExampleColumnNums: 2,
  3009. initialize: function(a, b) {
  3010. var c = b.box,
  3011. d = c._ne.lng,
  3012. e = c._ne.lat,
  3013. f = c._sw.lng,
  3014. c = c._sw.lat,
  3015. g = b.params;
  3016. this.map = a;
  3017. this.options = b;
  3018. GeoGlobe.Function.bind(this.seturl, this);
  3019. g = this.seturl(g);
  3020. this.layer = {
  3021. id: this.options.id,
  3022. minzoom: b.minzoom ? this.options.minzoom : 0,
  3023. maxzoom: b.maxzoom ? this.options.maxzoom : 20,
  3024. source: {
  3025. type: "image",
  3026. url: this.options.url + "/map/" + this.options.layerID + "/" + this.options.chartID + "/" + f + "/" + c + "/" + d + "/" + e + "/" + this.options.width + "/" + this.options.height + ".png?" + g,
  3027. coordinates: [
  3028. [f, e],
  3029. [d, e],
  3030. [d, c],
  3031. [f, c]
  3032. ]
  3033. },
  3034. type: "raster"
  3035. };
  3036. this.zoome = this.zoomend.bind(this);
  3037. this.drage = this.dragend.bind(this);
  3038. this.map.on("zoomend", this.zoome);
  3039. this.map.on("dragend", this.drage);
  3040. GeoGlobe.Function.bind(this.remove, this);
  3041. return this
  3042. },
  3043. zoomend: function() {
  3044. if (this.map.style._layers[this.options.id] && this.map.style._layers[this.options.id].layout && this.map.style._layers[this.options.id].layout.visibility != "none") {
  3045. var a = this.map.style._layers[this.options.id].metadata,
  3046. b = this.map.style._layers[this.options.id].paint,
  3047. c = this.map.style._layers[this.options.id].layout;
  3048. this.map.removeLayer(this.options.id);
  3049. this.map.removeSource(this.options.id);
  3050. box = this.map.getBounds();
  3051. var d = this.options.params;
  3052. maxx = box._ne.lng;
  3053. maxy = box._ne.lat;
  3054. minx = box._sw.lng;
  3055. miny = box._sw.lat;
  3056. d = this.seturl(d);
  3057. this.options.width = this.map.getCanvas().width;
  3058. this.options.height = this.map.getCanvas().height;
  3059. url = this.options.url + "/map/" + this.options.layerID + "/" + this.options.chartID + "/" + minx + "/" + miny + "/" + maxx + "/" + maxy + "/" + this.options.width + "/" + this.options.height + ".png?" + d;
  3060. layer = {
  3061. id: this.options.id,
  3062. name: this.options.name,
  3063. source: {
  3064. type: "image",
  3065. url: url,
  3066. coordinates: [
  3067. [minx, maxy],
  3068. [maxx, maxy],
  3069. [maxx, miny],
  3070. [minx, miny]
  3071. ]
  3072. },
  3073. type: "raster"
  3074. };
  3075. layer.paint = b;
  3076. layer.layout = c;
  3077. layer.metadata = a;
  3078. this.map.addLayer(layer)
  3079. }
  3080. },
  3081. dragend: function() {
  3082. if (this.map.style._layers[this.options.id] && this.map.style._layers[this.options.id].layout && this.map.style._layers[this.options.id].layout.visibility != "none") {
  3083. var a = this.map.style._layers[this.options.id].metadata,
  3084. b = this.map.style._layers[this.options.id].paint,
  3085. c = this.map.style._layers[this.options.id].layout;
  3086. this.map.removeLayer(this.options.id);
  3087. this.map.removeSource(this.options.id);
  3088. box = this.map.getBounds();
  3089. var d = this.options.params;
  3090. maxx = box._ne.lng;
  3091. maxy = box._ne.lat;
  3092. minx = box._sw.lng;
  3093. miny = box._sw.lat;
  3094. d = this.seturl(d);
  3095. this.options.width = this.map.getCanvas().width;
  3096. this.options.height = this.map.getCanvas().height;
  3097. url = this.options.url + "/map/" + this.options.layerID + "/" + this.options.chartID + "/" + minx + "/" + miny + "/" + maxx + "/" + maxy + "/" + this.options.width + "/" + this.options.height + ".png?" + d;
  3098. layer = {
  3099. id: this.options.id,
  3100. name: this.options.name,
  3101. source: {
  3102. type: "image",
  3103. url: url,
  3104. coordinates: [
  3105. [minx, maxy],
  3106. [maxx, maxy],
  3107. [maxx, miny],
  3108. [minx, miny]
  3109. ]
  3110. },
  3111. type: "raster"
  3112. };
  3113. layer.paint = b;
  3114. layer.layout = c;
  3115. layer.metadata = a;
  3116. this.map.addLayer(layer)
  3117. }
  3118. },
  3119. seturl: function(a) {
  3120. var b = "",
  3121. c;
  3122. for (c in a) a[c] != -1 && (b += c + "=" + a[c] + "&");
  3123. return b = b.substring(0, b.length - 1)
  3124. },
  3125. getCapabilities: function(a, b, c) {
  3126. typeof c != "function" && (c = function() {
  3127. alert("\u4e13\u9898\u56fe\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + a + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  3128. });
  3129. var d = this;
  3130. GeoGlobe.Request.GET({
  3131. url: a,
  3132. cache: !1,
  3133. async: !1,
  3134. success: function(a) {
  3135. a = a.responseText;
  3136. if (!a) return c(), !1;
  3137. a = (new GeoGlobe.Format.JSON).read(a);
  3138. b.call(d, a)
  3139. },
  3140. failure: c
  3141. })
  3142. },
  3143. remove: function(a) {
  3144. this.map.off("zoomend", this.zoome);
  3145. this.map.off("dragend", this.drage);
  3146. this.map.removeLayer(a);
  3147. this.map.removeSource(a)
  3148. },
  3149. showLegend: function() {
  3150. var a = this.getLegend({
  3151. layerID: this.layerID,
  3152. chartID: this.chartID,
  3153. colorSchemeID: this.colorSchemeID,
  3154. drawLegend: "ThematicMap",
  3155. legendType: this.legendType
  3156. });
  3157. this.imageLegend || (new GeoGlobe.Marker(a)).setLngLat([lnglat.lng,
  3158. lnglat.lat
  3159. ]).addTo(this.map)
  3160. },
  3161. getLegend: function(a) {
  3162. if (this.url.indexOf("/", this.url.length - 1) != -1) this.url = this.url.substr(0, this.url.length - 1);
  3163. var b;
  3164. b = GeoGlobe.String.format("${url}/legend/${layerID}/${chartID}.${format}?drawLegend=${drawLegend}&legendType=${legendType}", {
  3165. url: this.url,
  3166. layerID: a.layerID,
  3167. chartID: a.chartID,
  3168. format: a.format || "png",
  3169. drawLegend: a.drawLegend,
  3170. legendType: a.legendType
  3171. });
  3172. typeof a.colorSchemeID === "string" && (b += "&ColorSchemeID=" + a.colorSchemeID);
  3173. return b
  3174. },
  3175. setLegendLocation: function(a) {
  3176. var b =
  3177. this.map.getSize();
  3178. switch (this.legendPosition) {
  3179. case "br":
  3180. var c = b.w - this.legendSize.w,
  3181. b = b.h - this.legendSize.h;
  3182. a.style.left = c + "px";
  3183. a.style.top = b + "px";
  3184. break;
  3185. case "bl":
  3186. b = b.h - this.legendSize.h;
  3187. a.style.left = "0px";
  3188. a.style.top = b + "px";
  3189. break;
  3190. case "tl":
  3191. a.style.left = "0px";
  3192. a.style.top = "0px";
  3193. break;
  3194. case "tr":
  3195. c = b.w - this.legendSize.w, a.style.left = c + "px", a.style.top = "0px"
  3196. }
  3197. },
  3198. showBaseMapLegend: function() {
  3199. var a = this.getBaseMapLegend({
  3200. layerID: this.layerID,
  3201. chartID: this.chartID,
  3202. drawLegend: "BaseMap",
  3203. baseMapExampleColumnNums: this.baseMapExampleColumnNums
  3204. });
  3205. this.imageBaseMapLegend || (new GeoGlobe.Marker(a)).setLngLat([lnglat.lng, lnglat.lat]).addTo(this.map)
  3206. },
  3207. getBaseMapLegend: function(a) {
  3208. if (this.url.indexOf("/", this.url.length - 1) != -1) this.url = this.url.substr(0, this.url.length - 1);
  3209. return a = GeoGlobe.String.format("${url}/legend/${layerID}/${chartID}.${format}?drawLegend=${drawLegend}&baseMapExampleColumnNums=${baseMapExampleColumnNums}", {
  3210. url: this.url,
  3211. layerID: a.layerID,
  3212. chartID: a.chartID,
  3213. format: a.format || "png",
  3214. drawLegend: a.drawLegend,
  3215. baseMapExampleColumnNums: a.baseMapExampleColumnNums
  3216. })
  3217. },
  3218. setBaseMapLegendLocation: function(a) {
  3219. var b = this.map.getSize();
  3220. switch (this.baseMapLegendPosition) {
  3221. case "br":
  3222. var c = b.w - this.baseMapLegendSize.w,
  3223. b = b.h - this.baseMapLegendSize.h;
  3224. a.style.left = c + "px";
  3225. a.style.top = b + "px";
  3226. break;
  3227. case "bl":
  3228. b = b.h - this.baseMapLegendSize.h;
  3229. a.style.left = "0px";
  3230. a.style.top = b + "px";
  3231. break;
  3232. case "tl":
  3233. a.style.left = "50px";
  3234. a.style.top = "0px";
  3235. break;
  3236. case "tr":
  3237. c = b.w - this.baseMapLegendSize.w, a.style.left = c + "px", a.style.top = "0px"
  3238. }
  3239. },
  3240. updateHotArea: function(a) {
  3241. a.zoomChanged ? this.vectorLayer.removeAllFeatures() :
  3242. this.vectorLayer.redraw()
  3243. },
  3244. clone: function(a) {
  3245. a == null && (a = new GeoGlobe.Layer.ThematicTileLayer(this.id, this.url, this.params, this.getOptions()));
  3246. return a
  3247. },
  3248. getURL: function(a) {
  3249. var a = this.adjustBounds(a),
  3250. b = this.getImageSize(),
  3251. a = GeoGlobe.String.format("${url}/map/${layerID}/${chartID}/${left}/${bottom}/${right}/${top}/${width}/${height}.${format}?hasLegend=${hasLegend}&legendType=${legendType}&hasEdge=${hasEdge}&hasLabel=${hasLabel}&hasBaseMap=${hasBaseMap}&hasBaseMapLegend=${hasBaseMapLegend}&baseMapExampleColumnNums=${baseMapExampleColumnNums}", {
  3252. url: this.url,
  3253. layerID: this.layerID,
  3254. chartID: this.chartID,
  3255. left: a.left,
  3256. bottom: a.bottom,
  3257. right: a.right,
  3258. top: a.top,
  3259. width: b.w,
  3260. height: b.h,
  3261. format: this.format,
  3262. hasLegend: this.hasLegend,
  3263. legendType: this.legendType,
  3264. hasEdge: this.hasEdge,
  3265. hasLabel: this.hasLabel,
  3266. hasBaseMap: this.hasBaseMap,
  3267. hasBaseMapLegend: this.hasBaseMapLegend,
  3268. baseMapExampleColumnNums: this.baseMapExampleColumnNums
  3269. });
  3270. typeof this.colorSchemeID === "string" && (a += "&ColorSchemeID=" + this.colorSchemeID);
  3271. return a
  3272. },
  3273. CLASS_NAME: "GeoGlobe.Layer.ThematicTileLayer"
  3274. });
  3275. GeoGlobe.CanvasLayer = GeoGlobe.Class4OL({
  3276. map: null,
  3277. context: null,
  3278. initialize: function(a) {
  3279. this.id = GeoGlobe.Util.createUniqueID(this.CLASS_NAME + "_");
  3280. this.options = a
  3281. },
  3282. drawOnMove: null,
  3283. _drawLayer: function() {
  3284. this.clear();
  3285. var a = this._prepareDrawParams();
  3286. a && this.draw.apply(this, a)
  3287. },
  3288. _prepareDrawParams: function() {
  3289. var a = [];
  3290. if (!this._drawContext) this._drawContext = this.prepareToDraw.apply(this, [this.context].concat(a));
  3291. a = [this.context];
  3292. a.push.apply(a, this._drawContext);
  3293. return a
  3294. },
  3295. prepareToDraw: function() {},
  3296. draw: function() {},
  3297. addTo: function(a) {
  3298. this.map = a;
  3299. var b = a.getCanvasContainer();
  3300. this.canvas = document.createElement("canvas");
  3301. this.canvas.id = this.id;
  3302. this.canvas.style.width = a.getCanvas().style.width;
  3303. this.canvas.style.height = a.getCanvas().style.height;
  3304. this.canvas.style.position = "absolute";
  3305. this.canvas.style.display = "none";
  3306. this.canvas.width = a.getCanvas().width;
  3307. this.canvas.height = a.getCanvas().height;
  3308. b.appendChild(this.canvas);
  3309. this.context = this.canvas.getContext("2d");
  3310. this._bindEvent();
  3311. var c = {
  3312. type: "canvas",
  3313. canvas: this.canvas.id,
  3314. animate: !0,
  3315. coordinates: this._boundsToCoordinates(a.getBounds())
  3316. },
  3317. d = {
  3318. id: this.id + "_layer",
  3319. source: this.id,
  3320. type: "raster",
  3321. paint: {
  3322. "raster-opacity": 1
  3323. }
  3324. };
  3325. a.addSource(this.id, c);
  3326. a.addLayer(d);
  3327. this.source = a.getSource(this.id);
  3328. this.layer = a.getLayer(this.id + "_layer");
  3329. b.removeChild(this.canvas);
  3330. this._drawLayer()
  3331. },
  3332. _bindEvent: function() {
  3333. var a = this.map;
  3334. this._move = GeoGlobe.Function.bind(function(a) {
  3335. typeof this.drawOnMove === "function" && this.drawOnMove(a)
  3336. }, this);
  3337. this._moveend = GeoGlobe.Function.bind(function(a) {
  3338. this.source.setCoordinates(this._boundsToCoordinates(a.target.getBounds()));
  3339. this._drawLayer()
  3340. }, this);
  3341. a.on("move", this._move);
  3342. a.on("moveend", this._moveend)
  3343. },
  3344. pause: function() {
  3345. this.source.pause()
  3346. },
  3347. play: function() {
  3348. this.source.play()
  3349. },
  3350. setOpacity: function(a) {
  3351. this.map.setPaintProperty(this.layer.id, "raster-opacity", parseFloat(a))
  3352. },
  3353. clear: function() {
  3354. this.context.clearRect(0, 0, this.canvas.width, this.canvas.height)
  3355. },
  3356. remove: function() {
  3357. this.clear();
  3358. var a = this.map;
  3359. a.off("move", this._move);
  3360. a.off("moveend", this._moveend);
  3361. a.removeSource(this.source.id);
  3362. a.removeLayer(this.layer.id);
  3363. this.map =
  3364. this.canvas = null
  3365. },
  3366. _boundsToCoordinates: function(a) {
  3367. var b = a.toArray(),
  3368. a = b[0][0],
  3369. c = b[0][1],
  3370. d = b[1][0],
  3371. b = b[1][1];
  3372. return [
  3373. [a, b],
  3374. [d, b],
  3375. [d, c],
  3376. [a, c]
  3377. ]
  3378. },
  3379. CLASS_NAME: "GeoGlobe.CanvasLayer"
  3380. });
  3381. GeoGlobe.TDTLayer = GeoGlobe.Class4OL({
  3382. initialize: function(a, b) {
  3383. return this._getLayer(a, b)
  3384. },
  3385. _getLayer: function(a, b) {
  3386. var c = "tdt_" + a + "_" + GeoGlobe.Util.randomStr(8),
  3387. d = GeoGlobe.ProxyHost + this._getUrlTemplateByName(a) + "&tk=" + (b || "e90d56e5a09d1767899ad45846b0cefd");
  3388. return {
  3389. id: c,
  3390. type: "raster",
  3391. source: {
  3392. type: "raster",
  3393. tiles: [d],
  3394. tileSize: 256,
  3395. noFadingParent: !0
  3396. }
  3397. }
  3398. },
  3399. _getUrlTemplateByName: function(a) {
  3400. return "https://t0.tianditu.gov.cn/" + a + "/wmts?" + GeoGlobe.Util.getParameterString(this.tdtParams[a])
  3401. },
  3402. tdtParams: {
  3403. vec_w: {
  3404. SERVICE: "WMTS",
  3405. REQUEST: "GetTile",
  3406. LAYER: "vec",
  3407. TILEMATRIXSET: "w",
  3408. FORMAT: "tiles",
  3409. VERSION: "1.0.0",
  3410. STYLE: "default",
  3411. TILEMATRIX: "{z}",
  3412. TILEROW: "{y}",
  3413. TILECOL: "{x}"
  3414. },
  3415. cva_w: {
  3416. SERVICE: "WMTS",
  3417. REQUEST: "GetTile",
  3418. LAYER: "cva",
  3419. TILEMATRIXSET: "w",
  3420. FORMAT: "tiles",
  3421. VERSION: "1.0.0",
  3422. STYLE: "default",
  3423. TILEMATRIX: "{z}",
  3424. TILEROW: "{y}",
  3425. TILECOL: "{x}"
  3426. },
  3427. vec_c: {
  3428. SERVICE: "WMTS",
  3429. REQUEST: "GetTile",
  3430. LAYER: "vec",
  3431. TILEMATRIXSET: "c",
  3432. FORMAT: "tiles",
  3433. VERSION: "1.0.0",
  3434. STYLE: "default",
  3435. TILEMATRIX: "{z}",
  3436. TILEROW: "{y}",
  3437. TILECOL: "{x}"
  3438. },
  3439. cva_c: {
  3440. SERVICE: "WMTS",
  3441. REQUEST: "GetTile",
  3442. LAYER: "cva",
  3443. TILEMATRIXSET: "c",
  3444. FORMAT: "tiles",
  3445. VERSION: "1.0.0",
  3446. STYLE: "default",
  3447. TILEMATRIX: "{z}",
  3448. TILEROW: "{y}",
  3449. TILECOL: "{x}"
  3450. },
  3451. img_w: {
  3452. SERVICE: "WMTS",
  3453. REQUEST: "GetTile",
  3454. LAYER: "img",
  3455. TILEMATRIXSET: "w",
  3456. FORMAT: "tiles",
  3457. VERSION: "1.0.0",
  3458. STYLE: "default",
  3459. TILEMATRIX: "{z}",
  3460. TILEROW: "{y}",
  3461. TILECOL: "{x}"
  3462. },
  3463. cia_w: {
  3464. SERVICE: "WMTS",
  3465. REQUEST: "GetTile",
  3466. LAYER: "cia",
  3467. TILEMATRIXSET: "w",
  3468. FORMAT: "tiles",
  3469. VERSION: "1.0.0",
  3470. STYLE: "default",
  3471. TILEMATRIX: "{z}",
  3472. TILEROW: "{y}",
  3473. TILECOL: "{x}"
  3474. },
  3475. img_c: {
  3476. SERVICE: "WMTS",
  3477. REQUEST: "GetTile",
  3478. LAYER: "img",
  3479. TILEMATRIXSET: "c",
  3480. FORMAT: "tiles",
  3481. VERSION: "1.0.0",
  3482. STYLE: "default",
  3483. TILEMATRIX: "{z}",
  3484. TILEROW: "{y}",
  3485. TILECOL: "{x}"
  3486. },
  3487. cia_c: {
  3488. SERVICE: "WMTS",
  3489. REQUEST: "GetTile",
  3490. LAYER: "cia",
  3491. TILEMATRIXSET: "c",
  3492. FORMAT: "tiles",
  3493. VERSION: "1.0.0",
  3494. STYLE: "default",
  3495. TILEMATRIX: "{z}",
  3496. TILEROW: "{y}",
  3497. TILECOL: "{x}"
  3498. }
  3499. },
  3500. CLASS_NAME: "GeoGlobe.TDTLayer"
  3501. });
  3502. GeoGlobe.Layer.HotArea = GeoGlobe.Class4OL(GeoGlobe.Layer, {
  3503. url: null,
  3504. layer: null,
  3505. format: null,
  3506. matrixSet: null,
  3507. style: null,
  3508. version: "1.0.0",
  3509. name: null,
  3510. layerid: null,
  3511. hotareaLayers: null,
  3512. hotareaHighlightedLayers: null,
  3513. tileUrls: null,
  3514. initialize: function(a) {
  3515. this.name = a.name ? a.name : null;
  3516. this.url = a.url;
  3517. this.layer = a.layer;
  3518. this.format = a.format;
  3519. this.matrixSet = a.matrixSet;
  3520. this.style = a.style;
  3521. this.layerid = "geoglobe_layer_hotarea_" + GeoGlobe.Util.randomStr(8);
  3522. this.layerOption = {
  3523. id: this.layerid,
  3524. type: "raster",
  3525. source: {
  3526. type: "raster",
  3527. rasterType: "hotarea",
  3528. tiles: [GeoGlobe.appendToProxy(a.url + "?SERVICE=WMTS&REQUEST=GetTile&LAYER=" + this.layer + "&TILEMATRIXSET=" + this.matrixSet + "&FORMAT=" + this.format + "&VERSION=" + this.version + "&STYLE=" + this.style + "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}")],
  3529. tileSize: 256
  3530. },
  3531. paint: {
  3532. "raster-opacity": 1
  3533. },
  3534. metadata: {
  3535. type: "hotarea"
  3536. }
  3537. };
  3538. this.hotareaLayers = [];
  3539. this.hotareaHighlightedLayers = [];
  3540. this.tileUrls = [];
  3541. this.onclick = typeof a.onclick === "function" ? a.onclick : this.onclick
  3542. },
  3543. addTo: function(a) {
  3544. this.map = a;
  3545. a.addLayer(this.layerOption);
  3546. this._bindEvent()
  3547. },
  3548. _bindEvent: function() {
  3549. var a = this.map;
  3550. GeoGlobe.Layer.HotArea["callback_tileJSON_" + this.layerid] = GeoGlobe.Function.bind(this.callback_tile, this);
  3551. var b = GeoGlobe.Function.bind(function(b) {
  3552. for (var d = [
  3553. [b.point.x - 2, b.point.y - 2],
  3554. [b.point.x + 2, b.point.y + 2]
  3555. ], e = [], f = 0; f < this.hotareaLayers.length; f++) e.push(this.hotareaLayers[f].id);
  3556. d = a.queryRenderedFeatures(d, {
  3557. layers: e
  3558. });
  3559. d.length > 0 ? (d = [d[0]], this.map.getCanvas().style.cursor = "pointer") : this.map.getCanvas().style.cursor = "";
  3560. e = d.reduce(function(a,
  3561. b) {
  3562. a.push(b.properties.displayname);
  3563. return a
  3564. }, ["==", "displayname"]);
  3565. e = e.length === 2 ? ["==", "displayname", ""] : e;
  3566. for (f = 0; f < this.hotareaHighlightedLayers.length; f++) a.setFilter(this.hotareaHighlightedLayers[f].id, e);
  3567. if (b.type === "click") b.features = d, this.onclick(b)
  3568. }, this);
  3569. a.on("click", b);
  3570. a.on("mousemove", b);
  3571. b = GeoGlobe.Function.bind(function() {
  3572. for (var b = 0; b < this.hotareaHighlightedLayers.length; b++) a.removeLayer(this.hotareaHighlightedLayers[b].id);
  3573. this.hotareaHighlightedLayers = [];
  3574. for (b = 0; b < this.hotareaLayers.length; b++) a.removeLayer(this.hotareaLayers[b].id),
  3575. a.removeSource(this.hotareaLayers[b].id);
  3576. this.hotareaLayers = [];
  3577. this.tileUrls = []
  3578. }, this);
  3579. a.on("zoomstart", b)
  3580. },
  3581. callback_tile: function(a) {
  3582. for (var b = a.tileUrl, c = !1, d = 0; d < this.tileUrls.length; d++) this.tileUrls[d] === b && (c = !0);
  3583. if (!c) {
  3584. this.tileUrls.push(b);
  3585. b = a.data;
  3586. c = b.features;
  3587. for (d = 0; d < c.length; d++) {
  3588. var e = c[d].properties.picsymid;
  3589. c[d].properties.overPicUrl = this.getPicURL(e, !0);
  3590. c[d].properties.outPicUrl = this.getPicURL(e, !1)
  3591. }
  3592. a = a.map;
  3593. d = GeoGlobe.Util.randomStr(8);
  3594. b = {
  3595. id: "hotarea_id_" + d,
  3596. type: "fill",
  3597. source: {
  3598. type: "geojson",
  3599. data: b
  3600. },
  3601. paint: {
  3602. "fill-color": "#088",
  3603. "fill-opacity": 0
  3604. }
  3605. };
  3606. a.addLayer(b);
  3607. this.hotareaLayers.push(b);
  3608. d = {
  3609. id: "hotarea_highlighted_id_" + d,
  3610. type: "fill",
  3611. source: b.id,
  3612. paint: {
  3613. "fill-outline-color": "#484896",
  3614. "fill-color": "#6e599f",
  3615. "fill-opacity": 0
  3616. },
  3617. filter: ["==", "displayname", ""]
  3618. };
  3619. a.addLayer(d);
  3620. this.hotareaHighlightedLayers.push(d)
  3621. }
  3622. },
  3623. getPicURL: function(a, b) {
  3624. return this.url + "?" + GeoGlobe.Util.getParameterString({
  3625. SERVICE: "WMTS",
  3626. REQUEST: "GetIcon",
  3627. VERSION: this.version,
  3628. LAYER: this.layer,
  3629. PICID: a,
  3630. ISANTI: b
  3631. })
  3632. },
  3633. onclick: function() {},
  3634. CLASS_NAME: "GeoGlobe.Layer.HotArea"
  3635. });
  3636. GeoGlobe.Layer.ClusterLayer = GeoGlobe.Class4OL(GeoGlobe.Layer, {
  3637. initialize: function(a, b) {
  3638. this.options = a;
  3639. this.source_id = "source_cluster_" + GeoGlobe.Util.randomStr(6);
  3640. this.getClusterSource();
  3641. this.getClusterLayers(b)
  3642. },
  3643. getClusterSource: function() {
  3644. var a = GeoGlobe.Util.pick(this.options, ["data", "clusterMaxZoom", "clusterRadius"]);
  3645. this.source = {
  3646. type: "geojson",
  3647. data: a.data,
  3648. cluster: !0,
  3649. clusterMaxZoom: a.clusterMaxZoom || 14,
  3650. clusterRadius: a.clusterRadius || 50
  3651. }
  3652. },
  3653. getClusterLayers: function(a) {
  3654. var a = a || this._getDefaultLayers(),
  3655. b = GeoGlobe.Util.randomStr(6),
  3656. c = this;
  3657. this.layers = a.map(function(a) {
  3658. a.id = b + "-" + (a.id || GeoGlobe.Util.randomStr(4));
  3659. a.source = c.source_id;
  3660. return a
  3661. })
  3662. },
  3663. _getDefaultLayers: function() {
  3664. var a = GeoGlobe.Util.pick(this.options, ["stops", "colors", "radius", "abbreviated"]);
  3665. GeoGlobe.Util.applyDefaults(a, {
  3666. stops: [0, 100, 750],
  3667. colors: ["#51bbd6", "#f1f075", "#f28cb1"],
  3668. radius: [20, 30, 40],
  3669. abbreviated: !1
  3670. });
  3671. return [{
  3672. id: "clusters",
  3673. type: "circle",
  3674. filter: ["has", "point_count"],
  3675. paint: {
  3676. "circle-color": {
  3677. property: "point_count",
  3678. type: "interval",
  3679. stops: a.stops.map(function(b, c) {
  3680. return [b, a.colors[c]]
  3681. })
  3682. },
  3683. "circle-radius": {
  3684. property: "point_count",
  3685. type: "interval",
  3686. stops: a.stops.map(function(b, c) {
  3687. return [b, a.radius[c]]
  3688. })
  3689. }
  3690. }
  3691. }, {
  3692. id: "cluster-count",
  3693. type: "symbol",
  3694. filter: ["has", "point_count"],
  3695. layout: {
  3696. "text-field": a.abbreviated ? "{point_count_abbreviated}" : "{point_count}",
  3697. "text-size": 12
  3698. }
  3699. }, {
  3700. id: "unclustered-point",
  3701. type: "circle",
  3702. filter: ["!has", "point_count"],
  3703. paint: {
  3704. "circle-color": "#fff",
  3705. "circle-radius": 6,
  3706. "circle-stroke-width": 2,
  3707. "circle-stroke-color": "#0f89f5"
  3708. }
  3709. }]
  3710. },
  3711. CLASS_NAME: "GeoGlobe.Layer.ClusterLayer"
  3712. });
  3713. GeoGlobe.Source = GeoGlobe.Class({
  3714. SourceId: null,
  3715. initialize: function() {
  3716. return this
  3717. },
  3718. CLASS_NAME: "GeoGlobe.Source"
  3719. });
  3720. GeoGlobe.Source.GeoJSONSource = GeoGlobe.Class({
  3721. initialize: function(a, b) {
  3722. var c = {};
  3723. c.id = a;
  3724. c.source = b;
  3725. return c
  3726. },
  3727. CLASS_NAME: "GeoGlobe.Source.GeoJSONSource"
  3728. });
  3729. GeoGlobe.Source.RasterSource = GeoGlobe.Class(mapboxgl.FreeCRSMap, {
  3730. initialize: function(a) {
  3731. return {
  3732. id: a.id,
  3733. type: "raster",
  3734. tiles: a.url,
  3735. tileSize: a.tileSize ? a.tileSize : 256,
  3736. zoomOffset: a.zoomOffset ? a.zoomOffset : 0
  3737. }
  3738. },
  3739. CLASS_NAME: "GeoGlobe.Source.RasterSource"
  3740. });
  3741. GeoGlobe.Source.ImageSource = GeoGlobe.Class({
  3742. initialize: function(a, b) {
  3743. var c = {};
  3744. c.id = a;
  3745. c.source = b;
  3746. return c
  3747. },
  3748. CLASS_NAME: "GeoGlobe.Source.ImageSource"
  3749. });
  3750. GeoGlobe.Source.VectorSource = GeoGlobe.Class({
  3751. initialize: function(a) {
  3752. return {
  3753. id: a.id,
  3754. type: a.type,
  3755. tiles: a.url
  3756. }
  3757. },
  3758. CLASS_NAME: "GeoGlobe.Source.VectorSource"
  3759. });
  3760. GeoGlobe.Source.VideoSource = GeoGlobe.Class({
  3761. initialize: function(a, b) {
  3762. var c = {};
  3763. c.id = a;
  3764. c.video = b;
  3765. return c
  3766. },
  3767. CLASS_NAME: "GeoGlobe.Source.VideoSource"
  3768. });
  3769. GeoGlobe.Marker = mapboxgl.Marker;
  3770. GeoGlobe.Popup = mapboxgl.Popup;
  3771. GeoGlobe.Control = mapboxgl.Control || {};
  3772. GeoGlobe.Control.Navigation = mapboxgl.NavigationControl;
  3773. GeoGlobe.Control.Attribution = mapboxgl.AttributionControl;
  3774. GeoGlobe.Control.Scale = GeoGlobe.Class4OL({
  3775. initialize: function(a) {
  3776. this.options = a;
  3777. mapboxgl.util.bindAll(["_onMove"], this)
  3778. },
  3779. getDefaultPosition: function() {
  3780. return "bottom-left"
  3781. },
  3782. _onMove: function() {
  3783. this._updateScale(this._map, this._container, this.options)
  3784. },
  3785. onAdd: function(a) {
  3786. this._map = a;
  3787. this._container = GeoGlobe.DOM.create("div", "mapboxgl-ctrl mapboxgl-ctrl-scale", a.getContainer());
  3788. this._map.on("move", this._onMove);
  3789. this._onMove();
  3790. return this._container
  3791. },
  3792. onRemove: function() {
  3793. this._container.parentNode.removeChild(this._container);
  3794. this._map.off("move", this._onMove);
  3795. this._map = void 0
  3796. },
  3797. _updateScale: function(a, b, c) {
  3798. var d = c && c.maxWidth || 100,
  3799. e = a._container.clientHeight / 2,
  3800. a = this._getDistance(a.unproject([0, e]), a.unproject([d, e]));
  3801. c && c.unit === "imperial" ? (c = 3.2808 * a, c > 5280 ? this._setScale(b, d, c / 5280, "mi") : this._setScale(b, d, c, "ft")) : this._setScale(b, d, a, "m")
  3802. },
  3803. _setScale: function(a, b, c, d) {
  3804. var e = this._getRoundNum(c),
  3805. c = e / c;
  3806. d === "m" && e >= 1E3 && (e /= 1E3, d = "km");
  3807. a.style.width = b * c + "px";
  3808. a.innerHTML = e + d
  3809. },
  3810. _getDistance: function(a, b) {
  3811. var c = null;
  3812. if (this._map.units ===
  3813. "m") c = b.lng - a.lng;
  3814. else var c = Math.PI / 180,
  3815. d = a.lat * c,
  3816. e = b.lat * c,
  3817. c = 6371E3 * Math.acos(Math.min(Math.sin(d) * Math.sin(e) + Math.cos(d) * Math.cos(e) * Math.cos((b.lng - a.lng) * c), 1));
  3818. return c
  3819. },
  3820. _getRoundNum: function(a) {
  3821. var b = Math.pow(10, ("" + Math.floor(a)).length - 1);
  3822. a /= b;
  3823. return b * (a >= 10 ? 10 : a >= 5 ? 5 : a >= 3 ? 3 : a >= 2 ? 2 : 1)
  3824. },
  3825. CLASS_NAME: "GeoGlobe.Control.Scale"
  3826. });
  3827. GeoGlobe.Control.Geolocate = mapboxgl.GeolocateControl;
  3828. GeoGlobe.Control.MapContextMenu = GeoGlobe.Class4OL({
  3829. menuDiv: null,
  3830. className: null,
  3831. contentHTML: null,
  3832. lngLat: null,
  3833. point: null,
  3834. initialize: function(a) {
  3835. GeoGlobe.Util.extend(this, a)
  3836. },
  3837. getDefaultPosition: function() {
  3838. return "top-left"
  3839. },
  3840. onAdd: function(a) {
  3841. this._map = a;
  3842. this._onContextMenu = GeoGlobe.Function.bind(this._showContextMenu, this);
  3843. this._map.on("contextmenu", this._onContextMenu);
  3844. this._onMouseDown = GeoGlobe.Function.bind(this.hide, this);
  3845. this._map.on("mousedown", this._onMouseDown);
  3846. return this._container = this._createContainer()
  3847. },
  3848. _createContainer: function() {
  3849. var a = window.document.createElement("div");
  3850. a.className = "mapboxgl-ctrl";
  3851. this.className && a.classList.add(this.className);
  3852. a.style.position = "absolute";
  3853. a.style.background = "white";
  3854. a.style.border = "1px solid #adbfe4";
  3855. a.style.zIndex = 2;
  3856. a.innerHTML = this.contentHTML ? this.contentHTML : "";
  3857. this.menuDiv = a;
  3858. this.menuDiv.onmousedown = GeoGlobe.Function.bind(function(a) {
  3859. (a || event).preventDefault();
  3860. event.stopPropagation && event.stopPropagation()
  3861. }, this);
  3862. this.hide();
  3863. return a
  3864. },
  3865. _showContextMenu: function(a) {
  3866. this.lngLat =
  3867. a.lngLat;
  3868. this.point = a.point;
  3869. this.menuDiv.style.left = a.point.x + "px";
  3870. this.menuDiv.style.top = a.point.y + "px";
  3871. this.show()
  3872. },
  3873. onRemove: function() {
  3874. this._container.parentNode.removeChild(this._container);
  3875. this._map.off("contextmenu", this._onContextMenu);
  3876. this._map.off("mousedown", this._onMouseDown);
  3877. this.contentHTML = this._container = this.menuDiv = null;
  3878. this._map = void 0
  3879. },
  3880. show: function() {
  3881. if (this.menuDiv && this.menuDiv.style.display == "none") this.menuDiv.style.display = ""
  3882. },
  3883. hide: function() {
  3884. if (this.menuDiv && this.menuDiv.style.display !=
  3885. "none") this.menuDiv.style.display = "none"
  3886. },
  3887. setContentHTML: function(a) {
  3888. if (a != null) this.contentHTML = a;
  3889. if (this.menuDiv != null && this.contentHTML != null && this.contentHTML != this.menuDiv.innerHTML) this.menuDiv.innerHTML = this.contentHTML
  3890. },
  3891. addItem: function(a) {
  3892. var b = document.createElement("div");
  3893. b.id = a.id;
  3894. b.style.cssText = "padding-bottom: 2px; line-height: 17px; margin: 0px 2px; padding-left: 6px; width:" + a.width + "px; padding-right: 6px; color: #000; font-size: 12px; cursor: pointer; padding-top: 2px;";
  3895. b.innerHTML =
  3896. "<span>" + a.text + "</span>";
  3897. b.onclick = GeoGlobe.Function.bind(function() {
  3898. a.callback({
  3899. target: a,
  3900. control: this,
  3901. map: this._map,
  3902. lngLat: this.lngLat,
  3903. point: this.point
  3904. });
  3905. this.hide()
  3906. }, this);
  3907. b.onmouseover = function() {
  3908. b.style.color = "#6688cc"
  3909. };
  3910. b.onmouseout = function() {
  3911. b.style.color = "#000"
  3912. };
  3913. this.menuDiv.appendChild(b);
  3914. this.setContentHTML(this.menuDiv.innerHTML)
  3915. },
  3916. addSeparator: function() {
  3917. var a = document.createElement("div");
  3918. a.style.cssText = "border-bottom:#adbfe4 1px solid;margin:0px 6px;font-size:0px;padding:1px";
  3919. this.menuDiv.appendChild(a);
  3920. this.setContentHTML(this.menuDiv.innerHTML)
  3921. },
  3922. mousePos: function(a, b) {
  3923. var c = a.getBoundingClientRect();
  3924. return new GeoGlobe.Point(b.clientX - c.left - a.clientLeft, b.clientY - c.top - a.clientTop)
  3925. },
  3926. CLASS_NAME: "GeoGlobe.View2D.Control.MapContextMenu"
  3927. });
  3928. GeoGlobe.MenuItem = GeoGlobe.Class4OL({
  3929. id: null,
  3930. text: null,
  3931. callback: null,
  3932. width: 100,
  3933. initialize: function(a) {
  3934. this.id = GeoGlobe.Util.createUniqueID(this.CLASS_NAME + "_");
  3935. GeoGlobe.Util.extend(this, a)
  3936. },
  3937. setText: function(a) {
  3938. this.text = a
  3939. },
  3940. CLASS_NAME: "GeoGlobe.MenuItem"
  3941. });
  3942. GeoGlobe.Control.MapCesium = GeoGlobe.Class4OL({
  3943. map: null,
  3944. viewer: null,
  3945. isPitchChanged: !1,
  3946. isHeadingChanged: !1,
  3947. _MAPBOX_MOVE: "mapbox is moving",
  3948. _CESIUM_MOVE: "cesium is moving",
  3949. _isMoving: null,
  3950. _handler: null,
  3951. _currentCesiumHeading: 0,
  3952. _currentCesiumPitch: 0,
  3953. initialize: function(a) {
  3954. this.map = a.map ? a.map : this.map;
  3955. this.viewer = a.viewer ? a.viewer : this.viewer;
  3956. this.isPitchChanged = a.isPitchChanged !== void 0 ? a.isPitchChanged : this.isPitchChanged;
  3957. this.isHeadingChanged = a.isHeadingChanged !== void 0 ? a.isHeadingChanged : this.isHeadingChanged;
  3958. this._isMoving = this._MAPBOX_MOVE;
  3959. this._isSync = !1;
  3960. this._currentCesiumHeading = 0;
  3961. this._currentCesiumPitch = -Cesium.Math.PI_OVER_TWO;
  3962. this._handler = new Cesium.ScreenSpaceEventHandler(this.viewer.canvas);
  3963. this._bindEvent();
  3964. this._updateCesium()
  3965. },
  3966. _bindEvent: function() {
  3967. if (this.map && !this._handler.getInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE)) {
  3968. var a = this;
  3969. this.map.on("move", function() {
  3970. a._isSync && a._updateCesium()
  3971. });
  3972. this.map.on("mouseover", function() {
  3973. a._isMoving = a._MAPBOX_MOVE
  3974. });
  3975. this._handler.setInputAction(function() {
  3976. a._isMoving =
  3977. a._CESIUM_MOVE;
  3978. a._currentCesiumHeading = a.viewer.camera.heading;
  3979. a._currentCesiumPitch = a.viewer.camera.pitch
  3980. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  3981. this.viewer.canvas.addEventListener("mouseout", function() {
  3982. a._isMoving = a._MAPBOX_MOVE
  3983. });
  3984. this.viewer.scene.preRender.addEventListener(function() {
  3985. a._isSync && a._updateMapbox()
  3986. })
  3987. }
  3988. },
  3989. setEnabled: function(a) {
  3990. this._isSync = a
  3991. },
  3992. _unbindEvent: function() {
  3993. if (this.map) {
  3994. for (var a = 0; a < this.map._listeners.move.length; a++) this.map._listeners.move[a].name && this.map._listeners.move[a].name ===
  3995. "MAPCESIUM_MOVE_EVENT" && this.map._listeners.move.splice(a, 1);
  3996. for (a = 0; a < this.map._listeners.mouseover.length; a++) this.map._listeners.mouseover[a].name && this.map._listeners.mouseover[a].name === "MAPCESIUM_MOVEOVER_EVENT" && this.map._listeners.mouseover.splice(a, 1);
  3997. for (a = 0; a < this.viewer.scene.preRender._listeners.length; a++) this.viewer.scene.preRender._listeners[a].name === "CESIUM_RENDER_EVENT" && this.viewer.scene.preRender._listeners.splice(a, 1);
  3998. this._handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE)
  3999. }
  4000. },
  4001. destroy: function() {
  4002. if (this.map) this._unbindEvent(), this.viewer = this._handler = this.map = null
  4003. },
  4004. _calDistanceFromMapboxToCesium: function() {
  4005. return this.map.transform.cameraToCenterDistance * (78271.51696402031 / Math.pow(2, this.map.getZoom() + 1.2))
  4006. },
  4007. _calHeadingFromMapboxToCesium: function() {
  4008. var a = this.map.getBearing();
  4009. return Cesium.Math.toRadians(a)
  4010. },
  4011. _calPitchFromMapboxToCesium: function() {
  4012. var a = this.map.getPitch();
  4013. return Cesium.Math.toRadians(a - 90)
  4014. },
  4015. _calDestinationFromMapboxToCesium: function() {
  4016. var a = new Cesium.Cartographic(Cesium.Math.toRadians(this.map.getCenter().lng),
  4017. Cesium.Math.toRadians(this.map.getCenter().lat));
  4018. return Cesium.Ellipsoid.WGS84.cartographicToCartesian(a)
  4019. },
  4020. _getCenterPoint: function() {
  4021. var a = this.viewer.canvas,
  4022. a = new Cesium.Cartesian2(a.clientWidth / 2, a.clientHeight / 2);
  4023. return this.viewer.scene.globe.pick(this.viewer.camera.getPickRay(a), this.viewer.scene) || this.viewer.camera.pickEllipsoid(a)
  4024. },
  4025. _updateCesium: function() {
  4026. if (this._isMoving !== this._CESIUM_MOVE) {
  4027. var a = this._calDistanceFromMapboxToCesium(),
  4028. b, c;
  4029. c = this.isHeadingChanged ? this._calHeadingFromMapboxToCesium() :
  4030. this._currentCesiumHeading;
  4031. b = this.isPitchChanged ? this._calPitchFromMapboxToCesium() : this._currentCesiumPitch;
  4032. this.viewer.camera.setView({
  4033. destination: this._calDestinationFromMapboxToCesium(),
  4034. orientation: {
  4035. heading: c,
  4036. pitch: b
  4037. }
  4038. });
  4039. this.viewer.camera.moveBackward(a)
  4040. }
  4041. },
  4042. _updateMapbox: function() {
  4043. if (this.viewer && this._isMoving !== this._MAPBOX_MOVE) {
  4044. var a = Cesium.Ellipsoid.WGS84,
  4045. b = 0,
  4046. c = 0,
  4047. c = this._getCenterPoint();
  4048. if (!c) b = this.viewer.scene.globe, c = this.viewer.camera.positionCartographic.clone(), b = b.getHeight(c), c.height =
  4049. b || 0, c = a.cartographicToCartesian(c);
  4050. var b = Cesium.Cartesian3.distance(c, this.viewer.camera.position) / this.map.transform.cameraToCenterDistance,
  4051. b = Math.log2(78271.51696402031 / b) - 1.2,
  4052. d = a.cartesianToCartographic(c),
  4053. d = [Cesium.Math.toDegrees(d.longitude), Cesium.Math.toDegrees(d.latitude)];
  4054. this.map.setZoom(b);
  4055. this.map.setCenter(d);
  4056. if (c) {
  4057. var b = this.viewer.camera.up,
  4058. d = this.viewer.camera.right,
  4059. e = new Cesium.Cartesian3(-c.y, c.x, 0),
  4060. d = Cesium.Cartesian3.angleBetween(d, e),
  4061. b = Cesium.Cartesian3.cross(c, b, new Cesium.Cartesian3).z <
  4062. 0 ? -d : d,
  4063. b = Cesium.Math.toDegrees(b),
  4064. d = this.viewer.camera.position,
  4065. e = new Cesium.Cartesian3;
  4066. a.geocentricSurfaceNormal(c, e);
  4067. a = new Cesium.Cartesian3;
  4068. Cesium.Cartesian3.subtract(d, c, a);
  4069. Cesium.Cartesian3.normalize(a, a);
  4070. a = Math.acos(Cesium.Cartesian3.dot(e, a));
  4071. c = isNaN(a) ? 0 : a
  4072. } else b = Cesium.Math.toDegrees(this.viewer.camera.heading), c = Cesium.Math.PI_OVER_THREE;
  4073. this.isHeadingChanged && this.map.setBearing(b);
  4074. this.isPitchChanged && this.map.setPitch(Cesium.Math.toDegrees(c))
  4075. }
  4076. },
  4077. CLASS_NAME: "GeoGlobe.View2D.Control.MapCesium"
  4078. });
  4079. GeoGlobe.Control.Fullscreen = mapboxgl.FullscreenControl;
  4080. GeoGlobe.Control.Print = GeoGlobe.Class({
  4081. initialize: function() {
  4082. this._printHandler = GeoGlobe.Function.bind(this.printHandler, this)
  4083. },
  4084. getDefaultPosition: function() {
  4085. return "top-right"
  4086. },
  4087. onAdd: function(a) {
  4088. this._map = a;
  4089. this._container = GeoGlobe.DOM.create("div", "mapboxgl-ctrl mapboxgl-ctrl-group");
  4090. GeoGlobe.DOM.create("button", "mapboxgl-ctrl-icon mapboxgl-ctrl-fullscreen", this._container);
  4091. this._container.addEventListener("click", this._printHandler);
  4092. return this._container
  4093. },
  4094. onRemove: function() {
  4095. this._container.removeEventListener("click",
  4096. this._printHandler)
  4097. },
  4098. printHandler: function() {
  4099. GeoGlobe.Util.download(this._map.getCanvas().toDataURL(), "\u5730\u56fe.png")
  4100. },
  4101. CLASS_NAME: "GeoGlobe.Control.Print"
  4102. });
  4103. GeoGlobe.Control.FeaturesSelect = GeoGlobe.Class({
  4104. map: null,
  4105. feature: null,
  4106. flag: !0,
  4107. idArr: [],
  4108. setting: {
  4109. bbox: 0,
  4110. highLight: !0,
  4111. clearBlank: !0,
  4112. highLightStyle: {
  4113. pointColor: "",
  4114. pointRadius: "",
  4115. pointOpacity: "",
  4116. lineColor: "",
  4117. lineWidth: "",
  4118. lineOpacity: "",
  4119. strokeColor: "",
  4120. strokeWidth: "",
  4121. strokeOpacity: "",
  4122. fillColor: "",
  4123. fillOpacity: ""
  4124. }
  4125. },
  4126. callback: {
  4127. onClick: null
  4128. },
  4129. initialize: function(a) {
  4130. GeoGlobe.Util.extend(this, a);
  4131. if (!this.setting.bbox) this.setting.bbox = 0;
  4132. this._bindAll()
  4133. },
  4134. _bindAll: function() {
  4135. var a = this.map,
  4136. b = this;
  4137. a.on("click", function(c) {
  4138. b.idArr.length ||
  4139. a.getStyle().layers.forEach(function(a) {
  4140. b.idArr.push(a.id)
  4141. });
  4142. if (b.flag) {
  4143. var d = b.setting.bbox,
  4144. e = c.point;
  4145. d && (e = [
  4146. [c.point.x - d, c.point.y - d],
  4147. [c.point.x + d, c.point.y + d]
  4148. ]);
  4149. c = a.queryRenderedFeatures(e, {
  4150. layers: b.idArr
  4151. });
  4152. b.setting && b.setting.highLight && c.length ? (b._highLightGeometry(c[0]), b.feature = c[0]) : b.setting.clearBlank && b._removeHighLightGeometry();
  4153. if (b.callback.onClick && typeof b.callback.onClick === "function") b.callback.onClick(c)
  4154. }
  4155. })
  4156. },
  4157. _highLightGeometry: function(a) {
  4158. var b = this.map,
  4159. c = a.geometry,
  4160. d = a.properties,
  4161. e = c.type,
  4162. c = {
  4163. type: "geojson",
  4164. data: {
  4165. type: "FeatureCollection",
  4166. features: [{
  4167. type: "Feature",
  4168. properties: d,
  4169. geometry: c
  4170. }]
  4171. }
  4172. },
  4173. f = "GeoGlobe_Features_Selected_High_Light_" + e,
  4174. g = b.getSource(f),
  4175. h;
  4176. if (e == "Point") this._removeHighLightGeometry("LineString"), this._removeHighLightGeometry("Polygon"), e = {
  4177. id: f,
  4178. type: "circle",
  4179. source: c,
  4180. paint: {
  4181. "circle-color": this.setting.highLightStyle.pointColor || "#D20C0C",
  4182. "circle-opacity": this.setting.highLightStyle.pointOpacity || 1,
  4183. "circle-radius": this.setting.highLightStyle.pointRadius || 5
  4184. }
  4185. };
  4186. else if (e ==
  4187. "LineString") this._removeHighLightGeometry("Point"), this._removeHighLightGeometry("Polygon"), e = {
  4188. id: f,
  4189. type: "line",
  4190. source: c,
  4191. paint: {
  4192. "line-color": this.setting.highLightStyle.lineColor || "#D20C0C",
  4193. "line-opacity": this.setting.highLightStyle.lineOpacity || 1,
  4194. "line-width": this.setting.highLightStyle.lineWidth || 3
  4195. }
  4196. };
  4197. else if (e == "Polygon") {
  4198. if (this._removeHighLightGeometry("Point"), this._removeHighLightGeometry("LineString"), e = {
  4199. id: f,
  4200. type: "fill",
  4201. source: c,
  4202. paint: {
  4203. "fill-color": this.setting.highLightStyle.fillColor ||
  4204. "#D20C0C",
  4205. "fill-opacity": this.setting.highLightStyle.fillOpacity || 0.5
  4206. }
  4207. }, this.setting.highLightStyle.strokeColor || this.setting.highLightStyle.strokeColor) h = {
  4208. id: f + "2",
  4209. type: "line",
  4210. source: f,
  4211. paint: {
  4212. "line-color": this.setting.highLightStyle.strokeColor || "#D20C0C",
  4213. "line-opacity": this.setting.highLightStyle.strokeOpacity || 1,
  4214. "line-width": this.setting.highLightStyle.strokeWidth || 3
  4215. }
  4216. }
  4217. } else throw Error("\u53ea\u652f\u6301Point,LineString,Polygon,\u4e09\u79cd\u7c7b\u578b\u7684\u70b9\u51fb\u9ad8\u4eae");
  4218. g ? g.setData(c.data) :
  4219. (b.addLayer(e), h && b.addLayer(h));
  4220. h = ["any"];
  4221. if (d) {
  4222. for (var j in d) j && h.push(["!=", ["get", j], d[j]]);
  4223. h.length > 1 && b.setFilter(a.layer.id, h)
  4224. }
  4225. },
  4226. _removeHighLightGeometry: function(a) {
  4227. var b = this.map;
  4228. a ? (a = "GeoGlobe_Features_Selected_High_Light_" + a, b.getLayer(a) && (b.removeLayer(a), b.getLayer(a + "2") && b.removeLayer(a + "2"), b.removeSource(a), b.setFilter(this.feature.layer.id, null))) : (this._removeHighLightGeometry("Point"), this._removeHighLightGeometry("LineString"), this._removeHighLightGeometry("Polygon"))
  4229. },
  4230. enable: function() {
  4231. this.flag = !0
  4232. },
  4233. disable: function() {
  4234. this.flag = !1
  4235. },
  4236. CLASS_NAME: "GeoGlobe.Control.FeaturesSelect"
  4237. });
  4238. GeoGlobe.Control.GeoOverview = GeoGlobe.Class({
  4239. getDefaultPosition: function() {
  4240. return "bottom-right"
  4241. },
  4242. initialize: function(a) {
  4243. GeoGlobe.Util.extend(this, a)
  4244. },
  4245. onAdd: function(a) {
  4246. this._container = GeoGlobe.DOM.create("div", "mapboxgl-ctrl mapboxgl-ctrl-group");
  4247. this.map = a;
  4248. var b = this,
  4249. c = [],
  4250. c = b.layers && b.layers.length > 0 ? b.layers : [new GeoGlobe.TDTLayer("vec_c"), new GeoGlobe.TDTLayer("cva_c")];
  4251. document.getElementById(b.map._container.id).insertAdjacentHTML("beforeend", "<div class = 'geoOverview'><div id='geoOverviewMap'></div><button type='button' class='overviewMapTarget'><span>\u00bb</span></button></div>");
  4252. var d = new GeoGlobe.Map({
  4253. mapCRS: b.map._mapCRS,
  4254. container: b.el || "geoOverviewMap",
  4255. zoom: b.map.getZoom() - 5 > 0 ? b.map.getZoom() - 5 : 0,
  4256. center: b.map.getCenter(),
  4257. interactive: !1
  4258. });
  4259. d.on("load", function() {
  4260. for (var e = 0; e < c.length; e++) d.addLayer(c[e]);
  4261. b._toGeoJson();
  4262. e = document.createElement("div");
  4263. e.id = "OverviewMapMarker";
  4264. var f = (new mapboxgl.Marker(e, {
  4265. draggable: !0
  4266. })).setLngLat(a.getCenter()).addTo(d);
  4267. f.on("dragend", function() {
  4268. var a = f.getLngLat();
  4269. b.map.setCenter(a)
  4270. });
  4271. b.map.on("move", function() {
  4272. var c = b.map.getCenter(),
  4273. e = b.map.getZoom() - 5 > 0 ? a.getZoom() - 5 : 0;
  4274. b.map.getBearing();
  4275. b.map.getPitch();
  4276. d.jumpTo({
  4277. center: c,
  4278. zoom: e
  4279. });
  4280. f.setLngLat(c);
  4281. b._toGeoJson()
  4282. })
  4283. });
  4284. b.geoOverviewMap = d;
  4285. b._bindEvent();
  4286. return this._container
  4287. },
  4288. _bindEvent: function() {
  4289. document.getElementsByClassName("overviewMapTarget")[0].onclick = function() {
  4290. var a = document.getElementById("geoOverviewMap"),
  4291. b = document.querySelectorAll(".overviewMapTarget span")[0];
  4292. a.style.display == "none" ? (a.style.display = "block", b.innerHTML = "\u00bb") : (a.style.display = "none", b.innerHTML =
  4293. "\u00ab")
  4294. }
  4295. },
  4296. _toGeoJson: function() {
  4297. var a = this.map.getBounds(),
  4298. b = [];
  4299. b.push([a._ne.lng, a._ne.lat]);
  4300. b.push([a._ne.lng, a._sw.lat]);
  4301. b.push([a._sw.lng, a._sw.lat]);
  4302. b.push([a._sw.lng, a._ne.lat]);
  4303. b.push([a._ne.lng, a._ne.lat]);
  4304. a = (new GeoGlobe.Format.GeoJSONUtil).line(b);
  4305. b = (new GeoGlobe.Format.GeoJSONUtil).polygon([b]);
  4306. this._addOverLayer([a, b])
  4307. },
  4308. _addOverLayer: function(a) {
  4309. this._removeOverLayer();
  4310. this.geoOverviewMap.addSource("geoOverviewMap-polygon-source", a[0]);
  4311. this.geoOverviewMap.addLayer({
  4312. id: "geoOverviewMap-polygon-layer",
  4313. type: "fill",
  4314. source: "geoOverviewMap-polygon-source",
  4315. paint: {
  4316. "fill-color": "#627BC1",
  4317. "fill-opacity": 0.5
  4318. }
  4319. });
  4320. this.geoOverviewMap.addSource("geoOverviewMap-line-source", a[1]);
  4321. this.geoOverviewMap.addLayer({
  4322. id: "geoOverviewMap-line-layer",
  4323. type: "line",
  4324. source: "geoOverviewMap-line-source",
  4325. paint: {
  4326. "line-color": "#2e34c5",
  4327. "line-width": 2,
  4328. "line-dasharray": [3, 2],
  4329. "line-opacity": 0.8
  4330. }
  4331. })
  4332. },
  4333. _removeOverLayer: function() {
  4334. this.geoOverviewMap.getSource("geoOverviewMap-polygon-source") && this.geoOverviewMap.removeLayer("geoOverviewMap-polygon-layer") &&
  4335. this.geoOverviewMap.removeSource("geoOverviewMap-polygon-source");
  4336. this.geoOverviewMap.getSource("geoOverviewMap-line-source") && this.geoOverviewMap.removeLayer("geoOverviewMap-line-layer") && this.geoOverviewMap.removeSource("geoOverviewMap-line-source")
  4337. },
  4338. onRemove: function() {
  4339. this.geoOverviewMap.remove();
  4340. var a = document.getElementsByClassName("geoOverview")[0];
  4341. a && a.parentNode.removeChild(a)
  4342. },
  4343. CLASS_NAME: "GeoGlobe.Control.GeoOverview"
  4344. });
  4345. if (window.MapboxDraw && MapboxDraw) {
  4346. var doubleClickZoom = {
  4347. enable: function(a) {
  4348. setTimeout(function() {
  4349. a.map && a.map.doubleClickZoom && a._ctx && a._ctx.store && a._ctx.store.getInitialConfigValue && a._ctx.store.getInitialConfigValue("doubleClickZoom") && a.map.doubleClickZoom.enable()
  4350. }, 0)
  4351. },
  4352. disable: function(a) {
  4353. setTimeout(function() {
  4354. a.map && a.map.doubleClickZoom && a.map.doubleClickZoom.disable()
  4355. }, 0)
  4356. }
  4357. };
  4358. MapboxDraw.modes.draw_square = {
  4359. onSetup: function() {
  4360. var a = this.newFeature({
  4361. type: "Feature",
  4362. properties: {},
  4363. geometry: {
  4364. type: "Polygon",
  4365. coordinates: [
  4366. []
  4367. ]
  4368. }
  4369. });
  4370. this.addFeature(a);
  4371. this.clearSelectedFeatures();
  4372. doubleClickZoom.disable(this);
  4373. this.updateUIClasses({
  4374. mouse: "add"
  4375. });
  4376. this.setActionableState({
  4377. trash: !0
  4378. });
  4379. return {
  4380. square: a
  4381. }
  4382. },
  4383. onTap: function(a, b) {
  4384. if (a.startPoint) this.onMouseMove(a, b);
  4385. this.onClick(a, b)
  4386. },
  4387. onClick: function(a, b) {
  4388. a.startPoint && a.startPoint[0] !== b.lngLat.lng && a.startPoint[1] !== b.lngLat.lat && (this.updateUIClasses({
  4389. mouse: "pointer"
  4390. }), this.changeMode("simple_select", {
  4391. featuresId: a.square.id
  4392. }));
  4393. a.startPoint = [b.lngLat.lng, b.lngLat.lat]
  4394. },
  4395. onMouseMove: function(a, b) {
  4396. if (a.startPoint) {
  4397. var c = b.lngLat.lng - a.startPoint[0],
  4398. d = b.lngLat.lat - a.startPoint[1],
  4399. e = Math.max(Math.abs(c), Math.abs(d)),
  4400. c = a.startPoint[0] + e * (c > 0 ? 1 : -1),
  4401. d = a.startPoint[1] + e * (d > 0 ? 1 : -1);
  4402. a.square.updateCoordinate("0.0", a.startPoint[0], a.startPoint[1]);
  4403. a.square.updateCoordinate("0.1", c, a.startPoint[1]);
  4404. a.square.updateCoordinate("0.2", c, d);
  4405. a.square.updateCoordinate("0.3", a.startPoint[0], d);
  4406. a.square.updateCoordinate("0.4", a.startPoint[0], a.startPoint[1])
  4407. }
  4408. },
  4409. onKeyUp: function(a, b) {
  4410. if (b.keyCode ===
  4411. 27) return this.changeMode("simple_select")
  4412. },
  4413. onStop: function(a) {
  4414. doubleClickZoom.enable(this);
  4415. this.updateUIClasses({
  4416. mouse: "none"
  4417. });
  4418. this.activateUIButton();
  4419. this.getFeature(a.square.id) !== void 0 && (a.square.removeCoordinate("0.4"), a.square.isValid() ? this.map.fire("draw.create", {
  4420. features: [a.square.toGeoJSON()]
  4421. }) : (this.deleteFeature([a.square.id], {
  4422. silent: !0
  4423. }), this.changeMode("simple_select", {}, {
  4424. silent: !0
  4425. })))
  4426. },
  4427. toDisplayFeatures: function(a, b, c) {
  4428. var d = b.properties.id === a.square.id;
  4429. b.properties.active = d ? "true" :
  4430. "false";
  4431. if (!d) return c(b);
  4432. if (a.startPoint) return c(b)
  4433. },
  4434. onTrash: function(a) {
  4435. this.deleteFeature([a.square.id], {
  4436. silent: !0
  4437. });
  4438. this.changeMode("simple_select")
  4439. }
  4440. };
  4441. var CircleMode = {},
  4442. origon, snapAngle, angle, sides, destination, id;
  4443. CircleMode.onSetup = function(a) {
  4444. destination = {};
  4445. origon = null;
  4446. sides = a.sides || 40;
  4447. sides < 40 && (sides = 40);
  4448. a = this.newFeature({
  4449. type: "Feature",
  4450. geometry: {
  4451. type: "Polygon",
  4452. coordinates: [
  4453. []
  4454. ]
  4455. },
  4456. properties: {}
  4457. });
  4458. this.addFeature(a);
  4459. this.clearSelectedFeatures();
  4460. this.updateUIClasses({
  4461. mouse: "add"
  4462. });
  4463. this.activateUIButton("polygon");
  4464. this.setActionableState({
  4465. trash: !0
  4466. });
  4467. return {
  4468. polygon: a,
  4469. id: a,
  4470. currentVertexPosition: 0
  4471. }
  4472. };
  4473. CircleMode.onClick = function(a, b) {
  4474. origon = {
  4475. x: b.lngLat.lng,
  4476. y: b.lngLat.lat
  4477. };
  4478. if (a.currentVertexPosition > 0 && destination && destination.x == origon.x && destination.y == origon.y) return this.changeMode("simple_select", {
  4479. featureIds: [a.polygon.id]
  4480. });
  4481. angle = Math.PI * (1 / sides - 0.5);
  4482. snapAngle && (angle += snapAngle * (Math.PI / 180));
  4483. var c = getcircle(origon, 0.0439453125, sides, snapAngle);
  4484. this.updateUIClasses({
  4485. mouse: "add"
  4486. });
  4487. this.deleteFeature([a.id], {
  4488. silent: !0
  4489. });
  4490. a.currentVertexPosition++;
  4491. a.polygon.coordinates = [c];
  4492. this.addFeature(a.polygon)
  4493. };
  4494. CircleMode.onMouseMove = function(a, b) {
  4495. if (origon) {
  4496. destination = {
  4497. x: b.lngLat.lng,
  4498. y: b.lngLat.lat
  4499. };
  4500. calculateAngle(destination);
  4501. var c = distanceTo(destination),
  4502. c = getcircle(origon, c, sides, snapAngle);
  4503. this.deleteFeature([id], {
  4504. silent: !0
  4505. });
  4506. a.polygon.coordinates = [c];
  4507. this.addFeature(a.polygon)
  4508. }
  4509. };
  4510. CircleMode.onKeyUp = function(a, b) {
  4511. if (b.keyCode === 27) return this.changeMode("simple_select")
  4512. };
  4513. CircleMode.toDisplayFeatures = function(a,
  4514. b, c) {
  4515. c(b)
  4516. };
  4517. CircleMode.onTrash = function(a) {
  4518. this.deleteFeature([a.polygon.id], {
  4519. silent: !0
  4520. });
  4521. this.changeMode("simple_select")
  4522. };
  4523. var calculateAngle = function(a, b) {
  4524. var c = Math.atan2(a.y - origon.y, a.x - origon.x);
  4525. if (snapAngle && this.snapToggle && !b[this.snapToggle]) {
  4526. var d = Math.PI / 180 * snapAngle;
  4527. angle = Math.round(c / d) * d
  4528. } else angle = c
  4529. },
  4530. distanceTo = function(a, b) {
  4531. var c = !(b && b.edge === !1) && b && b.details,
  4532. d, e, f, g, h;
  4533. e = origon.x;
  4534. f = origon.y;
  4535. g = a.x;
  4536. h = a.y;
  4537. d = Math.sqrt(Math.pow(e - g, 2) + Math.pow(f - h, 2));
  4538. return !c ? d : {
  4539. x0: e,
  4540. y0: f,
  4541. x1: g,
  4542. y1: h,
  4543. distance: d
  4544. }
  4545. },
  4546. getcircle = function(a, b, c, d) {
  4547. var e = Math.PI * (1 / c - 0.5);
  4548. d && (e += d / 180 * Math.PI);
  4549. for (var f, g = [], h = 0; h < c; ++h) f = e + h * 2 * Math.PI / c, d = a.x + b * Math.cos(f), f = a.y + b * Math.sin(f), g.push([d, f]);
  4550. return g
  4551. };
  4552. MapboxDraw.modes.draw_circle = CircleMode;
  4553. MapboxDraw.modes.draw_ellipse = {
  4554. onSetup: function(a) {
  4555. this.eccentricity = a.eccentricity >= 0 && a.eccentricity < 1 ? a.eccentricity : 0.8;
  4556. this.divisions = a.divisions || 60;
  4557. a = this.newFeature({
  4558. type: "Feature",
  4559. properties: {},
  4560. geometry: {
  4561. type: "Polygon",
  4562. coordinates: [
  4563. []
  4564. ]
  4565. }
  4566. });
  4567. this.addFeature(a);
  4568. this.clearSelectedFeatures();
  4569. doubleClickZoom.disable(this);
  4570. this.updateUIClasses({
  4571. mouse: "add"
  4572. });
  4573. this.setActionableState({
  4574. trash: !0
  4575. });
  4576. return {
  4577. ellipse: a
  4578. }
  4579. },
  4580. onTap: function(a, b) {
  4581. if (a.center) this.onMouseMove(a, b);
  4582. this.onClick(a, b)
  4583. },
  4584. onClick: function(a, b) {
  4585. a.center && a.center[0] !== b.lngLat.lng && a.center[1] !== b.lngLat.lat && (this.updateUIClasses({
  4586. mouse: "pointer"
  4587. }), this.changeMode("simple_select", {
  4588. featuresId: a.ellipse.id
  4589. }));
  4590. a.center = [b.lngLat.lng, b.lngLat.lat]
  4591. },
  4592. onMouseMove: function(a, b) {
  4593. if (a.center)
  4594. for (var c = Math.sqrt(Math.pow(b.lngLat.lng -
  4595. a.center[0], 2) + Math.pow(b.lngLat.lat - a.center[1], 2)), d = c * Math.sqrt(1 - Math.pow(this.eccentricity, 2)), e = Math.atan2(b.lngLat.lat - a.center[1], b.lngLat.lng - a.center[0]), f = Math.PI * 2, g = 0, h = this.divisions; g <= h; g++) {
  4596. var j = g / h * f,
  4597. l = a.center[0] + c * Math.cos(j),
  4598. m = a.center[1] + d * Math.sin(j);
  4599. if (e !== 0) {
  4600. var j = Math.cos(e),
  4601. n = Math.sin(e),
  4602. p = l - a.center[0];
  4603. m -= a.center[1];
  4604. l = p * j - m * n + a.center[0];
  4605. m = p * n + m * j + a.center[1]
  4606. }
  4607. a.ellipse.updateCoordinate("0." + g, l, m)
  4608. }
  4609. },
  4610. onKeyUp: function(a, b) {
  4611. if (b.keyCode === 27) return this.changeMode("simple_select")
  4612. },
  4613. onStop: function(a) {
  4614. doubleClickZoom.enable(this);
  4615. this.updateUIClasses({
  4616. mouse: "none"
  4617. });
  4618. this.activateUIButton();
  4619. this.getFeature(a.ellipse.id) !== void 0 && (a.ellipse.isValid() ? this.map.fire("draw.create", {
  4620. features: [a.ellipse.toGeoJSON()]
  4621. }) : (this.deleteFeature([a.ellipse.id], {
  4622. silent: !0
  4623. }), this.changeMode("simple_select", {}, {
  4624. silent: !0
  4625. })))
  4626. },
  4627. toDisplayFeatures: function(a, b, c) {
  4628. var d = b.properties.id === a.ellipse.id;
  4629. b.properties.active = d ? "true" : "false";
  4630. if (!d) return c(b);
  4631. if (a.center) return c(b)
  4632. },
  4633. onTrash: function(a) {
  4634. this.deleteFeature([a.ellipse.id], {
  4635. silent: !0
  4636. });
  4637. this.changeMode("simple_select")
  4638. }
  4639. };
  4640. GeoGlobe.Control.Draw = MapboxDraw
  4641. } else GeoGlobe.Control.Draw = GeoGlobe.Class4OL({
  4642. initialize: function() {
  4643. throw Error("\u8bf7\u5148\u5f15\u5165mapbox-gl-draw\u63d2\u4ef6\uff01");
  4644. },
  4645. CLASS_NAME: "GeoGlobe.Control.Draw"
  4646. });
  4647. GeoGlobe.Control.Measure = window.turf && turf && window.MapboxDraw && MapboxDraw ? GeoGlobe.Class4OL({
  4648. hasTools: !1,
  4649. drawOptions: {
  4650. displayControlsDefault: !1
  4651. },
  4652. initialize: function(a) {
  4653. this.hasTools = a.hasTools;
  4654. if (a.drawOptions && JSON.stringify(a.drawOptions) != "{}") this.drawOptions = a.drawOptions;
  4655. this.areaPopupWindow = this.linePopupWindow = void 0;
  4656. this.isMeasureType = "";
  4657. this.measureMethod = this.measureMethod.bind(this)
  4658. },
  4659. onAdd: function(a) {
  4660. this.map = a;
  4661. this.mapMeasureDrawTool = new GeoGlobe.Control.Draw(this.drawOptions);
  4662. this.map.addControl(this.mapMeasureDrawTool,
  4663. "top-left");
  4664. console.log("mapMeasureDrawTool loaded");
  4665. if (!this.hasTools) return this.container = document.createElement("div");
  4666. this.initMeasureToolControl();
  4667. this.lineButton.addEventListener("click", this.measureFunc("line"));
  4668. this.areaButton.addEventListener("click", this.measureFunc("polygon"));
  4669. return this.container
  4670. },
  4671. measureFunc: function(a) {
  4672. a == "line" ? (this.clearMeasure(), this.isMeasureType = "line", this.map.on("draw.create", this.measureMethod), this.mapMeasureDrawTool.changeMode("draw_line_string")) : (this.clearMeasure(),
  4673. this.isMeasureType = "polygon", this.map.on("draw.create", this.measureMethod), this.mapMeasureDrawTool.changeMode("draw_polygon"))
  4674. },
  4675. clearMeasure: function() {
  4676. this.isMeasureType = "";
  4677. this.mapMeasureDrawTool.deleteAll();
  4678. if (this.linePopupWindow) this.linePopupWindow.remove(), this.linePopupWindow = void 0;
  4679. if (this.areaPopupWindow) this.areaPopupWindow.remove(), this.areaPopupWindow = void 0
  4680. },
  4681. measureMethod: function() {
  4682. var a = this.mapMeasureDrawTool.getAll();
  4683. if (a.features.length > 0)
  4684. if (this.isMeasureType === "line") {
  4685. var b = a.features[0].geometry.coordinates,
  4686. b = b[b.length - 1],
  4687. a = Math.round(turf.lineDistance(a) * 1E3) / 1E3;
  4688. this.linePopupWindow = new mapboxgl.Popup({
  4689. closeButton: !1,
  4690. closeOnClick: !1
  4691. });
  4692. this.linePopupWindow.setLngLat(b).setHTML("<div>\u8ddd\u79bb\uff1a" + a + " (km)</div>").addTo(this.map)
  4693. } else if (this.isMeasureType === "polygon") b = turf.centroid(a).geometry.coordinates, a = Math.round(turf.area(a) / 1E6 * 1E3) / 1E3, this.areaPopupWindow = new mapboxgl.Popup({
  4694. closeButton: !1,
  4695. closeOnClick: !1
  4696. }), this.areaPopupWindow.setLngLat(b).setHTML("<div>\u9762\u79ef\uff1a" + a + " (km\u00b2)</div>").addTo(this.map);
  4697. this.map.off("draw.create", this.measureMethod)
  4698. },
  4699. initMeasureToolControl: function() {
  4700. this.container = document.createElement("div");
  4701. this.container.classList.add("mapboxgl-ctrl");
  4702. this.container.classList.add("mapboxgl-ctrl-group");
  4703. this.lineButton = document.createElement("button");
  4704. this.lineButton.classList.add("mapboxgl-ctrl-measure-line-tool");
  4705. this.lineButton.title = "\u6d4b\u8ddd";
  4706. this.lineButton.innerHTML = "\u6d4b\u8ddd";
  4707. this.container.appendChild(this.lineButton);
  4708. this.areaButton = document.createElement("button");
  4709. this.areaButton.classList.add("mapboxgl-ctrl-measure-area-tool");
  4710. this.areaButton.title = "\u6d4b\u9762";
  4711. this.areaButton.innerHTML = "\u6d4b\u9762";
  4712. this.container.appendChild(this.areaButton)
  4713. },
  4714. onRemove: function() {
  4715. this.container.parentNode.removeChild(this.container);
  4716. this.map = void 0
  4717. },
  4718. CLASS_NAME: "GeoGlobe.Control.Measure"
  4719. }) : GeoGlobe.Class4OL({
  4720. initialize: function() {
  4721. if (!window.MapboxDraw) throw Error("\u8bf7\u5148\u5f15\u5165mapbox-gl-draw\u63d2\u4ef6\uff01");
  4722. if (!window.turf) throw Error("\u8bf7\u5148\u5f15\u5165turf\u63d2\u4ef6\uff01");
  4723. },
  4724. CLASS_NAME: "GeoGlobe.Control.Measure"
  4725. });
  4726. GeoGlobe.Event = mapboxgl.Evented;
  4727. GeoGlobe.Event.MapMouseEvent = mapboxgl.Event;
  4728. GeoGlobe.Event.MapTouchEvent = mapboxgl.Event;
  4729. GeoGlobe.Event.mapDataEvent = mapboxgl.Event;
  4730. GeoGlobe.Event.mapBoxZoomEvent = mapboxgl.Event;
  4731. GeoGlobe.Handler = GeoGlobe.Class({
  4732. initialize: function() {},
  4733. CLASS_NAME: "GeoGlobe.Handler"
  4734. });
  4735. GeoGlobe.BoxHandler3D = GeoGlobe.Class4OL({
  4736. initialize: function(a) {
  4737. this._map = a;
  4738. this._el = a.getCanvasContainer();
  4739. this._container = a.getContainer();
  4740. this._onMouseDown = this._onMouseDown.bind(this);
  4741. this._onMouseMove = this._onMouseMove.bind(this);
  4742. this._onMouseUp = this._onMouseUp.bind(this);
  4743. this._onKeyDown = this._onKeyDown.bind(this)
  4744. },
  4745. isEnabled: function() {
  4746. return !!this._enabled
  4747. },
  4748. isActive: function() {
  4749. return !!this._active
  4750. },
  4751. enable: function() {
  4752. if (!this.isEnabled()) this._el.addEventListener("mousedown", this._onMouseDown, !1), this._enabled = !0
  4753. },
  4754. disable: function() {
  4755. if (this.isEnabled()) this._el.removeEventListener("mousedown", this._onMouseDown), this._enabled = !1
  4756. },
  4757. _onMouseDown: function(a) {
  4758. if (a.button === 0) window.document.addEventListener("mousemove", this._onMouseMove, !1), window.document.addEventListener("keydown", this._onKeyDown, !1), window.document.addEventListener("mouseup", this._onMouseUp, !1), GeoGlobe.DOM.disableDrag(), this._startPos = GeoGlobe.DOM.mousePos(this._el, a), this._active = !0
  4759. },
  4760. _onMouseMove: function(a) {
  4761. var b = this._startPos,
  4762. c = GeoGlobe.DOM.mousePos(this._el, a);
  4763. if (!this._box) this._box = GeoGlobe.DOM.create("canvas", "geoglobe-boxhandler3d", this._container), this._box.style.position = "absolute", this._box.width = this._map.transform.width, this._box.height = this._map.transform.height, this._boxContext = this._box.getContext("2d"), this._boxContext.lineWidth = 2, this._boxContext.globalAlpha = 0.7, this._boxContext.fillStyle = "#a09e9e", this._boxContext.strokeStyle = "#b90909", this._boxContext.setLineDash([2, 2]), this._container.classList.add("mapboxgl-crosshair"),
  4764. this._fireEvent("boxstart", a);
  4765. var d = this._map.unproject(b),
  4766. e = this._map.unproject(c),
  4767. a = this._map.project([d.lng, e.lat]),
  4768. d = this._map.project([e.lng, d.lat]);
  4769. this._boxContext.clearRect(0, 0, this._box.width, this._box.height);
  4770. this._boxContext.beginPath();
  4771. this._boxContext.moveTo(b.x, b.y);
  4772. this._boxContext.lineTo(a.x, a.y);
  4773. this._boxContext.lineTo(c.x, c.y);
  4774. this._boxContext.lineTo(d.x, d.y);
  4775. this._boxContext.closePath();
  4776. this._boxContext.fill();
  4777. this._boxContext.stroke()
  4778. },
  4779. _onMouseUp: function(a) {
  4780. if (a.button === 0) {
  4781. var b =
  4782. this._startPos,
  4783. c = GeoGlobe.DOM.mousePos(this._el, a),
  4784. d = (new GeoGlobe.LngLatBounds).extend(this._map.unproject(b)).extend(this._map.unproject(c)),
  4785. e = [GeoGlobe.Point.convert(b), GeoGlobe.Point.convert(c)],
  4786. e = [e[0], new GeoGlobe.Point(e[1].x, e[0].y), e[1], new GeoGlobe.Point(e[0].x, e[1].y)].map(function(a) {
  4787. return this._map.unproject(a)
  4788. }.bind(this));
  4789. this._finish();
  4790. b.x === c.x && b.y === c.y || this._map.fire("boxend", {
  4791. originalEvent: a,
  4792. boxBounds: d,
  4793. boxLnglats: e,
  4794. startPos: b,
  4795. endPos: c
  4796. })
  4797. }
  4798. },
  4799. _onKeyDown: function(a) {
  4800. a.keyCode ===
  4801. 27 && (this._finish(), this._fireEvent("boxcancel", a))
  4802. },
  4803. _finish: function() {
  4804. this._active = !1;
  4805. window.document.removeEventListener("mousemove", this._onMouseMove, !1);
  4806. window.document.removeEventListener("keydown", this._onKeyDown, !1);
  4807. window.document.removeEventListener("mouseup", this._onMouseUp, !1);
  4808. this._container.classList.remove("mapboxgl-crosshair");
  4809. if (this._box) this._box.parentNode.removeChild(this._box), this._box = null;
  4810. GeoGlobe.DOM.enableDrag()
  4811. },
  4812. _fireEvent: function(a, b) {
  4813. return this._map.fire(a, {
  4814. originalEvent: b
  4815. })
  4816. },
  4817. CLASS_NAME: "GeoGlobe.BoxHandler3D"
  4818. });
  4819. GeoGlobe.Handler.BoxZoomHandler = GeoGlobe.Class4OL(GeoGlobe.Handler, {
  4820. initialize: function(a) {
  4821. return this.handler = a.boxZoom
  4822. },
  4823. CLASS_NAME: "GeoGlobe.Handler.BoxZoomHandler"
  4824. });
  4825. GeoGlobe.Handler.DoubleClickZoomHandler = GeoGlobe.Class4OL(GeoGlobe.Handler, {
  4826. initialize: function(a) {
  4827. return this.handler = a.doubleClickZoom
  4828. },
  4829. CLASS_NAME: "GeoGlobe.Handler.DoubleClickZoomHandler"
  4830. });
  4831. GeoGlobe.Handler.DragPanHandler = GeoGlobe.Class4OL(GeoGlobe.Handler, {
  4832. initialize: function(a) {
  4833. return this.handler = a.dragPan
  4834. },
  4835. CLASS_NAME: "GeoGlobe.Handler.DragPanHandler"
  4836. });
  4837. GeoGlobe.Handler.DragRotateHandler = GeoGlobe.Class4OL(GeoGlobe.Handler, {
  4838. map: null,
  4839. initialize: function(a) {
  4840. return this.handler = a.dragRotate
  4841. },
  4842. isActivate: function() {
  4843. return this.handler.isActive()
  4844. },
  4845. isEnabled: function() {
  4846. return this.handler.isEnabled()
  4847. },
  4848. enable: function() {
  4849. this.handler.enable()
  4850. },
  4851. disable: function() {
  4852. this.handler.disable()
  4853. },
  4854. CLASS_NAME: "GeoGlobe.Handler.DragRotateHandler"
  4855. });
  4856. GeoGlobe.Handler.KeyboardHandler = GeoGlobe.Class4OL(GeoGlobe.Handler, {
  4857. initialize: function(a) {
  4858. return this.handler = a.keyboard
  4859. },
  4860. CLASS_NAME: "GeoGlobe.Handler.KeyboardHandler"
  4861. });
  4862. GeoGlobe.Handler.ScrollZoomHandler = GeoGlobe.Class4OL(GeoGlobe.Handler, {
  4863. initialize: function(a) {
  4864. return this.handler = a.scrollZoom
  4865. },
  4866. CLASS_NAME: "GeoGlobe.Handler.ScrollZoomHandler"
  4867. });
  4868. GeoGlobe.Handler.TouchZoomRotateHandler = GeoGlobe.Class4OL(GeoGlobe.Handler, {
  4869. initialize: function(a) {
  4870. return this.handler = a.touchZoomRotate
  4871. },
  4872. CLASS_NAME: "GeoGlobe.Handler.TouchZoomRotateHandler"
  4873. });
  4874. GeoGlobe.DynamicTrace = GeoGlobe.Class({
  4875. frame_num: 0,
  4876. origons: [0, 0],
  4877. destinations: [0, 0],
  4878. map: null,
  4879. id: null,
  4880. initialize: function(a) {
  4881. this.options = a;
  4882. frame_num = a.frame_num;
  4883. map = a.map;
  4884. id = a.id;
  4885. origins = a.origons;
  4886. destinations = a.destinations;
  4887. num = destinations.length;
  4888. pointid = id + "point";
  4889. routeid1 = id + "route1";
  4890. routeid2 = id + "route2";
  4891. point = {};
  4892. route = {};
  4893. route1 = {};
  4894. route2 = {};
  4895. counter = 0;
  4896. request = null
  4897. },
  4898. autotrace: function(a, b) {
  4899. frame_num || (frame_num = 1E3);
  4900. a && (frame_num = a);
  4901. route = {
  4902. type: "FeatureCollection",
  4903. features: [{
  4904. type: "Feature",
  4905. geometry: {
  4906. type: "LineString",
  4907. coordinates: [origins[0], destinations[0]]
  4908. }
  4909. }]
  4910. };
  4911. for (var c = 1; c < num; c++) {
  4912. var d = {
  4913. type: "Feature",
  4914. geometry: {
  4915. type: "LineString",
  4916. coordinates: [origins[c], destinations[c]]
  4917. }
  4918. };
  4919. route.features.push(d)
  4920. }
  4921. point = {
  4922. type: "FeatureCollection",
  4923. features: [{
  4924. type: "Feature",
  4925. geometry: {
  4926. type: "Point",
  4927. coordinates: origins[0]
  4928. }
  4929. }]
  4930. };
  4931. for (c = 1; c < num; c++) d = {
  4932. type: "Feature",
  4933. geometry: {
  4934. type: "Point",
  4935. coordinates: origins[c]
  4936. }
  4937. }, point.features.push(d);
  4938. d = [];
  4939. d.push(turf.lineDistance(route.features[0], "kilometers"));
  4940. for (c = 1; c < num; c++) d.push(turf.lineDistance(route.features[c],
  4941. "kilometers"));
  4942. for (var e = 0; e < num; e++) {
  4943. for (var f = [], c = 0; c < d[e]; c++) {
  4944. var g = turf.along(route.features[e], c / frame_num * d[e], "kilometers");
  4945. f.push(g.geometry.coordinates)
  4946. }
  4947. route.features[e].geometry.coordinates = f
  4948. }
  4949. route1 = {
  4950. type: "FeatureCollection",
  4951. features: []
  4952. };
  4953. for (e = 0; e < num; e++) d = {
  4954. type: "Feature",
  4955. geometry: {
  4956. type: "LineString",
  4957. coordinates: [origins[e], origins[e]]
  4958. }
  4959. }, route1.features.push(d);
  4960. route2 = {
  4961. type: "FeatureCollection",
  4962. features: []
  4963. };
  4964. for (e = 0; e < num; e++) d = {
  4965. type: "Feature",
  4966. geometry: {
  4967. type: "LineString",
  4968. coordinates: [origins[e],
  4969. origins[e]
  4970. ]
  4971. }
  4972. }, route2.features.push(d);
  4973. counter = 0;
  4974. map.addSource(routeid1, {
  4975. type: "geojson",
  4976. data: route1
  4977. });
  4978. map.addSource(routeid2, {
  4979. type: "geojson",
  4980. data: route2
  4981. });
  4982. map.addSource(pointid, {
  4983. type: "geojson",
  4984. data: point
  4985. });
  4986. b ? (map.addLayer({
  4987. id: routeid1,
  4988. source: routeid1,
  4989. type: b.line.type,
  4990. paint: b.line.paint
  4991. }), map.addLayer({
  4992. id: routeid2,
  4993. source: routeid2,
  4994. type: b.line.type,
  4995. paint: b.line.paint
  4996. }), map.addLayer({
  4997. id: pointid,
  4998. source: pointid,
  4999. type: b.point.type,
  5000. paint: b.point.paint
  5001. })) : (map.addLayer({
  5002. id: routeid1,
  5003. source: routeid1,
  5004. type: "line",
  5005. paint: {
  5006. "line-width": {
  5007. base: 2,
  5008. stops: [
  5009. [12, 2],
  5010. [22, 180]
  5011. ]
  5012. },
  5013. "line-color": "red"
  5014. }
  5015. }), map.addLayer({
  5016. id: routeid2,
  5017. source: routeid2,
  5018. type: "line",
  5019. paint: {
  5020. "line-width": {
  5021. base: 2,
  5022. stops: [
  5023. [12, 2],
  5024. [22, 180]
  5025. ]
  5026. },
  5027. "line-color": "red"
  5028. }
  5029. }), map.addLayer({
  5030. id: pointid,
  5031. source: pointid,
  5032. type: "circle",
  5033. paint: {
  5034. "circle-radius": {
  5035. base: 2,
  5036. stops: [
  5037. [12, 2],
  5038. [22, 180]
  5039. ]
  5040. },
  5041. "circle-color": "yellow",
  5042. "circle-opacity": 1
  5043. }
  5044. }))
  5045. },
  5046. run: function() {
  5047. for (var a = 0; a < num; a++) point.features[a].geometry.coordinates = route.features[a].geometry.coordinates[counter], route1.features[a].geometry.coordinates.push(route.features[a].geometry.coordinates[counter]),
  5048. route2.features[a].geometry.coordinates.push(route.features[a].geometry.coordinates[counter]), route1.features[a].geometry.coordinates.length > 11 && route1.features[a].geometry.coordinates.shift();
  5049. map.getSource(pointid).setData(point);
  5050. map.getSource(routeid1).setData(route1);
  5051. counter % 10 == 0 && map.getSource(routeid2).setData(route2);
  5052. point.features[0].geometry.coordinates[0] !== destinations[0][0] && (request = requestAnimationFrame(run));
  5053. counter += 1
  5054. },
  5055. reset: function() {
  5056. for (var a = 0; a < num; a++) point.features[a].geometry.coordinates =
  5057. origins[a], route1.features[a].geometry.coordinates = [], route2.features[a].geometry.coordinates = [], route1.features[a].geometry.coordinates.push(origins[a]), route2.features[a].geometry.coordinates.push(origins[a]);
  5058. map.getSource(pointid).setData(point);
  5059. map.getSource(routeid1).setData(route1);
  5060. map.getSource(routeid2).setData(route2);
  5061. counter = 0;
  5062. cancelAnimationFrame(request)
  5063. },
  5064. replay: function() {
  5065. for (var a = 0; a < num; a++) point.features[a].geometry.coordinates = origins[a], route1.features[a].geometry.coordinates = [],
  5066. route2.features[a].geometry.coordinates = [], route1.features[a].geometry.coordinates.push(origins[a]), route2.features[a].geometry.coordinates.push(origins[a]);
  5067. map.getSource(pointid).setData(point);
  5068. map.getSource(routeid1).setData(route1);
  5069. map.getSource(routeid2).setData(route2);
  5070. counter = 0;
  5071. run(counter)
  5072. },
  5073. pause: function() {
  5074. cancelAnimationFrame(request)
  5075. },
  5076. removetrace: function() {
  5077. map.removeLayer(pointid);
  5078. map.removeLayer(routeid1);
  5079. map.removeLayer(routeid2);
  5080. map.removeSource(pointid);
  5081. map.removeSource(routeid1);
  5082. map.removeSource(routeid2)
  5083. },
  5084. CLASS_NAME: "GeoGlobe.DynamicTrace"
  5085. });
  5086. GeoGlobe.DynamicFeature = GeoGlobe.Class({
  5087. data: null,
  5088. map: null,
  5089. style: null,
  5090. isdraw: null,
  5091. id: null,
  5092. property: null,
  5093. initialize: function(a) {
  5094. this.options = a;
  5095. map = a.map;
  5096. feat_data = a.data;
  5097. speed = 500;
  5098. i = 0;
  5099. sourceid = null;
  5100. style = a.style;
  5101. property = style.property;
  5102. val_property = feat_data.features[0].properties[property];
  5103. sourceid = a.id;
  5104. isdraw = a.isdraw;
  5105. color_num = [];
  5106. size_num = [];
  5107. isdraw && (this.setdata(), this.setstyle())
  5108. },
  5109. setdata: function(a) {
  5110. a ? (map.removeSource(sourceid), map.addSource(sourceid, {
  5111. type: "geojson",
  5112. data: a
  5113. })) : map.addSource(sourceid, {
  5114. type: "geojson",
  5115. data: feat_data
  5116. })
  5117. },
  5118. setstyle: function() {
  5119. var a = 0;
  5120. if (style.color) {
  5121. color = style.color;
  5122. for (var b = color[val_property], c = 0; c < b.length; c++) color_num.push([c, b[c]]);
  5123. opacity = style.opacity;
  5124. if (style.size) {
  5125. size = style.size;
  5126. b = size[val_property];
  5127. for (c = 0; c < b.length; c++) size_num.push([c, b[c]])
  5128. } else size_num = [
  5129. [0, 7],
  5130. [1, 5],
  5131. [2, 3]
  5132. ]
  5133. } else opacity = 0.3, color_num = [
  5134. [0, "red"],
  5135. [1, "#FFC0CB"],
  5136. [2, "#FFB6C1"]
  5137. ], size_num = [
  5138. [0, 7],
  5139. [1, 5],
  5140. [2, 3]
  5141. ];
  5142. style.type === "point" ? setInterval(function() {
  5143. i % speed === 0 && (map.addLayer({
  5144. id: sourceid,
  5145. type: "circle",
  5146. source: sourceid,
  5147. paint: {
  5148. "circle-color": {
  5149. stops: [color_num[a]]
  5150. },
  5151. "circle-opacity": opacity,
  5152. "circle-radius": {
  5153. stops: [size_num[a]]
  5154. }
  5155. }
  5156. }), a++, a > 2 && (a = 0));
  5157. i += 5
  5158. }, 1) : style.type === "line" ? setInterval(function() {
  5159. i % speed === 0 && (map.addLayer({
  5160. id: sourceid,
  5161. type: "line",
  5162. source: sourceid,
  5163. paint: {
  5164. "line-color": {
  5165. stops: [color_num[a]]
  5166. },
  5167. "line-opacity": opacity,
  5168. "line-width": {
  5169. stops: [size_num[a]]
  5170. }
  5171. }
  5172. }), a++, a > 2 && (a = 0));
  5173. i += 5
  5174. }, 1) : style.type === "fill" ? setInterval(function() {
  5175. i % speed === 0 && (map.addLayer({
  5176. id: sourceid,
  5177. type: "fill",
  5178. source: sourceid,
  5179. paint: {
  5180. "fill-color": {
  5181. stops: [color_num[a]]
  5182. },
  5183. "fill-opacity": 0.3,
  5184. "fill-outline-color": {
  5185. stops: [color_num[a]]
  5186. }
  5187. }
  5188. }), a++, a > 2 && (a = 0));
  5189. i += 5
  5190. }, 1) : alert("\u8bf7\u786e\u5b9a\u663e\u793a\u7684\u8981\u7d20\u7684\u7c7b\u578b")
  5191. },
  5192. CLASS_NAME: "GeoGlobe.DynamicFeature"
  5193. });
  5194. GeoGlobe.Geometry = GeoGlobe.Class4OL({
  5195. id: null,
  5196. parent: null,
  5197. bounds: null,
  5198. initialize: function() {
  5199. this.id = GeoGlobe.Util.createUniqueID(this.CLASS_NAME + "_")
  5200. },
  5201. destroy: function() {
  5202. this.bounds = this.id = null
  5203. },
  5204. clone: function() {
  5205. return new GeoGlobe.Geometry
  5206. },
  5207. setBounds: function(a) {
  5208. if (a) this.bounds = a.clone()
  5209. },
  5210. clearBounds: function() {
  5211. this.bounds = null;
  5212. this.parent && this.parent.clearBounds()
  5213. },
  5214. extendBounds: function(a) {
  5215. this.getBounds() ? this.bounds.extend(a) : this.setBounds(a)
  5216. },
  5217. getBounds: function() {
  5218. this.bounds == null && this.calculateBounds();
  5219. return this.bounds
  5220. },
  5221. calculateBounds: function() {},
  5222. distanceTo: function() {},
  5223. getVertices: function() {},
  5224. atPoint: function(a, b, c) {
  5225. var d = !1;
  5226. this.getBounds() != null && a != null && (b = b != null ? b : 0, d = c != null ? c : 0, c = new GeoGlobe.LngLat(this.bounds._sw.lng - b, this.bounds._sw.lat - d), b = new GeoGlobe.LngLat(this.bounds._ne.lng + b, this.bounds._ne.lat + d), d = (new GeoGlobe.LngLatBounds(c, b)).containsLonLat(a));
  5227. return d
  5228. },
  5229. getLength: function() {
  5230. return 0
  5231. },
  5232. getArea: function() {
  5233. return 0
  5234. },
  5235. getCentroid: function() {
  5236. return null
  5237. },
  5238. toString: function() {
  5239. return GeoGlobe.Format &&
  5240. GeoGlobe.Format.WKT ? GeoGlobe.Format.WKT.prototype.write(new GeoGlobe.Feature(this)) : Object.prototype.toString.call(this)
  5241. },
  5242. CLASS_NAME: "GeoGlobe.Geometry"
  5243. });
  5244. GeoGlobe.Geometry.fromWKT = function(a) {
  5245. var b;
  5246. if (GeoGlobe.Format && GeoGlobe.Format.WKT) {
  5247. var c = GeoGlobe.Geometry.fromWKT.format;
  5248. if (!c) c = new GeoGlobe.Format.WKT, GeoGlobe.Geometry.fromWKT.format = c;
  5249. a = c.read(a);
  5250. if (a instanceof GeoGlobe.Feature) b = a.geometry;
  5251. else if (GeoGlobe.Util.isArray(a)) {
  5252. b = a.length;
  5253. for (var c = Array(b), d = 0; d < b; ++d) c[d] = a[d].geometry;
  5254. b = new GeoGlobe.Geometry.Collection(c)
  5255. }
  5256. }
  5257. return b
  5258. };
  5259. GeoGlobe.Geometry.segmentsIntersect = function(a, b, c) {
  5260. var d = c && c.point,
  5261. c = c && c.tolerance,
  5262. e = !1,
  5263. f = a.x1 - b.x1,
  5264. g = a.y1 - b.y1,
  5265. h = a.x2 - a.x1,
  5266. j = a.y2 - a.y1,
  5267. l = b.y2 - b.y1,
  5268. m = b.x2 - b.x1,
  5269. n = l * h - m * j,
  5270. l = m * g - l * f,
  5271. g = h * g - j * f;
  5272. n == 0 ? l == 0 && g == 0 && (e = !0) : (f = l / n, n = g / n, f >= 0 && f <= 1 && n >= 0 && n <= 1 && (d ? (h = a.x1 + f * h, n = a.y1 + f * j, e = new GeoGlobe.Geometry.Point(h, n)) : e = !0));
  5273. if (c)
  5274. if (e) {
  5275. if (d) {
  5276. a = [a, b];
  5277. b = 0;
  5278. a: for (; b < 2; ++b) {
  5279. f = a[b];
  5280. for (j = 1; j < 3; ++j)
  5281. if (h = f["x" + j], n = f["y" + j], d = Math.sqrt(Math.pow(h - e.x, 2) + Math.pow(n - e.y, 2)), d < c) {
  5282. e.x = h;
  5283. e.y = n;
  5284. break a
  5285. }
  5286. }
  5287. }
  5288. } else {
  5289. a = [a,
  5290. b
  5291. ];
  5292. b = 0;
  5293. a: for (; b < 2; ++b) {
  5294. h = a[b];
  5295. n = a[(b + 1) % 2];
  5296. for (j = 1; j < 3; ++j)
  5297. if (f = {
  5298. x: h["x" + j],
  5299. y: h["y" + j]
  5300. }, g = GeoGlobe.Geometry.distanceToSegment(f, n), g.distance < c) {
  5301. e = d ? new GeoGlobe.Geometry.Point(f.x, f.y) : !0;
  5302. break a
  5303. }
  5304. }
  5305. }
  5306. return e
  5307. };
  5308. GeoGlobe.Geometry.distanceToSegment = function(a, b) {
  5309. var c = GeoGlobe.Geometry.distanceSquaredToSegment(a, b);
  5310. c.distance = Math.sqrt(c.distance);
  5311. return c
  5312. };
  5313. GeoGlobe.Geometry.distanceSquaredToSegment = function(a, b) {
  5314. var c = a.x,
  5315. d = a.y,
  5316. e = b.x1,
  5317. f = b.y1,
  5318. g = b.x2,
  5319. h = b.y2,
  5320. j = g - e,
  5321. l = h - f,
  5322. m = j == 0 && l == 0 ? 0 : (j * (c - e) + l * (d - f)) / (Math.pow(j, 2) + Math.pow(l, 2));
  5323. m <= 0 || (m >= 1 ? (e = g, f = h) : (e += m * j, f += m * l));
  5324. return {
  5325. distance: Math.pow(e - c, 2) + Math.pow(f - d, 2),
  5326. x: e,
  5327. y: f,
  5328. along: m
  5329. }
  5330. };
  5331. GeoGlobe.Geometry.fromGeoJson = function(a) {
  5332. var b;
  5333. if (GeoGlobe.Format && GeoGlobe.Format.GeoJSON) {
  5334. format = new GeoGlobe.Format.GeoJSON;
  5335. b = null;
  5336. try {
  5337. b = format.parseGeometry(a)
  5338. } catch (c) {
  5339. console.log(c)
  5340. }
  5341. }
  5342. return b
  5343. };
  5344. GeoGlobe.Geometry.Collection = GeoGlobe.Class4OL(GeoGlobe.Geometry, {
  5345. components: null,
  5346. componentTypes: null,
  5347. initialize: function(a) {
  5348. GeoGlobe.Geometry.prototype.initialize.apply(this, arguments);
  5349. this.components = [];
  5350. a != null && this.addComponents(a)
  5351. },
  5352. destroy: function() {
  5353. this.components.length = 0;
  5354. this.components = null;
  5355. GeoGlobe.Geometry.prototype.destroy.apply(this, arguments)
  5356. },
  5357. clone: function() {
  5358. for (var a = eval("new " + this.CLASS_NAME + "()"), b = 0, c = this.components.length; b < c; b++) a.addComponent(this.components[b].clone());
  5359. GeoGlobe.Util.applyDefaults(a, this);
  5360. return a
  5361. },
  5362. getComponentsString: function() {
  5363. for (var a = [], b = 0, c = this.components.length; b < c; b++) a.push(this.components[b].toShortString());
  5364. return a.join(",")
  5365. },
  5366. calculateBounds: function() {
  5367. this.bounds = null;
  5368. var a = new GeoGlobe.LngLatBounds,
  5369. b = this.components;
  5370. if (b)
  5371. for (var c = 0, d = b.length; c < d; c++) a.extend(b[c].getBounds());
  5372. a._sw != null && a._sw != null && a._ne != null && a._ne != null && a._sw.lng != null && a._sw.lat != null && a._ne.lng != null && a._ne.lat != null && this.setBounds(a)
  5373. },
  5374. addComponents: function(a) {
  5375. GeoGlobe.Util.isArray(a) ||
  5376. (a = [a]);
  5377. for (var b = 0, c = a.length; b < c; b++) this.addComponent(a[b])
  5378. },
  5379. addComponent: function(a, b) {
  5380. var c = !1;
  5381. if (a && (this.componentTypes == null || GeoGlobe.Util.indexOf(this.componentTypes, a.CLASS_NAME) > -1)) {
  5382. if (b != null && b < this.components.length) {
  5383. var c = this.components.slice(0, b),
  5384. d = this.components.slice(b, this.components.length);
  5385. c.push(a);
  5386. this.components = c.concat(d)
  5387. } else this.components.push(a);
  5388. a.parent = this;
  5389. this.clearBounds();
  5390. c = !0
  5391. }
  5392. return c
  5393. },
  5394. removeComponents: function(a) {
  5395. var b = !1;
  5396. GeoGlobe.Util.isArray(a) || (a = [a]);
  5397. for (var c = a.length - 1; c >= 0; --c) b = this.removeComponent(a[c]) || b;
  5398. return b
  5399. },
  5400. removeComponent: function(a) {
  5401. GeoGlobe.Util.removeItem(this.components, a);
  5402. this.clearBounds();
  5403. return !0
  5404. },
  5405. getLength: function() {
  5406. for (var a = 0, b = 0, c = this.components.length; b < c; b++) a += this.components[b].getLength();
  5407. return a
  5408. },
  5409. getArea: function() {
  5410. for (var a = 0, b = 0, c = this.components.length; b < c; b++) a += this.components[b].getArea();
  5411. return a
  5412. },
  5413. getGeodesicArea: function(a) {
  5414. for (var b = 0, c = 0, d = this.components.length; c < d; c++) b += this.components[c].getGeodesicArea(a);
  5415. return b
  5416. },
  5417. getCentroid: function(a) {
  5418. if (!a) return this.components.length && this.components[0].getCentroid();
  5419. a = this.components.length;
  5420. if (!a) return !1;
  5421. for (var b = [], c = [], d = 0, e = Number.MAX_VALUE, f, g = 0; g < a; ++g) {
  5422. f = this.components[g];
  5423. var h = f.getArea();
  5424. f = f.getCentroid(!0);
  5425. !isNaN(h) && !isNaN(f.x) && !isNaN(f.y) && (b.push(h), d += h, e = h < e && h > 0 ? h : e, c.push(f))
  5426. }
  5427. a = b.length;
  5428. if (d === 0) {
  5429. for (g = 0; g < a; ++g) b[g] = 1;
  5430. d = b.length
  5431. } else {
  5432. for (g = 0; g < a; ++g) b[g] /= e;
  5433. d /= e
  5434. }
  5435. for (var j = e = 0, g = 0; g < a; ++g) f = c[g], h = b[g], e += f.x * h, j += f.y * h;
  5436. return new GeoGlobe.Geometry.Point(e /
  5437. d, j / d)
  5438. },
  5439. getGeodesicLength: function(a) {
  5440. for (var b = 0, c = 0, d = this.components.length; c < d; c++) b += this.components[c].getGeodesicLength(a);
  5441. return b
  5442. },
  5443. move: function(a, b) {
  5444. for (var c = 0, d = this.components.length; c < d; c++) this.components[c].move(a, b)
  5445. },
  5446. rotate: function(a, b) {
  5447. for (var c = 0, d = this.components.length; c < d; ++c) this.components[c].rotate(a, b)
  5448. },
  5449. resize: function(a, b, c) {
  5450. for (var d = 0; d < this.components.length; ++d) this.components[d].resize(a, b, c);
  5451. return this
  5452. },
  5453. distanceTo: function(a, b) {
  5454. for (var c = !(b && b.edge === !1) && b && b.details,
  5455. d, e, f, g = Number.POSITIVE_INFINITY, h = 0, j = this.components.length; h < j; ++h)
  5456. if (d = this.components[h].distanceTo(a, b), f = c ? d.distance : d, f < g && (g = f, e = d, g == 0)) break;
  5457. return e
  5458. },
  5459. equals: function(a) {
  5460. var b = !0;
  5461. if (!a || !a.CLASS_NAME || this.CLASS_NAME != a.CLASS_NAME) b = !1;
  5462. else if (!GeoGlobe.Util.isArray(a.components) || a.components.length != this.components.length) b = !1;
  5463. else
  5464. for (var c = 0, d = this.components.length; c < d; ++c)
  5465. if (!this.components[c].equals(a.components[c])) {
  5466. b = !1;
  5467. break
  5468. } return b
  5469. },
  5470. transform: function(a, b) {
  5471. if (a && b) {
  5472. for (var c =
  5473. 0, d = this.components.length; c < d; c++) this.components[c].transform(a, b);
  5474. this.bounds = null
  5475. }
  5476. return this
  5477. },
  5478. intersects: function(a) {
  5479. for (var b = !1, c = 0, d = this.components.length; c < d; ++c)
  5480. if (b = a.intersects(this.components[c])) break;
  5481. return b
  5482. },
  5483. getVertices: function(a) {
  5484. for (var b = [], c = 0, d = this.components.length; c < d; ++c) Array.prototype.push.apply(b, this.components[c].getVertices(a));
  5485. return b
  5486. },
  5487. CLASS_NAME: "GeoGlobe.Geometry.Collection"
  5488. });
  5489. GeoGlobe.Geometry.Point = GeoGlobe.Class4OL(GeoGlobe.Geometry, {
  5490. x: null,
  5491. y: null,
  5492. initialize: function(a, b) {
  5493. GeoGlobe.Geometry.prototype.initialize.apply(this, arguments);
  5494. this.x = parseFloat(a);
  5495. this.y = parseFloat(b)
  5496. },
  5497. clone: function(a) {
  5498. a == null && (a = new GeoGlobe.Geometry.Point(this.x, this.y));
  5499. GeoGlobe.Util.applyDefaults(a, this);
  5500. return a
  5501. },
  5502. calculateBounds: function() {
  5503. var a = new GeoGlobe.LngLat(this.x, this.y),
  5504. b = new GeoGlobe.LngLat(this.x, this.y);
  5505. this.bounds = new GeoGlobe.LngLatBounds(a, b)
  5506. },
  5507. distanceTo: function(a, b) {
  5508. var c = !(b && b.edge === !1) && b && b.details,
  5509. d, e, f, g, h;
  5510. a instanceof GeoGlobe.Geometry.Point ? (e = this.x, f = this.y, g = a.x, h = a.y, d = Math.sqrt(Math.pow(e - g, 2) + Math.pow(f - h, 2)), d = !c ? d : {
  5511. x0: e,
  5512. y0: f,
  5513. x1: g,
  5514. y1: h,
  5515. distance: d
  5516. }) : (d = a.distanceTo(this, b), c && (d = {
  5517. x0: d.x1,
  5518. y0: d.y1,
  5519. x1: d.x0,
  5520. y1: d.y0,
  5521. distance: d.distance
  5522. }));
  5523. return d
  5524. },
  5525. equals: function(a) {
  5526. var b = !1;
  5527. a != null && (b = this.x == a.x && this.y == a.y || isNaN(this.x) && isNaN(this.y) && isNaN(a.x) && isNaN(a.y));
  5528. return b
  5529. },
  5530. toShortString: function() {
  5531. return this.x + ", " + this.y
  5532. },
  5533. move: function(a, b) {
  5534. this.x +=
  5535. a;
  5536. this.y += b;
  5537. this.clearBounds()
  5538. },
  5539. rotate: function(a, b) {
  5540. a *= Math.PI / 180;
  5541. var c = this.distanceTo(b),
  5542. d = a + Math.atan2(this.y - b.y, this.x - b.x);
  5543. this.x = b.x + c * Math.cos(d);
  5544. this.y = b.y + c * Math.sin(d);
  5545. this.clearBounds()
  5546. },
  5547. getCentroid: function() {
  5548. return new GeoGlobe.Geometry.Point(this.x, this.y)
  5549. },
  5550. resize: function(a, b, c) {
  5551. this.x = b.x + a * (c == void 0 ? 1 : c) * (this.x - b.x);
  5552. this.y = b.y + a * (this.y - b.y);
  5553. this.clearBounds();
  5554. return this
  5555. },
  5556. intersects: function(a) {
  5557. var b = !1;
  5558. return b = a.CLASS_NAME == "GeoGlobe.Geometry.Point" ? this.equals(a) : a.intersects(this)
  5559. },
  5560. transform: function(a, b) {
  5561. if (a && b) GeoGlobe.SpatialReference.transform(this, a, b), this.bounds = null;
  5562. return this
  5563. },
  5564. getVertices: function() {
  5565. return [this]
  5566. },
  5567. CLASS_NAME: "GeoGlobe.Geometry.Point"
  5568. });
  5569. GeoGlobe.Geometry.MultiPoint = GeoGlobe.Class4OL(GeoGlobe.Geometry.Collection, {
  5570. componentTypes: ["GeoGlobe.Geometry.Point"],
  5571. addPoint: function(a, b) {
  5572. this.addComponent(a, b)
  5573. },
  5574. removePoint: function(a) {
  5575. this.removeComponent(a)
  5576. },
  5577. CLASS_NAME: "GeoGlobe.Geometry.MultiPoint"
  5578. });
  5579. GeoGlobe.Geometry.Curve = GeoGlobe.Class4OL(GeoGlobe.Geometry.MultiPoint, {
  5580. componentTypes: ["GeoGlobe.Geometry.Point"],
  5581. getLength: function() {
  5582. var a = 0;
  5583. if (this.components && this.components.length > 1)
  5584. for (var b = 1, c = this.components.length; b < c; b++) a += this.components[b - 1].distanceTo(this.components[b]);
  5585. return a
  5586. },
  5587. getGeodesicLength: function(a) {
  5588. var b = this;
  5589. if (a) {
  5590. var c = new GeoGlobe.SpatialReference("EPSG:4326");
  5591. c.equals(a) || (b = this.clone().transform(a, c))
  5592. }
  5593. a = 0;
  5594. if (b.components && b.components.length > 1)
  5595. for (var d, e = 1, f = b.components.length; e <
  5596. f; e++) c = b.components[e - 1], d = b.components[e], a += GeoGlobe.Util.distVincenty({
  5597. lng: c.x,
  5598. lat: c.y
  5599. }, {
  5600. lng: d.x,
  5601. lat: d.y
  5602. });
  5603. return a * 1E3
  5604. },
  5605. CLASS_NAME: "GeoGlobe.Geometry.Curve"
  5606. });
  5607. GeoGlobe.Geometry.LineString = GeoGlobe.Class4OL(GeoGlobe.Geometry.Curve, {
  5608. removeComponent: function() {
  5609. var a = this.components && this.components.length > 2;
  5610. a && GeoGlobe.Geometry.Collection.prototype.removeComponent.apply(this, arguments);
  5611. return a
  5612. },
  5613. intersects: function(a) {
  5614. var b = !1,
  5615. c = a.CLASS_NAME;
  5616. if (c == "GeoGlobe.Geometry.LineString" || c == "GeoGlobe.Geometry.LinearRing" || c == "GeoGlobe.Geometry.Point") {
  5617. var d = this.getSortedSegments(),
  5618. a = c == "GeoGlobe.Geometry.Point" ? [{
  5619. x1: a.x,
  5620. y1: a.y,
  5621. x2: a.x,
  5622. y2: a.y
  5623. }] : a.getSortedSegments(),
  5624. e, f, g, h, j, l, m, n = 0,
  5625. p = d.length;
  5626. a: for (; n < p; ++n) {
  5627. c = d[n];
  5628. e = c.x1;
  5629. f = c.x2;
  5630. g = c.y1;
  5631. h = c.y2;
  5632. var q = 0,
  5633. o = a.length;
  5634. for (; q < o; ++q) {
  5635. j = a[q];
  5636. if (j.x1 > f) break;
  5637. if (!(j.x2 < e) && (l = j.y1, m = j.y2, !(Math.min(l, m) > Math.max(g, h)) && !(Math.max(l, m) < Math.min(g, h)) && GeoGlobe.Geometry.segmentsIntersect(c, j))) {
  5638. b = !0;
  5639. break a
  5640. }
  5641. }
  5642. }
  5643. } else b = a.intersects(this);
  5644. return b
  5645. },
  5646. getSortedSegments: function() {
  5647. for (var a = this.components.length - 1, b = Array(a), c, d, e = 0; e < a; ++e) c = this.components[e], d = this.components[e + 1], b[e] = c.x < d.x ? {
  5648. x1: c.x,
  5649. y1: c.y,
  5650. x2: d.x,
  5651. y2: d.y
  5652. } : {
  5653. x1: d.x,
  5654. y1: d.y,
  5655. x2: c.x,
  5656. y2: c.y
  5657. };
  5658. return b.sort(function(a, b) {
  5659. return a.x1 - b.x1
  5660. })
  5661. },
  5662. splitWithSegment: function(a, b) {
  5663. for (var c = !(b && b.edge === !1), d = b && b.tolerance, e = [], f = this.getVertices(), g = [], h = [], j = !1, l, m, n, p = {
  5664. point: !0,
  5665. tolerance: d
  5666. }, q = null, o = 0, s = f.length - 2; o <= s; ++o)
  5667. if (d = f[o], g.push(d.clone()), l = f[o + 1], m = {
  5668. x1: d.x,
  5669. y1: d.y,
  5670. x2: l.x,
  5671. y2: l.y
  5672. }, m = GeoGlobe.Geometry.segmentsIntersect(a, m, p), m instanceof GeoGlobe.Geometry.Point && ((n = m.x === a.x1 && m.y === a.y1 || m.x === a.x2 && m.y === a.y2 || m.equals(d) || m.equals(l) ? !0 : !1) || c)) m.equals(h[h.length -
  5673. 1]) || h.push(m.clone()), !(o === 0 && m.equals(d)) && !m.equals(l) && (j = !0, m.equals(d) || g.push(m), e.push(new GeoGlobe.Geometry.LineString(g)), g = [m.clone()]);
  5674. j && (g.push(l.clone()), e.push(new GeoGlobe.Geometry.LineString(g)));
  5675. if (h.length > 0) var r = a.x1 < a.x2 ? 1 : -1,
  5676. t = a.y1 < a.y2 ? 1 : -1,
  5677. q = {
  5678. lines: e,
  5679. points: h.sort(function(a, b) {
  5680. return r * a.x - r * b.x || t * a.y - t * b.y
  5681. })
  5682. };
  5683. return q
  5684. },
  5685. split: function(a, b) {
  5686. var c = null,
  5687. d = b && b.mutual,
  5688. e, f, g, h;
  5689. if (a instanceof GeoGlobe.Geometry.LineString) {
  5690. var j = this.getVertices(),
  5691. l, m, n, p, q, o = [];
  5692. g = [];
  5693. for (var s =
  5694. 0, r = j.length - 2; s <= r; ++s) {
  5695. l = j[s];
  5696. m = j[s + 1];
  5697. n = {
  5698. x1: l.x,
  5699. y1: l.y,
  5700. x2: m.x,
  5701. y2: m.y
  5702. };
  5703. h = h || [a];
  5704. d && o.push(l.clone());
  5705. for (var t = 0; t < h.length; ++t)
  5706. if (p = h[t].splitWithSegment(n, b))
  5707. if (q = p.lines, q.length > 0 && (q.unshift(t, 1), Array.prototype.splice.apply(h, q), t += q.length - 2), d)
  5708. for (var u = 0, v = p.points.length; u < v; ++u) q = p.points[u], q.equals(l) || (o.push(q), g.push(new GeoGlobe.Geometry.LineString(o)), o = q.equals(m) ? [] : [q.clone()])
  5709. }
  5710. d && g.length > 0 && o.length > 0 && (o.push(m.clone()), g.push(new GeoGlobe.Geometry.LineString(o)))
  5711. } else c =
  5712. a.splitWith(this, b);
  5713. h && h.length > 1 ? f = !0 : h = [];
  5714. g && g.length > 1 ? e = !0 : g = [];
  5715. if (f || e) c = d ? [g, h] : h;
  5716. return c
  5717. },
  5718. splitWith: function(a, b) {
  5719. return a.split(this, b)
  5720. },
  5721. getVertices: function(a) {
  5722. return a === !0 ? [this.components[0], this.components[this.components.length - 1]] : a === !1 ? this.components.slice(1, this.components.length - 1) : this.components.slice()
  5723. },
  5724. distanceTo: function(a, b) {
  5725. var c = !(b && b.edge === !1) && b && b.details,
  5726. d, e = {},
  5727. f = Number.POSITIVE_INFINITY;
  5728. if (a instanceof GeoGlobe.Geometry.Point) {
  5729. for (var g = this.getSortedSegments(),
  5730. h = a.x, j = a.y, l, m = 0, n = g.length; m < n; ++m)
  5731. if (l = g[m], d = GeoGlobe.Geometry.distanceToSegment(a, l), d.distance < f) {
  5732. if (f = d.distance, e = d, f === 0) break
  5733. } else if (l.x2 > h && (j > l.y1 && j < l.y2 || j < l.y1 && j > l.y2)) break;
  5734. e = c ? {
  5735. distance: e.distance,
  5736. x0: e.x,
  5737. y0: e.y,
  5738. x1: h,
  5739. y1: j
  5740. } : e.distance
  5741. } else if (a instanceof GeoGlobe.Geometry.LineString) {
  5742. var g = this.getSortedSegments(),
  5743. h = a.getSortedSegments(),
  5744. p, q, o = h.length,
  5745. s = {
  5746. point: !0
  5747. },
  5748. m = 0,
  5749. n = g.length;
  5750. a: for (; m < n; ++m) {
  5751. j = g[m];
  5752. l = j.x1;
  5753. q = j.y1;
  5754. for (var r = 0; r < o; ++r)
  5755. if (d = h[r], p = GeoGlobe.Geometry.segmentsIntersect(j,
  5756. d, s)) {
  5757. f = 0;
  5758. e = {
  5759. distance: 0,
  5760. x0: p.x,
  5761. y0: p.y,
  5762. x1: p.x,
  5763. y1: p.y
  5764. };
  5765. break a
  5766. } else if (d = GeoGlobe.Geometry.distanceToSegment({
  5767. x: l,
  5768. y: q
  5769. }, d), d.distance < f) f = d.distance, e = {
  5770. distance: f,
  5771. x0: l,
  5772. y0: q,
  5773. x1: d.x,
  5774. y1: d.y
  5775. }
  5776. }
  5777. if (!c) e = e.distance;
  5778. f !== 0 && j && (d = a.distanceTo(new GeoGlobe.Geometry.Point(j.x2, j.y2), b), m = c ? d.distance : d, m < f && (e = c ? {
  5779. distance: f,
  5780. x0: d.x1,
  5781. y0: d.y1,
  5782. x1: d.x0,
  5783. y1: d.y0
  5784. } : m))
  5785. } else e = a.distanceTo(this, b), c && (e = {
  5786. distance: e.distance,
  5787. x0: e.x1,
  5788. y0: e.y1,
  5789. x1: e.x0,
  5790. y1: e.y0
  5791. });
  5792. return e
  5793. },
  5794. simplify: function(a) {
  5795. if (this && this !== null) {
  5796. var b = this.getVertices();
  5797. if (b.length < 3) return this;
  5798. var c = function(a, b, d, j) {
  5799. for (var l = 0, m = 0, n = b, p; n < d; n++) p = Math.abs(0.5 * (a[b].x * a[d].y + a[d].x * a[n].y + a[n].x * a[b].y - a[d].x * a[b].y - a[n].x * a[d].y - a[b].x * a[n].y)) / Math.sqrt(Math.pow(a[b].x - a[d].x, 2) + Math.pow(a[b].y - a[d].y, 2)) * 2, p > l && (l = p, m = n);
  5800. l > j && m != b && (e.push(m), c(a, b, m, j), c(a, m, d, j))
  5801. },
  5802. d = b.length - 1,
  5803. e = [];
  5804. e.push(0);
  5805. for (e.push(d); b[0].equals(b[d]);) d--, e.push(d);
  5806. c(b, 0, d, a);
  5807. a = [];
  5808. e.sort(function(a, b) {
  5809. return a - b
  5810. });
  5811. for (d = 0; d < e.length; d++) a.push(b[e[d]]);
  5812. return new GeoGlobe.Geometry.LineString(a)
  5813. } else return this
  5814. },
  5815. CLASS_NAME: "GeoGlobe.Geometry.LineString"
  5816. });
  5817. GeoGlobe.Geometry.LineString.createCurveLine = function(a) {
  5818. for (var b = [], c = 0; c < a.length - 1; c++) {
  5819. var d = GeoGlobe.Geometry.LineString.getCurveCoordinatesByTwoPoints(a[c], a[c + 1]);
  5820. d && d.length > 0 && (b = b.concat(d))
  5821. }
  5822. return new GeoGlobe.Geometry.LineString(b)
  5823. };
  5824. GeoGlobe.Geometry.LineString.getCurveCoordinatesByTwoPoints = function(a, b) {
  5825. if (!a || !b || !(a instanceof GeoGlobe.Geometry.Point) || !(b instanceof GeoGlobe.Geometry.Point)) return null;
  5826. curveCoordinates = [];
  5827. var c, d, e, f = d = 0;
  5828. if (typeof b == "undefined") typeof curveCoordinates != "undefined" && (curveCoordinates = []);
  5829. else {
  5830. var g = parseFloat(a.y),
  5831. h = parseFloat(b.y),
  5832. j = parseFloat(a.x),
  5833. l = parseFloat(b.x);
  5834. l > j && parseFloat(l - j) > 180 && j < 0 && (j = parseFloat(360 + j));
  5835. j > l && parseFloat(j - l) > 180 && l < 0 && (l = parseFloat(360 + l));
  5836. e = 0;
  5837. h == g ? (c = 0, d =
  5838. j - l) : l == j ? (c = Math.PI / 2, d = g - h) : (c = Math.atan((h - g) / (l - j)), d = (h - g) / Math.sin(c));
  5839. e == 0 && (e = c + Math.PI / 5);
  5840. d /= 2;
  5841. c = d * Math.cos(e) + j;
  5842. e = d * Math.sin(e) + g;
  5843. for (d = 0; d < 31; d++) curveCoordinates.push(new GeoGlobe.Geometry.Point(j * (1 - 2 * f + f * f) + c * (2 * f - 2 * f * f) + l * f * f, g * (1 - 2 * f + f * f) + e * (2 * f - 2 * f * f) + h * f * f)), f += 1 / 30;
  5844. return curveCoordinates
  5845. }
  5846. };
  5847. GeoGlobe.Geometry.LinearRing = GeoGlobe.Class4OL(GeoGlobe.Geometry.LineString, {
  5848. componentTypes: ["GeoGlobe.Geometry.Point"],
  5849. addComponent: function(a, b) {
  5850. var c = !1,
  5851. d = this.components.pop();
  5852. if (b != null || !a.equals(d)) c = GeoGlobe.Geometry.Collection.prototype.addComponent.apply(this, arguments);
  5853. GeoGlobe.Geometry.Collection.prototype.addComponent.apply(this, [this.components[0]]);
  5854. return c
  5855. },
  5856. removeComponent: function() {
  5857. var a = this.components && this.components.length > 3;
  5858. a && (this.components.pop(), GeoGlobe.Geometry.Collection.prototype.removeComponent.apply(this,
  5859. arguments), GeoGlobe.Geometry.Collection.prototype.addComponent.apply(this, [this.components[0]]));
  5860. return a
  5861. },
  5862. move: function(a, b) {
  5863. for (var c = 0, d = this.components.length; c < d - 1; c++) this.components[c].move(a, b)
  5864. },
  5865. rotate: function(a, b) {
  5866. for (var c = 0, d = this.components.length; c < d - 1; ++c) this.components[c].rotate(a, b)
  5867. },
  5868. resize: function(a, b, c) {
  5869. for (var d = 0, e = this.components.length; d < e - 1; ++d) this.components[d].resize(a, b, c);
  5870. return this
  5871. },
  5872. transform: function(a, b) {
  5873. if (a && b) {
  5874. for (var c = 0, d = this.components.length; c < d - 1; c++) this.components[c].transform(a,
  5875. b);
  5876. this.bounds = null
  5877. }
  5878. return this
  5879. },
  5880. getCentroid: function() {
  5881. if (this.components) {
  5882. var a = this.components.length;
  5883. if (a > 0 && a <= 2) return this.components[0].clone();
  5884. else if (a > 2) {
  5885. var b = 0,
  5886. c = 0,
  5887. d = this.components[0].x,
  5888. e = this.components[0].y,
  5889. f = -1 * this.getArea();
  5890. if (f != 0) {
  5891. for (var g = 0; g < a - 1; g++) {
  5892. var h = this.components[g],
  5893. j = this.components[g + 1];
  5894. b += (h.x + j.x - 2 * d) * ((h.x - d) * (j.y - e) - (j.x - d) * (h.y - e));
  5895. c += (h.y + j.y - 2 * e) * ((h.x - d) * (j.y - e) - (j.x - d) * (h.y - e))
  5896. }
  5897. b = d + b / (6 * f);
  5898. a = e + c / (6 * f)
  5899. } else {
  5900. for (g = 0; g < a - 1; g++) b += this.components[g].x, c += this.components[g].y;
  5901. b /= a - 1;
  5902. a = c / (a - 1)
  5903. }
  5904. return new GeoGlobe.Geometry.Point(b, a)
  5905. } else return null
  5906. }
  5907. },
  5908. getArea: function() {
  5909. var a = 0;
  5910. if (this.components && this.components.length > 2) {
  5911. for (var b = a = 0, c = this.components.length; b < c - 1; b++) {
  5912. var d = this.components[b],
  5913. e = this.components[b + 1];
  5914. a += (d.x + e.x) * (e.y - d.y)
  5915. }
  5916. a = -a / 2
  5917. }
  5918. return a
  5919. },
  5920. getGeodesicArea: function(a) {
  5921. var b = this;
  5922. if (a) {
  5923. var c = new GeoGlobe.SpatialReference("EPSG:4326");
  5924. c.equals(a) || (b = this.clone().transform(a, c))
  5925. }
  5926. a = 0;
  5927. c = b.components && b.components.length;
  5928. if (c > 2) {
  5929. for (var d, e, f = 0; f < c - 1; f++) d =
  5930. b.components[f], e = b.components[f + 1], a += GeoGlobe.Util.rad(e.x - d.x) * (2 + Math.sin(GeoGlobe.Util.rad(d.y)) + Math.sin(GeoGlobe.Util.rad(e.y)));
  5931. a = a * 40680631590769 / 2
  5932. }
  5933. return a
  5934. },
  5935. containsPoint: function(a) {
  5936. for (var b = GeoGlobe.Number.limitSigDigs, c = b(a.x, 14), a = b(a.y, 14), d = this.components.length - 1, e, f, g, h, j, l = 0, m = 0; m < d; ++m)
  5937. if (e = this.components[m], g = b(e.x, 14), e = b(e.y, 14), f = this.components[m + 1], h = b(f.x, 14), f = b(f.y, 14), e == f) {
  5938. if (a == e && (g <= h && c >= g && c <= h || g >= h && c <= g && c >= h)) {
  5939. l = -1;
  5940. break
  5941. }
  5942. } else {
  5943. j = b((a - f) * ((h - g) / (f - e)) + h, 14);
  5944. if (j == c && (e < f && a >= e && a <= f || e > f && a <= e && a >= f)) {
  5945. l = -1;
  5946. break
  5947. }
  5948. j <= c || g != h && (j < Math.min(g, h) || j > Math.max(g, h)) || (e < f && a >= e && a < f || e > f && a < e && a >= f) && ++l
  5949. }
  5950. return l == -1 ? 1 : !!(l & 1)
  5951. },
  5952. intersects: function(a) {
  5953. var b = !1;
  5954. if (a.CLASS_NAME == "GeoGlobe.Geometry.Point") b = this.containsPoint(a);
  5955. else if (a.CLASS_NAME == "GeoGlobe.Geometry.LineString") b = a.intersects(this);
  5956. else if (a.CLASS_NAME == "GeoGlobe.Geometry.LinearRing") b = GeoGlobe.Geometry.LineString.prototype.intersects.apply(this, [a]);
  5957. else
  5958. for (var c = 0, d = a.components.length; c <
  5959. d; ++c)
  5960. if (b = a.components[c].intersects(this)) break;
  5961. return b
  5962. },
  5963. getVertices: function(a) {
  5964. return a === !0 ? [] : this.components.slice(0, this.components.length - 1)
  5965. },
  5966. CLASS_NAME: "GeoGlobe.Geometry.LinearRing"
  5967. });
  5968. GeoGlobe.Geometry.Polygon = GeoGlobe.Class4OL(GeoGlobe.Geometry.Collection, {
  5969. componentTypes: ["GeoGlobe.Geometry.LinearRing"],
  5970. getArea: function() {
  5971. var a = 0;
  5972. if (this.components && this.components.length > 0) {
  5973. a += Math.abs(this.components[0].getArea());
  5974. for (var b = 1, c = this.components.length; b < c; b++) a -= Math.abs(this.components[b].getArea())
  5975. }
  5976. return a
  5977. },
  5978. getGeodesicArea: function(a) {
  5979. var b = 0;
  5980. if (this.components && this.components.length > 0) {
  5981. b += Math.abs(this.components[0].getGeodesicArea(a));
  5982. for (var c = 1, d = this.components.length; c <
  5983. d; c++) b -= Math.abs(this.components[c].getGeodesicArea(a))
  5984. }
  5985. return b
  5986. },
  5987. containsPoint: function(a) {
  5988. var b = this.components.length,
  5989. c = !1;
  5990. if (b > 0 && (c = this.components[0].containsPoint(a), c !== 1 && c && b > 1))
  5991. for (var d, e = 1; e < b; ++e)
  5992. if (d = this.components[e].containsPoint(a)) {
  5993. c = d === 1 ? 1 : !1;
  5994. break
  5995. }
  5996. return c
  5997. },
  5998. intersects: function(a) {
  5999. var b = !1,
  6000. c, d;
  6001. if (a.CLASS_NAME == "GeoGlobe.Geometry.Point") b = this.containsPoint(a);
  6002. else if (a.CLASS_NAME == "GeoGlobe.Geometry.LineString" || a.CLASS_NAME == "GeoGlobe.Geometry.LinearRing") {
  6003. c = 0;
  6004. for (d = this.components.length; c <
  6005. d; ++c)
  6006. if (b = a.intersects(this.components[c])) break;
  6007. if (!b) {
  6008. c = 0;
  6009. for (d = a.components.length; c < d; ++c)
  6010. if (b = this.containsPoint(a.components[c])) break
  6011. }
  6012. } else {
  6013. c = 0;
  6014. for (d = a.components.length; c < d; ++c)
  6015. if (b = this.intersects(a.components[c])) break
  6016. }
  6017. if (!b && a.CLASS_NAME == "GeoGlobe.Geometry.Polygon") {
  6018. var e = this.components[0];
  6019. c = 0;
  6020. for (d = e.components.length; c < d; ++c)
  6021. if (b = a.containsPoint(e.components[c])) break
  6022. }
  6023. return b
  6024. },
  6025. distanceTo: function(a, b) {
  6026. return b && b.edge === !1 && this.intersects(a) ? 0 : GeoGlobe.Geometry.Collection.prototype.distanceTo.apply(this, [a, b])
  6027. },
  6028. CLASS_NAME: "GeoGlobe.Geometry.Polygon"
  6029. });
  6030. GeoGlobe.Geometry.Polygon.createRegularPolygon = function(a, b, c, d) {
  6031. var e = Math.PI * (1 / c - 0.5);
  6032. d && (e += d / 180 * Math.PI);
  6033. for (var f, g = [], h = 0; h < c; ++h) f = e + h * 2 * Math.PI / c, d = a.x + b * Math.cos(f), f = a.y + b * Math.sin(f), g.push(new GeoGlobe.Geometry.Point(d, f));
  6034. a = new GeoGlobe.Geometry.LinearRing(g);
  6035. return new GeoGlobe.Geometry.Polygon([a])
  6036. };
  6037. GeoGlobe.Geometry.MultiLineString = GeoGlobe.Class4OL(GeoGlobe.Geometry.Collection, {
  6038. componentTypes: ["GeoGlobe.Geometry.LineString"],
  6039. split: function(a, b) {
  6040. for (var c = null, d = b && b.mutual, e, f, g, h, j = [], l = [a], m = 0, n = this.components.length; m < n; ++m) {
  6041. f = this.components[m];
  6042. g = !1;
  6043. for (var p = 0; p < l.length; ++p)
  6044. if (e = f.split(l[p], b)) {
  6045. if (d) {
  6046. g = e[0];
  6047. for (var q = 0, o = g.length; q < o; ++q) q === 0 && j.length ? j[j.length - 1].addComponent(g[q]) : j.push(new GeoGlobe.Geometry.MultiLineString([g[q]]));
  6048. g = !0;
  6049. e = e[1]
  6050. }
  6051. if (e.length) {
  6052. e.unshift(p, 1);
  6053. Array.prototype.splice.apply(l,
  6054. e);
  6055. break
  6056. }
  6057. }
  6058. g || (j.length ? j[j.length - 1].addComponent(f.clone()) : j = [new GeoGlobe.Geometry.MultiLineString(f.clone())])
  6059. }
  6060. j && j.length > 1 ? g = !0 : j = [];
  6061. l && l.length > 1 ? h = !0 : l = [];
  6062. if (g || h) c = d ? [j, l] : l;
  6063. return c
  6064. },
  6065. splitWith: function(a, b) {
  6066. var c = null,
  6067. d = b && b.mutual,
  6068. e, f, g, h, j, l;
  6069. if (a instanceof GeoGlobe.Geometry.LineString) {
  6070. l = [];
  6071. j = [a];
  6072. for (var m = 0, n = this.components.length; m < n; ++m) {
  6073. g = !1;
  6074. f = this.components[m];
  6075. for (var p = 0; p < j.length; ++p)
  6076. if (e = j[p].split(f, b)) {
  6077. d && (g = e[0], g.length && (g.unshift(p, 1), Array.prototype.splice.apply(j, g),
  6078. p += g.length - 2), e = e[1], e.length === 0 && (e = [f.clone()]));
  6079. g = 0;
  6080. for (var q = e.length; g < q; ++g) g === 0 && l.length ? l[l.length - 1].addComponent(e[g]) : l.push(new GeoGlobe.Geometry.MultiLineString([e[g]]));
  6081. g = !0
  6082. }
  6083. g || (l.length ? l[l.length - 1].addComponent(f.clone()) : l = [new GeoGlobe.Geometry.MultiLineString([f.clone()])])
  6084. }
  6085. } else c = a.split(this);
  6086. j && j.length > 1 ? h = !0 : j = [];
  6087. l && l.length > 1 ? g = !0 : l = [];
  6088. if (h || g) c = d ? [j, l] : l;
  6089. return c
  6090. },
  6091. CLASS_NAME: "GeoGlobe.Geometry.MultiLineString"
  6092. });
  6093. GeoGlobe.Geometry.MultiPolygon = GeoGlobe.Class4OL(GeoGlobe.Geometry.Collection, {
  6094. componentTypes: ["GeoGlobe.Geometry.Polygon"],
  6095. CLASS_NAME: "GeoGlobe.Geometry.MultiPolygon"
  6096. });
  6097. GeoGlobe.State = {
  6098. UNKNOWN: "Unknown",
  6099. INSERT: "Insert",
  6100. UPDATE: "Update",
  6101. DELETE: "Delete"
  6102. };
  6103. GeoGlobe.Feature = GeoGlobe.Class4OL({
  6104. id: null,
  6105. fid: null,
  6106. lonlat: null,
  6107. geometry: null,
  6108. attributes: null,
  6109. data: null,
  6110. bounds: null,
  6111. state: null,
  6112. url: null,
  6113. modified: null,
  6114. initialize: function(a, b) {
  6115. this.data = b != null ? b : {};
  6116. this.id = GeoGlobe.Util.createUniqueID(this.CLASS_NAME + "_");
  6117. this.lonlat = null;
  6118. this.geometry = a ? a : null;
  6119. this.state = null;
  6120. this.attributes = {};
  6121. if (b) this.attributes = GeoGlobe.Util.extend(this.attributes, b)
  6122. },
  6123. destroy: function() {
  6124. this.data = this.lonlat = this.id = this.modified = this.geometry = null
  6125. },
  6126. clone: function() {
  6127. return new GeoGlobe.Feature(this.geometry ?
  6128. this.geometry.clone() : null, this.attributes)
  6129. },
  6130. createMarker: function() {
  6131. return null
  6132. },
  6133. destroyMarker: function() {},
  6134. createPopup: function() {
  6135. return null
  6136. },
  6137. atPoint: function(a, b, c) {
  6138. var d = !1;
  6139. this.geometry && (d = this.geometry.atPoint(a, b, c));
  6140. return d
  6141. },
  6142. destroyPopup: function() {},
  6143. toState: function(a) {
  6144. if (a == GeoGlobe.State.UPDATE) switch (this.state) {
  6145. case GeoGlobe.State.UNKNOWN:
  6146. case GeoGlobe.State.DELETE:
  6147. this.state = a
  6148. } else if (a == GeoGlobe.State.INSERT) switch (this.state) {
  6149. case GeoGlobe.State.UNKNOWN:
  6150. break;
  6151. default:
  6152. this.state =
  6153. a
  6154. } else if (a == GeoGlobe.State.DELETE) switch (this.state) {
  6155. case GeoGlobe.State.UNKNOWN:
  6156. case GeoGlobe.State.UPDATE:
  6157. this.state = a
  6158. } else if (a == GeoGlobe.State.UNKNOWN) this.state = a
  6159. },
  6160. CLASS_NAME: "GeoGlobe.Feature"
  6161. });
  6162. GeoGlobe.Feature.getBoundsByFeatures = function(a) {
  6163. for (var b = a.length, c = Array(b), d = 0; d < b; ++d) c[d] = a[d].geometry;
  6164. a = new GeoGlobe.Geometry.Collection(c);
  6165. a.calculateBounds();
  6166. return a.bounds
  6167. };
  6168. GeoGlobe.Feature.fromGeoJson = function(a) {
  6169. var b;
  6170. GeoGlobe.Format && GeoGlobe.Format.GeoJSON && (format = new GeoGlobe.Format.GeoJSON, b = format.read(a));
  6171. return b
  6172. };
  6173. GeoGlobe.Filter = GeoGlobe.Class4OL({
  6174. initialize: function(a) {
  6175. GeoGlobe.Util.extend(this, a)
  6176. },
  6177. destroy: function() {},
  6178. evaluate: function() {
  6179. return !0
  6180. },
  6181. clone: function() {
  6182. return null
  6183. },
  6184. toString: function() {
  6185. return GeoGlobe.Format && GeoGlobe.Format.CQL ? GeoGlobe.Format.CQL.prototype.write(this) : Object.prototype.toString.call(this)
  6186. },
  6187. CLASS_NAME: "GeoGlobe.Filter"
  6188. });
  6189. GeoGlobe.Filter.FeatureId = GeoGlobe.Class4OL(GeoGlobe.Filter, {
  6190. fids: null,
  6191. type: "FID",
  6192. initialize: function(a) {
  6193. this.fids = [];
  6194. GeoGlobe.Filter.prototype.initialize.apply(this, [a])
  6195. },
  6196. evaluate: function(a) {
  6197. for (var b = 0, c = this.fids.length; b < c; b++)
  6198. if ((a.fid || a.id) == this.fids[b]) return !0;
  6199. return !1
  6200. },
  6201. clone: function() {
  6202. var a = new GeoGlobe.Filter.FeatureId;
  6203. GeoGlobe.Util.extend(a, this);
  6204. a.fids = this.fids.slice();
  6205. return a
  6206. },
  6207. CLASS_NAME: "GeoGlobe.Filter.FeatureId"
  6208. });
  6209. GeoGlobe.Filter.Logical = GeoGlobe.Class4OL(GeoGlobe.Filter, {
  6210. filters: null,
  6211. type: null,
  6212. initialize: function(a) {
  6213. this.filters = [];
  6214. GeoGlobe.Filter.prototype.initialize.apply(this, [a])
  6215. },
  6216. destroy: function() {
  6217. this.filters = null;
  6218. GeoGlobe.Filter.prototype.destroy.apply(this)
  6219. },
  6220. evaluate: function(a) {
  6221. var b, c;
  6222. switch (this.type) {
  6223. case GeoGlobe.Filter.Logical.AND:
  6224. b = 0;
  6225. for (c = this.filters.length; b < c; b++)
  6226. if (this.filters[b].evaluate(a) == !1) return !1;
  6227. return !0;
  6228. case GeoGlobe.Filter.Logical.OR:
  6229. b = 0;
  6230. for (c = this.filters.length; b < c; b++)
  6231. if (this.filters[b].evaluate(a) ==
  6232. !0) return !0;
  6233. return !1;
  6234. case GeoGlobe.Filter.Logical.NOT:
  6235. return !this.filters[0].evaluate(a)
  6236. }
  6237. },
  6238. clone: function() {
  6239. for (var a = [], b = 0, c = this.filters.length; b < c; ++b) a.push(this.filters[b].clone());
  6240. return new GeoGlobe.Filter.Logical({
  6241. type: this.type,
  6242. filters: a
  6243. })
  6244. },
  6245. CLASS_NAME: "GeoGlobe.Filter.Logical"
  6246. });
  6247. GeoGlobe.Filter.Logical.AND = "&&";
  6248. GeoGlobe.Filter.Logical.OR = "||";
  6249. GeoGlobe.Filter.Logical.NOT = "!";
  6250. GeoGlobe.Filter.Comparison = GeoGlobe.Class4OL(GeoGlobe.Filter, {
  6251. type: null,
  6252. property: null,
  6253. value: null,
  6254. matchCase: !0,
  6255. lowerBoundary: null,
  6256. upperBoundary: null,
  6257. initialize: function(a) {
  6258. GeoGlobe.Filter.prototype.initialize.apply(this, [a]);
  6259. if (this.type === GeoGlobe.Filter.Comparison.LIKE && a.matchCase === void 0) this.matchCase = null
  6260. },
  6261. evaluate: function(a) {
  6262. if (a instanceof GeoGlobe.Feature) a = a.attributes;
  6263. var b = !1,
  6264. a = a[this.property];
  6265. if (a === void 0) return !1;
  6266. switch (this.type) {
  6267. case GeoGlobe.Filter.Comparison.EQUAL_TO:
  6268. b = this.value;
  6269. b = !this.matchCase && typeof a == "string" && typeof b == "string" ? a.toUpperCase() == b.toUpperCase() : a == b;
  6270. break;
  6271. case GeoGlobe.Filter.Comparison.NOT_EQUAL_TO:
  6272. b = this.value;
  6273. b = !this.matchCase && typeof a == "string" && typeof b == "string" ? a.toUpperCase() != b.toUpperCase() : a != b;
  6274. break;
  6275. case GeoGlobe.Filter.Comparison.LESS_THAN:
  6276. b = a < this.value;
  6277. break;
  6278. case GeoGlobe.Filter.Comparison.GREATER_THAN:
  6279. b = a > this.value;
  6280. break;
  6281. case GeoGlobe.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:
  6282. b = a <= this.value;
  6283. break;
  6284. case GeoGlobe.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:
  6285. b =
  6286. a >= this.value;
  6287. break;
  6288. case GeoGlobe.Filter.Comparison.BETWEEN:
  6289. b = a >= this.lowerBoundary && a <= this.upperBoundary;
  6290. break;
  6291. case GeoGlobe.Filter.Comparison.LIKE:
  6292. b = RegExp(this.value, "gi").test(a);
  6293. break;
  6294. case GeoGlobe.Filter.Comparison.IS_NULL:
  6295. b = a === null
  6296. }
  6297. return b
  6298. },
  6299. value2regex: function(a, b, c) {
  6300. if (a == ".") throw Error("'.' is an unsupported wildCard character for GeoGlobe.Filter.Comparison");
  6301. a = a ? a : "*";
  6302. b = b ? b : ".";
  6303. this.value = this.value.replace(RegExp("\\" + (c ? c : "!") + "(.|$)", "g"), "\\$1");
  6304. this.value = this.value.replace(RegExp("\\" +
  6305. b, "g"), ".");
  6306. this.value = this.value.replace(RegExp("\\" + a, "g"), ".*");
  6307. this.value = this.value.replace(RegExp("\\\\.\\*", "g"), "\\" + a);
  6308. return this.value = this.value.replace(RegExp("\\\\\\.", "g"), "\\" + b)
  6309. },
  6310. regex2value: function() {
  6311. var a = this.value,
  6312. a = a.replace(/!/g, "!!"),
  6313. a = a.replace(/(\\)?\\\./g, function(a, c) {
  6314. return c ? a : "!."
  6315. }),
  6316. a = a.replace(/(\\)?\\\*/g, function(a, c) {
  6317. return c ? a : "!*"
  6318. }),
  6319. a = a.replace(/\\\\/g, "\\");
  6320. return a = a.replace(/\.\*/g, "*")
  6321. },
  6322. clone: function() {
  6323. return GeoGlobe.Util.extend(new GeoGlobe.Filter.Comparison,
  6324. this)
  6325. },
  6326. CLASS_NAME: "GeoGlobe.Filter.Comparison"
  6327. });
  6328. GeoGlobe.Filter.Comparison.EQUAL_TO = "==";
  6329. GeoGlobe.Filter.Comparison.NOT_EQUAL_TO = "!=";
  6330. GeoGlobe.Filter.Comparison.LESS_THAN = "<";
  6331. GeoGlobe.Filter.Comparison.GREATER_THAN = ">";
  6332. GeoGlobe.Filter.Comparison.LESS_THAN_OR_EQUAL_TO = "<=";
  6333. GeoGlobe.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";
  6334. GeoGlobe.Filter.Comparison.BETWEEN = "..";
  6335. GeoGlobe.Filter.Comparison.LIKE = "~";
  6336. GeoGlobe.Filter.Comparison.IS_NULL = "NULL";
  6337. GeoGlobe.Filter.Spatial = GeoGlobe.Class4OL(GeoGlobe.Filter, {
  6338. type: null,
  6339. property: null,
  6340. value: null,
  6341. distance: null,
  6342. distanceUnits: null,
  6343. evaluate: function(a) {
  6344. var b = !1;
  6345. switch (this.type) {
  6346. case GeoGlobe.Filter.Spatial.BBOX:
  6347. case GeoGlobe.Filter.Spatial.INTERSECTS:
  6348. if (a.geometry) {
  6349. var c = this.value;
  6350. this.value.CLASS_NAME == "GeoGlobe.LngLatBounds" && (c = this.value.toGeometry());
  6351. a.geometry.intersects(c) && (b = !0)
  6352. }
  6353. break;
  6354. default:
  6355. throw Error("evaluate is not implemented for this filter type.");
  6356. }
  6357. return b
  6358. },
  6359. clone: function() {
  6360. var a =
  6361. GeoGlobe.Util.applyDefaults({
  6362. value: this.value && this.value.clone && this.value.clone()
  6363. }, this);
  6364. return new GeoGlobe.Filter.Spatial(a)
  6365. },
  6366. CLASS_NAME: "GeoGlobe.Filter.Spatial"
  6367. });
  6368. GeoGlobe.Filter.Spatial.BBOX = "BBOX";
  6369. GeoGlobe.Filter.Spatial.INTERSECTS = "INTERSECTS";
  6370. GeoGlobe.Filter.Spatial.DWITHIN = "DWITHIN";
  6371. GeoGlobe.Filter.Spatial.WITHIN = "WITHIN";
  6372. GeoGlobe.Filter.Spatial.CONTAINS = "CONTAINS";
  6373. GeoGlobe.Filter.Function = GeoGlobe.Class4OL(GeoGlobe.Filter, {
  6374. name: null,
  6375. params: null,
  6376. CLASS_NAME: "GeoGlobe.Filter.Function"
  6377. });
  6378. GeoGlobe.Protocol = GeoGlobe.Class4OL({
  6379. format: null,
  6380. options: null,
  6381. autoDestroy: !0,
  6382. defaultFilter: null,
  6383. initialize: function(a) {
  6384. a = a || {};
  6385. GeoGlobe.Util.extend(this, a);
  6386. this.options = a
  6387. },
  6388. mergeWithDefaultFilter: function(a) {
  6389. return a && this.defaultFilter ? new GeoGlobe.Filter.Logical({
  6390. type: GeoGlobe.Filter.Logical.AND,
  6391. filters: [this.defaultFilter, a]
  6392. }) : a || this.defaultFilter || void 0
  6393. },
  6394. destroy: function() {
  6395. this.format = this.options = null
  6396. },
  6397. read: function(a) {
  6398. a = a || {};
  6399. a.filter = this.mergeWithDefaultFilter(a.filter)
  6400. },
  6401. create: function() {},
  6402. update: function() {},
  6403. "delete": function() {},
  6404. commit: function() {},
  6405. abort: function() {},
  6406. createCallback: function(a, b, c) {
  6407. return GeoGlobe.Function.bind(function() {
  6408. a.apply(this, [b, c])
  6409. }, this)
  6410. },
  6411. CLASS_NAME: "GeoGlobe.Protocol"
  6412. });
  6413. GeoGlobe.Protocol.Response = GeoGlobe.Class4OL({
  6414. code: null,
  6415. requestType: null,
  6416. last: !0,
  6417. features: null,
  6418. data: null,
  6419. reqFeatures: null,
  6420. priv: null,
  6421. error: null,
  6422. initialize: function(a) {
  6423. GeoGlobe.Util.extend(this, a)
  6424. },
  6425. success: function() {
  6426. return this.code > 0
  6427. },
  6428. CLASS_NAME: "GeoGlobe.Protocol.Response"
  6429. });
  6430. GeoGlobe.Protocol.Response.SUCCESS = 1;
  6431. GeoGlobe.Protocol.Response.FAILURE = 0;
  6432. GeoGlobe.Protocol.HTTP = GeoGlobe.Class4OL(GeoGlobe.Protocol, {
  6433. url: null,
  6434. headers: null,
  6435. params: null,
  6436. callback: null,
  6437. scope: null,
  6438. readWithPOST: !1,
  6439. updateWithPOST: !1,
  6440. deleteWithPOST: !1,
  6441. wildcarded: !1,
  6442. srsInBBOX: !1,
  6443. initialize: function() {
  6444. this.params = {};
  6445. this.headers = {};
  6446. GeoGlobe.Protocol.prototype.initialize.apply(this, arguments);
  6447. if (!this.filterToParams && GeoGlobe.Format.QueryStringFilter) {
  6448. var a = new GeoGlobe.Format.QueryStringFilter({
  6449. wildcarded: this.wildcarded,
  6450. srsInBBOX: this.srsInBBOX
  6451. });
  6452. this.filterToParams = function(b,
  6453. c) {
  6454. return a.write(b, c)
  6455. }
  6456. }
  6457. },
  6458. destroy: function() {
  6459. this.headers = this.params = null;
  6460. GeoGlobe.Protocol.prototype.destroy.apply(this)
  6461. },
  6462. read: function(a) {
  6463. GeoGlobe.Protocol.prototype.read.apply(this, arguments);
  6464. a = a || {};
  6465. a.params = GeoGlobe.Util.applyDefaults(a.params, this.options.params);
  6466. a = GeoGlobe.Util.applyDefaults(a, this.options);
  6467. if (a.filter && this.filterToParams) a.params = this.filterToParams(a.filter, a.params);
  6468. var b = a.readWithPOST !== void 0 ? a.readWithPOST : this.readWithPOST,
  6469. c = new GeoGlobe.Protocol.Response({
  6470. requestType: "read"
  6471. });
  6472. b ? (b = a.headers || {}, b["Content-Type"] = "application/x-www-form-urlencoded", c.priv = GeoGlobe.Request.POST({
  6473. url: a.url,
  6474. callback: this.createCallback(this.handleRead, c, a),
  6475. data: GeoGlobe.Util.getParameterString(a.params, !0),
  6476. headers: b
  6477. })) : c.priv = GeoGlobe.Request.GET({
  6478. url: a.url,
  6479. callback: this.createCallback(this.handleRead, c, a),
  6480. params: a.params,
  6481. headers: a.headers
  6482. });
  6483. return c
  6484. },
  6485. handleRead: function(a, b) {
  6486. this.handleResponse(a, b)
  6487. },
  6488. create: function(a, b) {
  6489. var b = GeoGlobe.Util.applyDefaults(b, this.options),
  6490. c = new GeoGlobe.Protocol.Response({
  6491. reqFeatures: a,
  6492. requestType: "create"
  6493. });
  6494. c.priv = GeoGlobe.Request.POST({
  6495. url: b.url,
  6496. callback: this.createCallback(this.handleCreate, c, b),
  6497. headers: b.headers,
  6498. data: this.format.write(a)
  6499. });
  6500. return c
  6501. },
  6502. handleCreate: function(a, b) {
  6503. this.handleResponse(a, b)
  6504. },
  6505. update: function(a, b) {
  6506. var b = b || {},
  6507. c = b.url || a.url || this.options.url + "/" + a.fid,
  6508. b = GeoGlobe.Util.applyDefaults(b, this.options),
  6509. d = new GeoGlobe.Protocol.Response({
  6510. reqFeatures: a,
  6511. requestType: "update"
  6512. });
  6513. d.priv = GeoGlobe.Request[this.updateWithPOST ? "POST" : "PUT"]({
  6514. url: c,
  6515. callback: this.createCallback(this.handleUpdate,
  6516. d, b),
  6517. headers: b.headers,
  6518. data: this.format.write(a)
  6519. });
  6520. return d
  6521. },
  6522. handleUpdate: function(a, b) {
  6523. this.handleResponse(a, b)
  6524. },
  6525. "delete": function(a, b) {
  6526. var b = b || {},
  6527. c = b.url || a.url || this.options.url + "/" + a.fid,
  6528. b = GeoGlobe.Util.applyDefaults(b, this.options),
  6529. d = new GeoGlobe.Protocol.Response({
  6530. reqFeatures: a,
  6531. requestType: "delete"
  6532. }),
  6533. e = this.deleteWithPOST ? "POST" : "DELETE",
  6534. c = {
  6535. url: c,
  6536. callback: this.createCallback(this.handleDelete, d, b),
  6537. headers: b.headers
  6538. };
  6539. if (this.deleteWithPOST) c.data = this.format.write(a);
  6540. d.priv = GeoGlobe.Request[e](c);
  6541. return d
  6542. },
  6543. handleDelete: function(a, b) {
  6544. this.handleResponse(a, b)
  6545. },
  6546. handleResponse: function(a, b) {
  6547. var c = a.priv;
  6548. if (b.callback) {
  6549. if (c.status >= 200 && c.status < 300) {
  6550. if (a.requestType != "delete") a.features = this.parseFeatures(c);
  6551. a.code = GeoGlobe.Protocol.Response.SUCCESS
  6552. } else a.code = GeoGlobe.Protocol.Response.FAILURE;
  6553. b.callback.call(b.scope, a)
  6554. }
  6555. },
  6556. parseFeatures: function(a) {
  6557. var b = a.responseXML;
  6558. if (!b || !b.documentElement) b = a.responseText;
  6559. if (!b || b.length <= 0) return null;
  6560. return this.format.read(b)
  6561. },
  6562. commit: function(a, b) {
  6563. function c(a) {
  6564. for (var b =
  6565. a.features ? a.features.length : 0, c = Array(b), e = 0; e < b; ++e) c[e] = a.features[e].fid;
  6566. o.insertIds = c;
  6567. d.apply(this, [a])
  6568. }
  6569. function d(a) {
  6570. this.callUserCallback(a, b);
  6571. q = q && a.success();
  6572. f++;
  6573. if (f >= p && b.callback) o.code = q ? GeoGlobe.Protocol.Response.SUCCESS : GeoGlobe.Protocol.Response.FAILURE, b.callback.apply(b.scope, [o])
  6574. }
  6575. var b = GeoGlobe.Util.applyDefaults(b, this.options),
  6576. e = [],
  6577. f = 0,
  6578. g = {};
  6579. g[GeoGlobe.State.INSERT] = [];
  6580. g[GeoGlobe.State.UPDATE] = [];
  6581. g[GeoGlobe.State.DELETE] = [];
  6582. for (var h, j, l = [], m = 0, n = a.length; m < n; ++m)
  6583. if (h = a[m], j = g[h.state]) j.push(h),
  6584. l.push(h);
  6585. var p = (g[GeoGlobe.State.INSERT].length > 0 ? 1 : 0) + g[GeoGlobe.State.UPDATE].length + g[GeoGlobe.State.DELETE].length,
  6586. q = !0,
  6587. o = new GeoGlobe.Protocol.Response({
  6588. reqFeatures: l
  6589. });
  6590. h = g[GeoGlobe.State.INSERT];
  6591. h.length > 0 && e.push(this.create(h, GeoGlobe.Util.applyDefaults({
  6592. callback: c,
  6593. scope: this
  6594. }, b.create)));
  6595. h = g[GeoGlobe.State.UPDATE];
  6596. for (m = h.length - 1; m >= 0; --m) e.push(this.update(h[m], GeoGlobe.Util.applyDefaults({
  6597. callback: d,
  6598. scope: this
  6599. }, b.update)));
  6600. h = g[GeoGlobe.State.DELETE];
  6601. for (m = h.length - 1; m >= 0; --m) e.push(this["delete"](h[m],
  6602. GeoGlobe.Util.applyDefaults({
  6603. callback: d,
  6604. scope: this
  6605. }, b["delete"])));
  6606. return e
  6607. },
  6608. abort: function(a) {
  6609. a && a.priv.abort()
  6610. },
  6611. callUserCallback: function(a, b) {
  6612. var c = b[a.requestType];
  6613. c && c.callback && c.callback.call(c.scope, a)
  6614. },
  6615. CLASS_NAME: "GeoGlobe.Protocol.HTTP"
  6616. });
  6617. GeoGlobe.Protocol.WFS = function(a) {
  6618. var a = GeoGlobe.Util.applyDefaults(a, GeoGlobe.Protocol.WFS.DEFAULTS),
  6619. b = GeoGlobe.Protocol.WFS["v" + a.version.replace(/\./g, "_")];
  6620. if (!b) throw "Unsupported WFS version: " + a.version;
  6621. return new b(a)
  6622. };
  6623. GeoGlobe.Protocol.WFS.DEFAULTS = {
  6624. version: "1.0.0"
  6625. };
  6626. GeoGlobe.Protocol.WFS.v1 = GeoGlobe.Class4OL(GeoGlobe.Protocol, {
  6627. version: null,
  6628. srsName: "EPSG:4326",
  6629. featureType: null,
  6630. featureNS: null,
  6631. geometryName: "the_geom",
  6632. schema: null,
  6633. featurePrefix: "feature",
  6634. formatOptions: null,
  6635. readFormat: null,
  6636. readOptions: null,
  6637. initialize: function(a) {
  6638. GeoGlobe.Protocol.prototype.initialize.apply(this, [a]);
  6639. if (!a.format) this.format = GeoGlobe.Format.WFST(GeoGlobe.Util.extend({
  6640. version: this.version,
  6641. featureType: this.featureType,
  6642. featureNS: this.featureNS,
  6643. featurePrefix: this.featurePrefix,
  6644. geometryName: this.geometryName,
  6645. srsName: this.srsName,
  6646. schema: this.schema
  6647. }, this.formatOptions));
  6648. !a.geometryName && parseFloat(this.format.version) > 1 && this.setGeometryName(null)
  6649. },
  6650. destroy: function() {
  6651. this.options && !this.options.format && this.format.destroy();
  6652. this.format = null;
  6653. GeoGlobe.Protocol.prototype.destroy.apply(this)
  6654. },
  6655. read: function(a) {
  6656. GeoGlobe.Protocol.prototype.read.apply(this, arguments);
  6657. a = GeoGlobe.Util.extend({}, a);
  6658. GeoGlobe.Util.applyDefaults(a, this.options || {});
  6659. var b = new GeoGlobe.Protocol.Response({
  6660. requestType: "read"
  6661. }),
  6662. c = GeoGlobe.Format.XML.prototype.write.apply(this.format, [this.format.writeNode("wfs:GetFeature", a)]);
  6663. b.priv = GeoGlobe.Request.POST({
  6664. url: a.url,
  6665. callback: this.createCallback(this.handleRead, b, a),
  6666. params: a.params,
  6667. headers: a.headers,
  6668. data: c
  6669. });
  6670. return b
  6671. },
  6672. setFeatureType: function(a) {
  6673. this.featureType = a;
  6674. this.format.featureType = a
  6675. },
  6676. setGeometryName: function(a) {
  6677. this.geometryName = a;
  6678. this.format.geometryName = a
  6679. },
  6680. handleRead: function(a, b) {
  6681. b = GeoGlobe.Util.extend({}, b);
  6682. GeoGlobe.Util.applyDefaults(b, this.options);
  6683. if (b.callback) {
  6684. var c = a.priv;
  6685. c.status >= 200 && c.status < 300 ? (c = this.parseResponse(c,
  6686. b.readOptions)) && c.success !== !1 ? (b.readOptions && b.readOptions.output == "object" ? GeoGlobe.Util.extend(a, c) : a.features = c, a.code = GeoGlobe.Protocol.Response.SUCCESS) : (a.code = GeoGlobe.Protocol.Response.FAILURE, a.error = c) : a.code = GeoGlobe.Protocol.Response.FAILURE;
  6687. b.callback.call(b.scope, a)
  6688. }
  6689. },
  6690. parseResponse: function(a, b) {
  6691. var c = a.responseXML;
  6692. if (!c || !c.documentElement) c = a.responseText;
  6693. if (!c || c.length <= 0) return null;
  6694. var d = null;
  6695. try {
  6696. d = this.readFormat !== null ? this.readFormat.read(c) : this.format.read(c, b)
  6697. } catch (e) {
  6698. alert("\u7a0b\u5e8f\u8fd0\u884c\u5f02\u5e38\uff1a" +
  6699. e.name + "\uff0c" + e.message)
  6700. }
  6701. if (!this.featureNS) c = this.readFormat || this.format, this.featureNS = c.featureNS, c.autoConfig = !1, this.geometryName || this.setGeometryName(c.geometryName);
  6702. return d
  6703. },
  6704. commit: function(a, b) {
  6705. b = GeoGlobe.Util.extend({}, b);
  6706. GeoGlobe.Util.applyDefaults(b, this.options);
  6707. var c = new GeoGlobe.Protocol.Response({
  6708. requestType: "commit",
  6709. reqFeatures: a
  6710. });
  6711. c.priv = GeoGlobe.Request.POST({
  6712. url: b.url,
  6713. headers: b.headers,
  6714. data: this.format.write(a, b),
  6715. callback: this.createCallback(this.handleCommit, c, b)
  6716. });
  6717. return c
  6718. },
  6719. handleCommit: function(a, b) {
  6720. if (b.callback) {
  6721. var c = a.priv,
  6722. d = c.responseXML;
  6723. if (!d || !d.documentElement) d = c.responseText;
  6724. c = this.format.read(d) || {};
  6725. a.insertIds = c.insertIds || [];
  6726. c.success ? a.code = GeoGlobe.Protocol.Response.SUCCESS : (a.code = GeoGlobe.Protocol.Response.FAILURE, a.error = c);
  6727. b.callback.call(b.scope, a)
  6728. }
  6729. },
  6730. filterDelete: function(a, b) {
  6731. b = GeoGlobe.Util.extend({}, b);
  6732. GeoGlobe.Util.applyDefaults(b, this.options);
  6733. new GeoGlobe.Protocol.Response({
  6734. requestType: "commit"
  6735. });
  6736. var c = this.format.createElementNSPlus("wfs:Transaction", {
  6737. attributes: {
  6738. service: "WFS",
  6739. version: this.version
  6740. }
  6741. }),
  6742. d = this.format.createElementNSPlus("wfs:Delete", {
  6743. attributes: {
  6744. typeName: (b.featureNS ? this.featurePrefix + ":" : "") + b.featureType
  6745. }
  6746. });
  6747. b.featureNS && d.setAttribute("xmlns:" + this.featurePrefix, b.featureNS);
  6748. var e = this.format.writeNode("ogc:Filter", a);
  6749. d.appendChild(e);
  6750. c.appendChild(d);
  6751. c = GeoGlobe.Format.XML.prototype.write.apply(this.format, [c]);
  6752. return GeoGlobe.Request.POST({
  6753. url: this.url,
  6754. callback: b.callback || function() {},
  6755. data: c
  6756. })
  6757. },
  6758. abort: function(a) {
  6759. a && a.priv.abort()
  6760. },
  6761. CLASS_NAME: "GeoGlobe.Protocol.WFS.v1"
  6762. });
  6763. GeoGlobe.Protocol.WFS.v1_0_0 = GeoGlobe.Class4OL(GeoGlobe.Protocol.WFS.v1, {
  6764. version: "1.0.0",
  6765. CLASS_NAME: "GeoGlobe.Protocol.WFS.v1_0_0"
  6766. });
  6767. GeoGlobe.Protocol.WFS.v1_1_0 = GeoGlobe.Class4OL(GeoGlobe.Protocol.WFS.v1, {
  6768. version: "1.1.0",
  6769. initialize: function() {
  6770. GeoGlobe.Protocol.WFS.v1.prototype.initialize.apply(this, arguments);
  6771. if (this.outputFormat && !this.readFormat)
  6772. if (this.outputFormat.toLowerCase() == "gml2") this.readFormat = new GeoGlobe.Format.GML.v2({
  6773. featureType: this.featureType,
  6774. featureNS: this.featureNS,
  6775. geometryName: this.geometryName
  6776. });
  6777. else if (this.outputFormat.toLowerCase() == "json") this.readFormat = new GeoGlobe.Format.GeoJSON
  6778. },
  6779. CLASS_NAME: "GeoGlobe.Protocol.WFS.v1_1_0"
  6780. });
  6781. GeoGlobe.Protocol.CSW = function(a) {
  6782. var a = GeoGlobe.Util.applyDefaults(a, GeoGlobe.Protocol.CSW.DEFAULTS),
  6783. b = GeoGlobe.Protocol.CSW["v" + a.version.replace(/\./g, "_")];
  6784. if (!b) throw "Unsupported CSW version: " + a.version;
  6785. return new b(a)
  6786. };
  6787. GeoGlobe.Protocol.CSW.DEFAULTS = {
  6788. version: "2.0.2"
  6789. };
  6790. GeoGlobe.Protocol.CSW.v2_0_2 = GeoGlobe.Class4OL(GeoGlobe.Protocol, {
  6791. formatOptions: null,
  6792. initialize: function(a) {
  6793. GeoGlobe.Protocol.prototype.initialize.apply(this, [a]);
  6794. if (!a.format) this.format = new GeoGlobe.Format.CSWGetRecords.v2_0_2(GeoGlobe.Util.extend({}, this.formatOptions))
  6795. },
  6796. destroy: function() {
  6797. this.options && !this.options.format && this.format.destroy();
  6798. this.format = null;
  6799. GeoGlobe.Protocol.prototype.destroy.apply(this)
  6800. },
  6801. read: function(a) {
  6802. a = GeoGlobe.Util.extend({}, a);
  6803. GeoGlobe.Util.applyDefaults(a, this.options || {});
  6804. var b = new GeoGlobe.Protocol.Response({
  6805. requestType: "read"
  6806. }),
  6807. c = this.format.write(a.params || a);
  6808. b.priv = GeoGlobe.Request.POST({
  6809. url: a.url,
  6810. callback: this.createCallback(this.handleRead, b, a),
  6811. params: a.params,
  6812. headers: a.headers,
  6813. data: c
  6814. });
  6815. return b
  6816. },
  6817. handleRead: function(a, b) {
  6818. if (b.callback) {
  6819. var c = a.priv;
  6820. c.status >= 200 && c.status < 300 ? (a.data = this.parseData(c), a.code = GeoGlobe.Protocol.Response.SUCCESS) : a.code = GeoGlobe.Protocol.Response.FAILURE;
  6821. b.callback.call(b.scope, a)
  6822. }
  6823. },
  6824. parseData: function(a) {
  6825. var b = a.responseXML;
  6826. if (!b || !b.documentElement) b = a.responseText;
  6827. if (!b || b.length <= 0) return null;
  6828. return this.format.read(b)
  6829. },
  6830. CLASS_NAME: "GeoGlobe.Protocol.CSW.v2_0_2"
  6831. });
  6832. GeoGlobe.Protocol.Script = GeoGlobe.Class4OL(GeoGlobe.Protocol, {
  6833. url: null,
  6834. params: null,
  6835. callback: null,
  6836. callbackTemplate: "GeoGlobe.Protocol.Script.registry.${id}",
  6837. callbackKey: "callback",
  6838. callbackPrefix: "",
  6839. scope: null,
  6840. format: null,
  6841. pendingRequests: null,
  6842. srsInBBOX: !1,
  6843. initialize: function() {
  6844. this.params = {};
  6845. this.pendingRequests = {};
  6846. GeoGlobe.Protocol.prototype.initialize.apply(this, arguments);
  6847. if (!this.format) this.format = new GeoGlobe.Format.GeoJSON;
  6848. if (!this.filterToParams && GeoGlobe.Format.QueryStringFilter) {
  6849. var a = new GeoGlobe.Format.QueryStringFilter({
  6850. srsInBBOX: this.srsInBBOX
  6851. });
  6852. this.filterToParams = function(b, c) {
  6853. return a.write(b, c)
  6854. }
  6855. }
  6856. },
  6857. read: function(a) {
  6858. GeoGlobe.Protocol.prototype.read.apply(this, arguments);
  6859. a = GeoGlobe.Util.applyDefaults(a, this.options);
  6860. a.params = GeoGlobe.Util.applyDefaults(a.params, this.options.params);
  6861. if (a.filter && this.filterToParams) a.params = this.filterToParams(a.filter, a.params);
  6862. var b = new GeoGlobe.Protocol.Response({
  6863. requestType: "read"
  6864. }),
  6865. c = this.createRequest(a.url, a.params, GeoGlobe.Function.bind(function(c) {
  6866. b.data = c;
  6867. this.handleRead(b, a)
  6868. }, this));
  6869. b.priv = c;
  6870. return b
  6871. },
  6872. createRequest: function(a, b, c) {
  6873. var c = GeoGlobe.Protocol.Script.register(c),
  6874. d = GeoGlobe.String.format(this.callbackTemplate, {
  6875. id: c
  6876. }),
  6877. b = GeoGlobe.Util.extend({}, b);
  6878. b[this.callbackKey] = this.callbackPrefix + d;
  6879. a = GeoGlobe.Util.urlAppend(a, GeoGlobe.Util.getParameterString(b, !0));
  6880. b = document.createElement("script");
  6881. b.type = "text/javascript";
  6882. b.src = a;
  6883. b.id = "GeoGlobe_Protocol_Script_" + c;
  6884. this.pendingRequests[b.id] = b;
  6885. document.getElementsByTagName("head")[0].appendChild(b);
  6886. return b
  6887. },
  6888. destroyRequest: function(a) {
  6889. GeoGlobe.Protocol.Script.unregister(a.id.split("_").pop());
  6890. delete this.pendingRequests[a.id];
  6891. a.parentNode && a.parentNode.removeChild(a)
  6892. },
  6893. handleRead: function(a, b) {
  6894. this.handleResponse(a, b)
  6895. },
  6896. handleResponse: function(a, b) {
  6897. if (b.callback) a.data ? (a.features = this.parseFeatures(a.data), a.code = GeoGlobe.Protocol.Response.SUCCESS) : a.code = GeoGlobe.Protocol.Response.FAILURE, this.destroyRequest(a.priv), b.callback.call(b.scope, a)
  6898. },
  6899. parseFeatures: function(a) {
  6900. return this.format.read(a)
  6901. },
  6902. abort: function(a) {
  6903. if (a) this.destroyRequest(a.priv);
  6904. else
  6905. for (var b in this.pendingRequests) this.destroyRequest(this.pendingRequests[b])
  6906. },
  6907. destroy: function() {
  6908. this.abort();
  6909. delete this.params;
  6910. delete this.format;
  6911. GeoGlobe.Protocol.prototype.destroy.apply(this)
  6912. },
  6913. CLASS_NAME: "GeoGlobe.Protocol.Script"
  6914. });
  6915. (function() {
  6916. var a = GeoGlobe.Protocol.Script,
  6917. b = 0;
  6918. a.registry = {};
  6919. a.register = function(c) {
  6920. var d = "c" + ++b;
  6921. a.registry[d] = function() {
  6922. c.apply(this, arguments)
  6923. };
  6924. return d
  6925. };
  6926. a.unregister = function(b) {
  6927. delete a.registry[b]
  6928. }
  6929. })();
  6930. GeoGlobe.Format = GeoGlobe.Class4OL({
  6931. options: null,
  6932. externalProjection: null,
  6933. internalProjection: null,
  6934. data: null,
  6935. keepData: !1,
  6936. initialize: function(a) {
  6937. GeoGlobe.Util.extend(this, a);
  6938. this.options = a
  6939. },
  6940. destroy: function() {},
  6941. read: function() {
  6942. throw Error("Read not implemented.");
  6943. },
  6944. write: function() {
  6945. throw Error("Write not implemented.");
  6946. },
  6947. CLASS_NAME: "GeoGlobe.Format"
  6948. });
  6949. GeoGlobe.Format.XML = GeoGlobe.Class4OL(GeoGlobe.Format, {
  6950. namespaces: null,
  6951. namespaceAlias: null,
  6952. defaultPrefix: null,
  6953. readers: {},
  6954. writers: {},
  6955. xmldom: null,
  6956. initialize: function(a) {
  6957. if (window.ActiveXObject) this.xmldom = new ActiveXObject("Microsoft.XMLDOM");
  6958. GeoGlobe.Format.prototype.initialize.apply(this, [a]);
  6959. this.namespaces = GeoGlobe.Util.extend({}, this.namespaces);
  6960. this.namespaceAlias = {};
  6961. for (var b in this.namespaces) this.namespaceAlias[this.namespaces[b]] = b
  6962. },
  6963. destroy: function() {
  6964. this.xmldom = null;
  6965. GeoGlobe.Format.prototype.destroy.apply(this,
  6966. arguments)
  6967. },
  6968. setNamespace: function(a, b) {
  6969. this.namespaces[a] = b;
  6970. this.namespaceAlias[b] = a
  6971. },
  6972. read: function(a) {
  6973. var b = a.indexOf("<");
  6974. b > 0 && (a = a.substring(b));
  6975. b = GeoGlobe.Util.Try(GeoGlobe.Function.bind(function() {
  6976. var b;
  6977. b = window.ActiveXObject && !this.xmldom ? new ActiveXObject("Microsoft.XMLDOM") : this.xmldom;
  6978. b.loadXML(a);
  6979. return b
  6980. }, this), function() {
  6981. return (new DOMParser).parseFromString(a, "text/xml")
  6982. }, function() {
  6983. var b = new XMLHttpRequest;
  6984. b.open("GET", "data:text/xml;charset=utf-8," + encodeURIComponent(a), !1);
  6985. b.overrideMimeType &&
  6986. b.overrideMimeType("text/xml");
  6987. b.send(null);
  6988. return b.responseXML
  6989. });
  6990. if (this.keepData) this.data = b;
  6991. return b
  6992. },
  6993. write: function(a) {
  6994. if (a.xml) a = a.xml;
  6995. else {
  6996. var b = new XMLSerializer;
  6997. if (a.nodeType == 1) {
  6998. var c = document.implementation.createDocument("", "", null);
  6999. c.importNode && (a = c.importNode(a, !0));
  7000. c.appendChild(a);
  7001. a = b.serializeToString(c)
  7002. } else a = b.serializeToString(a)
  7003. }
  7004. return a
  7005. },
  7006. createElementNS: function(a, b) {
  7007. return this.xmldom ? typeof a == "string" ? this.xmldom.createNode(1, b, a) : this.xmldom.createNode(1, b, "") : document.createElementNS(a,
  7008. b)
  7009. },
  7010. createDocumentFragment: function() {
  7011. return this.xmldom ? this.xmldom.createDocumentFragment() : document.createDocumentFragment()
  7012. },
  7013. createTextNode: function(a) {
  7014. typeof a !== "string" && (a = String(a));
  7015. return this.xmldom ? this.xmldom.createTextNode(a) : document.createTextNode(a)
  7016. },
  7017. getElementsByTagNameNS: function(a, b, c) {
  7018. var d = [];
  7019. if (a.getElementsByTagNameNS) d = a.getElementsByTagNameNS(b, c);
  7020. else
  7021. for (var a = a.getElementsByTagName("*"), e, f, g = 0, h = a.length; g < h; ++g)
  7022. if (e = a[g], f = e.prefix ? e.prefix + ":" + c : c, c == "*" || f == e.nodeName)(b ==
  7023. "*" || b == e.namespaceURI) && d.push(e);
  7024. return d
  7025. },
  7026. getAttributeNodeNS: function(a, b, c) {
  7027. var d = null;
  7028. if (a.getAttributeNodeNS) d = a.getAttributeNodeNS(b, c);
  7029. else
  7030. for (var a = a.attributes, e, f, g = 0, h = a.length; g < h; ++g)
  7031. if (e = a[g], e.namespaceURI == b && (f = e.prefix ? e.prefix + ":" + c : c, f == e.nodeName)) {
  7032. d = e;
  7033. break
  7034. } return d
  7035. },
  7036. getAttributeNS: function(a, b, c) {
  7037. var d = "";
  7038. if (a.getAttributeNS) d = a.getAttributeNS(b, c) || "";
  7039. else if (a = this.getAttributeNodeNS(a, b, c)) d = a.nodeValue;
  7040. return d
  7041. },
  7042. getChildValue: function(a, b) {
  7043. var c = b || "";
  7044. if (a)
  7045. for (var d = a.firstChild; d; d =
  7046. d.nextSibling) switch (d.nodeType) {
  7047. case 3:
  7048. case 4:
  7049. c += d.nodeValue
  7050. }
  7051. return c
  7052. },
  7053. isSimpleContent: function(a) {
  7054. for (var b = !0, a = a.firstChild; a; a = a.nextSibling)
  7055. if (a.nodeType === 1) {
  7056. b = !1;
  7057. break
  7058. }
  7059. return b
  7060. },
  7061. contentType: function(a) {
  7062. for (var b = !1, c = !1, d = GeoGlobe.Format.XML.CONTENT_TYPE.EMPTY, a = a.firstChild; a; a = a.nextSibling) {
  7063. switch (a.nodeType) {
  7064. case 1:
  7065. c = !0;
  7066. break;
  7067. case 8:
  7068. break;
  7069. default:
  7070. b = !0
  7071. }
  7072. if (c && b) break
  7073. }
  7074. if (c && b) d = GeoGlobe.Format.XML.CONTENT_TYPE.MIXED;
  7075. else if (c) return GeoGlobe.Format.XML.CONTENT_TYPE.COMPLEX;
  7076. else if (b) return GeoGlobe.Format.XML.CONTENT_TYPE.SIMPLE;
  7077. return d
  7078. },
  7079. hasAttributeNS: function(a, b, c) {
  7080. var d = !1;
  7081. return d = a.hasAttributeNS ? a.hasAttributeNS(b, c) : !!this.getAttributeNodeNS(a, b, c)
  7082. },
  7083. setAttributeNS: function(a, b, c, d) {
  7084. if (a.setAttributeNS) a.setAttributeNS(b, c, d);
  7085. else if (this.xmldom) b ? (b = a.ownerDocument.createNode(2, c, b), b.nodeValue = d, a.setAttributeNode(b)) : a.setAttribute(c, d);
  7086. else throw "setAttributeNS not implemented";
  7087. },
  7088. createElementNSPlus: function(a, b) {
  7089. var b = b || {},
  7090. c = b.uri || this.namespaces[b.prefix];
  7091. c || (c = a.indexOf(":"), c = this.namespaces[a.substring(0,
  7092. c)]);
  7093. c || (c = this.namespaces[this.defaultPrefix]);
  7094. c = this.createElementNS(c, a);
  7095. b.attributes && this.setAttributes(c, b.attributes);
  7096. var d = b.value;
  7097. d != null && c.appendChild(this.createTextNode(d));
  7098. return c
  7099. },
  7100. setAttributes: function(a, b) {
  7101. var c, d, e;
  7102. for (e in b) b[e] != null && b[e].toString && (c = b[e].toString(), d = this.namespaces[e.substring(0, e.indexOf(":"))] || null, this.setAttributeNS(a, d, e, c))
  7103. },
  7104. readNode: function(a, b) {
  7105. b || (b = {});
  7106. var c = this.readers[a.namespaceURI ? this.namespaceAlias[a.namespaceURI] : this.defaultPrefix];
  7107. if (c) {
  7108. var d =
  7109. a.localName || a.nodeName.split(":").pop();
  7110. (c = c[d] || c["*"]) && c.apply(this, [a, b])
  7111. }
  7112. return b
  7113. },
  7114. readChildNodes: function(a, b) {
  7115. b || (b = {});
  7116. for (var c = a.childNodes, d, e = 0, f = c.length; e < f; ++e) d = c[e], d.nodeType == 1 && this.readNode(d, b);
  7117. return b
  7118. },
  7119. writeNode: function(a, b, c) {
  7120. var d, e = a.indexOf(":");
  7121. e > 0 ? (d = a.substring(0, e), a = a.substring(e + 1)) : d = c ? this.namespaceAlias[c.namespaceURI] : this.defaultPrefix;
  7122. b = this.writers[d][a].apply(this, [b]);
  7123. c && c.appendChild(b);
  7124. return b
  7125. },
  7126. getChildEl: function(a, b, c) {
  7127. return a && this.getThisOrNextEl(a.firstChild,
  7128. b, c)
  7129. },
  7130. getNextEl: function(a, b, c) {
  7131. return a && this.getThisOrNextEl(a.nextSibling, b, c)
  7132. },
  7133. getThisOrNextEl: function(a, b, c) {
  7134. a: for (; a; a = a.nextSibling) switch (a.nodeType) {
  7135. case 1:
  7136. if ((!b || b === (a.localName || a.nodeName.split(":").pop())) && (!c || c === a.namespaceURI)) break a;
  7137. a = null;
  7138. break a;
  7139. case 3:
  7140. if (/^\s*$/.test(a.nodeValue)) break;
  7141. case 4:
  7142. case 6:
  7143. case 12:
  7144. case 10:
  7145. case 11:
  7146. a = null;
  7147. break a
  7148. }
  7149. return a || null
  7150. },
  7151. lookupNamespaceURI: function(a, b) {
  7152. var c = null;
  7153. if (a)
  7154. if (a.lookupNamespaceURI) c = a.lookupNamespaceURI(b);
  7155. else a: switch (a.nodeType) {
  7156. case 1:
  7157. if (a.namespaceURI !==
  7158. null && a.prefix === b) {
  7159. c = a.namespaceURI;
  7160. break a
  7161. }
  7162. if (c = a.attributes.length)
  7163. for (var d, e = 0; e < c; ++e)
  7164. if (d = a.attributes[e], d.prefix === "xmlns" && d.name === "xmlns:" + b) {
  7165. c = d.value || null;
  7166. break a
  7167. } else if (d.name === "xmlns" && b === null) {
  7168. c = d.value || null;
  7169. break a
  7170. }
  7171. c = this.lookupNamespaceURI(a.parentNode, b);
  7172. break a;
  7173. case 2:
  7174. c = this.lookupNamespaceURI(a.ownerElement, b);
  7175. break a;
  7176. case 9:
  7177. c = this.lookupNamespaceURI(a.documentElement, b);
  7178. break a;
  7179. case 6:
  7180. case 12:
  7181. case 10:
  7182. case 11:
  7183. break a;
  7184. default:
  7185. c = this.lookupNamespaceURI(a.parentNode, b)
  7186. }
  7187. return c
  7188. },
  7189. getXMLDoc: function() {
  7190. if (!GeoGlobe.Format.XML.document && !this.xmldom)
  7191. if (document.implementation && document.implementation.createDocument) GeoGlobe.Format.XML.document = document.implementation.createDocument("", "", null);
  7192. else if (!this.xmldom && window.ActiveXObject) this.xmldom = new ActiveXObject("Microsoft.XMLDOM");
  7193. return GeoGlobe.Format.XML.document || this.xmldom
  7194. },
  7195. CLASS_NAME: "GeoGlobe.Format.XML"
  7196. });
  7197. GeoGlobe.Format.XML.CONTENT_TYPE = {
  7198. EMPTY: 0,
  7199. SIMPLE: 1,
  7200. COMPLEX: 2,
  7201. MIXED: 3
  7202. };
  7203. GeoGlobe.Format.XML.lookupNamespaceURI = GeoGlobe.Function.bind(GeoGlobe.Format.XML.prototype.lookupNamespaceURI, GeoGlobe.Format.XML.prototype);
  7204. GeoGlobe.Format.XML.document = null;
  7205. GeoGlobe.Format.XML.VersionedOGC = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  7206. defaultVersion: null,
  7207. version: null,
  7208. profile: null,
  7209. allowFallback: !1,
  7210. name: null,
  7211. stringifyOutput: !1,
  7212. parser: null,
  7213. initialize: function(a) {
  7214. GeoGlobe.Format.XML.prototype.initialize.apply(this, [a]);
  7215. a = this.CLASS_NAME;
  7216. this.name = a.substring(a.lastIndexOf(".") + 1)
  7217. },
  7218. getVersion: function(a, b) {
  7219. var c;
  7220. if (a) {
  7221. if (c = this.version, !c && (c = a.getAttribute("version"), !c)) c = this.defaultVersion
  7222. } else c = b && b.version || this.version || this.defaultVersion;
  7223. return c
  7224. },
  7225. getParser: function(a) {
  7226. var a =
  7227. a || this.defaultVersion,
  7228. b = this.profile ? "_" + this.profile : "";
  7229. if (!this.parser || this.parser.VERSION != a) {
  7230. var c = GeoGlobe.Format[this.name]["v" + a.replace(/\./g, "_") + b];
  7231. if (!c && (b !== "" && this.allowFallback && (b = "", c = GeoGlobe.Format[this.name]["v" + a.replace(/\./g, "_")]), !c)) throw "Can't find a " + this.name + " parser for version " + a + b;
  7232. this.parser = new c(this.options)
  7233. }
  7234. return this.parser
  7235. },
  7236. write: function(a, b) {
  7237. this.parser = this.getParser(this.getVersion(null, b));
  7238. var c = this.parser.write(a, b);
  7239. return this.stringifyOutput ===
  7240. !1 ? c : GeoGlobe.Format.XML.prototype.write.apply(this, [c])
  7241. },
  7242. read: function(a, b) {
  7243. typeof a == "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  7244. var c = this.getVersion(a.documentElement);
  7245. this.parser = this.getParser(c);
  7246. var d = this.parser.read(a, b),
  7247. e = this.parser.errorProperty || null;
  7248. if (e !== null && d[e] === void 0) e = new GeoGlobe.Format.OGCExceptionReport, d.error = e.read(a);
  7249. d.version = c;
  7250. return d
  7251. },
  7252. CLASS_NAME: "GeoGlobe.Format.XML.VersionedOGC"
  7253. });
  7254. GeoGlobe.Format.GML = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  7255. featureNS: "http://mapserver.gis.umn.edu/mapserver",
  7256. featurePrefix: "feature",
  7257. featureName: "featureMember",
  7258. layerName: "features",
  7259. geometryName: "geometry",
  7260. collectionName: "FeatureCollection",
  7261. gmlns: "http://www.opengis.net/gml",
  7262. extractAttributes: !0,
  7263. xy: !0,
  7264. initialize: function(a) {
  7265. this.regExes = {
  7266. trimSpace: /^\s*|\s*$/g,
  7267. removeSpace: /\s*/g,
  7268. splitSpace: /\s+/,
  7269. trimComma: /\s*,\s*/g
  7270. };
  7271. GeoGlobe.Format.XML.prototype.initialize.apply(this, [a])
  7272. },
  7273. read: function(a) {
  7274. typeof a ==
  7275. "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  7276. for (var a = this.getElementsByTagNameNS(a.documentElement, this.gmlns, this.featureName), b = [], c = 0; c < a.length; c++) {
  7277. var d = this.parseFeature(a[c]);
  7278. d && b.push(d)
  7279. }
  7280. return b
  7281. },
  7282. parseFeature: function(a) {
  7283. for (var b = ["MultiPolygon", "Polygon", "MultiLineString", "LineString", "MultiPoint", "Point", "Envelope"], c, d, e, f = 0; f < b.length; ++f)
  7284. if (c = b[f], d = this.getElementsByTagNameNS(a, this.gmlns, c), d.length > 0) {
  7285. if (e = this.parseGeometry[c.toLowerCase()]) e = e.apply(this, [d[0]]), this.internalProjection && this.externalProjection && e.transform(this.externalProjection, this.internalProjection);
  7286. else throw new TypeError("Unsupported geometry type: " + c);
  7287. break
  7288. }
  7289. var g;
  7290. c = this.getElementsByTagNameNS(a, this.gmlns, "Box");
  7291. for (f = 0; f < c.length; ++f) b = c[f], d = this.parseGeometry.box.apply(this, [b]), b = b.parentNode, (b.localName || b.nodeName.split(":").pop()) === "boundedBy" ? g = d : e = d.toGeometry();
  7292. var h;
  7293. this.extractAttributes && (h = this.parseAttributes(a));
  7294. h = new GeoGlobe.Feature(e, h);
  7295. h.bounds = g;
  7296. h.gml = {
  7297. featureType: a.firstChild.nodeName.split(":")[1],
  7298. featureNS: a.firstChild.namespaceURI,
  7299. featureNSPrefix: a.firstChild.prefix
  7300. };
  7301. for (var a = a.firstChild, j; a;) {
  7302. if (a.nodeType == 1 && (j = a.getAttribute("fid") || a.getAttribute("id"))) break;
  7303. a = a.nextSibling
  7304. }
  7305. h.fid = j;
  7306. return h
  7307. },
  7308. parseGeometry: {
  7309. point: function(a) {
  7310. var b, c;
  7311. c = [];
  7312. b = this.getElementsByTagNameNS(a, this.gmlns, "pos");
  7313. if (b.length > 0) c = b[0].firstChild.nodeValue, c = c.replace(this.regExes.trimSpace, ""), c = c.split(this.regExes.splitSpace);
  7314. if (c.length == 0 && (b = this.getElementsByTagNameNS(a,
  7315. this.gmlns, "coordinates"), b.length > 0)) c = b[0].firstChild.nodeValue, c = c.replace(this.regExes.removeSpace, ""), c = c.split(",");
  7316. c.length == 0 && (b = this.getElementsByTagNameNS(a, this.gmlns, "coord"), b.length > 0 && (a = this.getElementsByTagNameNS(b[0], this.gmlns, "X"), b = this.getElementsByTagNameNS(b[0], this.gmlns, "Y"), a.length > 0 && b.length > 0 && (c = [a[0].firstChild.nodeValue, b[0].firstChild.nodeValue])));
  7317. c.length == 2 && (c[2] = null);
  7318. return this.xy ? new GeoGlobe.Geometry.Point(c[0], c[1], c[2]) : new GeoGlobe.Geometry.Point(c[1],
  7319. c[0], c[2])
  7320. },
  7321. multipoint: function(a) {
  7322. var a = this.getElementsByTagNameNS(a, this.gmlns, "Point"),
  7323. b = [];
  7324. if (a.length > 0)
  7325. for (var c, d = 0; d < a.length; ++d)(c = this.parseGeometry.point.apply(this, [a[d]])) && b.push(c);
  7326. return new GeoGlobe.Geometry.MultiPoint(b)
  7327. },
  7328. linestring: function(a, b) {
  7329. var c, d;
  7330. d = [];
  7331. var e = [];
  7332. c = this.getElementsByTagNameNS(a, this.gmlns, "posList");
  7333. if (c.length > 0) {
  7334. d = this.getChildValue(c[0]);
  7335. d = d.replace(this.regExes.trimSpace, "");
  7336. d = d.split(this.regExes.splitSpace);
  7337. var f = parseInt(c[0].getAttribute("dimension")),
  7338. g, h, j;
  7339. for (c = 0; c < d.length / f; ++c) g = c * f, h = d[g], j = d[g + 1], g = f == 2 ? null : d[g + 2], this.xy ? e.push(new GeoGlobe.Geometry.Point(h, j, g)) : e.push(new GeoGlobe.Geometry.Point(j, h, g))
  7340. }
  7341. if (d.length == 0 && (c = this.getElementsByTagNameNS(a, this.gmlns, "coordinates"), c.length > 0)) {
  7342. d = this.getChildValue(c[0]);
  7343. d = d.replace(this.regExes.trimSpace, "");
  7344. d = d.replace(this.regExes.trimComma, ",");
  7345. f = d.split(this.regExes.splitSpace);
  7346. for (c = 0; c < f.length; ++c) d = f[c].split(","), d.length == 2 && (d[2] = null), this.xy ? e.push(new GeoGlobe.Geometry.Point(d[0],
  7347. d[1], d[2])) : e.push(new GeoGlobe.Geometry.Point(d[1], d[0], d[2]))
  7348. }
  7349. d = null;
  7350. e.length != 0 && (d = b ? new GeoGlobe.Geometry.LinearRing(e) : new GeoGlobe.Geometry.LineString(e));
  7351. return d
  7352. },
  7353. multilinestring: function(a) {
  7354. var a = this.getElementsByTagNameNS(a, this.gmlns, "LineString"),
  7355. b = [];
  7356. if (a.length > 0)
  7357. for (var c, d = 0; d < a.length; ++d)(c = this.parseGeometry.linestring.apply(this, [a[d]])) && b.push(c);
  7358. return new GeoGlobe.Geometry.MultiLineString(b)
  7359. },
  7360. polygon: function(a) {
  7361. var a = this.getElementsByTagNameNS(a, this.gmlns, "LinearRing"),
  7362. b = [];
  7363. if (a.length > 0)
  7364. for (var c, d = 0; d < a.length; ++d)(c = this.parseGeometry.linestring.apply(this, [a[d], !0])) && b.push(c);
  7365. return new GeoGlobe.Geometry.Polygon(b)
  7366. },
  7367. multipolygon: function(a) {
  7368. var a = this.getElementsByTagNameNS(a, this.gmlns, "Polygon"),
  7369. b = [];
  7370. if (a.length > 0)
  7371. for (var c, d = 0; d < a.length; ++d)(c = this.parseGeometry.polygon.apply(this, [a[d]])) && b.push(c);
  7372. return new GeoGlobe.Geometry.MultiPolygon(b)
  7373. },
  7374. envelope: function(a) {
  7375. var b = [],
  7376. c, d, e = this.getElementsByTagNameNS(a, this.gmlns, "lowerCorner");
  7377. if (e.length > 0) {
  7378. c = [];
  7379. if (e.length > 0) c = e[0].firstChild.nodeValue, c = c.replace(this.regExes.trimSpace, ""), c = c.split(this.regExes.splitSpace);
  7380. c.length == 2 && (c[2] = null);
  7381. var f = this.xy ? new GeoGlobe.Geometry.Point(c[0], c[1], c[2]) : new GeoGlobe.Geometry.Point(c[1], c[0], c[2])
  7382. }
  7383. a = this.getElementsByTagNameNS(a, this.gmlns, "upperCorner");
  7384. if (a.length > 0) {
  7385. c = [];
  7386. if (a.length > 0) c = a[0].firstChild.nodeValue, c = c.replace(this.regExes.trimSpace, ""), c = c.split(this.regExes.splitSpace);
  7387. c.length == 2 && (c[2] = null);
  7388. var g = this.xy ? new GeoGlobe.Geometry.Point(c[0],
  7389. c[1], c[2]) : new GeoGlobe.Geometry.Point(c[1], c[0], c[2])
  7390. }
  7391. f && g && (b.push(new GeoGlobe.Geometry.Point(f.x, f.y)), b.push(new GeoGlobe.Geometry.Point(g.x, f.y)), b.push(new GeoGlobe.Geometry.Point(g.x, g.y)), b.push(new GeoGlobe.Geometry.Point(f.x, g.y)), b.push(new GeoGlobe.Geometry.Point(f.x, f.y)), b = new GeoGlobe.Geometry.LinearRing(b), d = new GeoGlobe.Geometry.Polygon([b]));
  7392. return d
  7393. },
  7394. box: function(a) {
  7395. var b = this.getElementsByTagNameNS(a, this.gmlns, "coordinates"),
  7396. c = null,
  7397. a = null;
  7398. if (b.length > 0) b = b[0].firstChild.nodeValue,
  7399. b = b.split(" "), b.length == 2 && (c = b[0].split(","), a = b[1].split(","));
  7400. if (c !== null && a !== null) return c = new GeoGlobe.LngLat(parseFloat(c[0]), parseFloat(c[1])), a = new GeoGlobe.LngLat(parseFloat(a[0]), parseFloat(a[1])), new GeoGlobe.LngLatBounds(c, a)
  7401. }
  7402. },
  7403. parseAttributes: function(a) {
  7404. for (var b = {}, a = a.firstChild, c, d, e; a;) {
  7405. if (a.nodeType == 1) {
  7406. a = a.childNodes;
  7407. for (c = 0; c < a.length; ++c)
  7408. if (d = a[c], d.nodeType == 1)
  7409. if (e = d.childNodes, e.length == 1) {
  7410. if (e = e[0], e.nodeType == 3 || e.nodeType == 4) d = d.prefix ? d.nodeName.split(":")[1] : d.nodeName,
  7411. e = e.nodeValue.replace(this.regExes.trimSpace, ""), b[d] = e
  7412. } else b[d.nodeName.split(":").pop()] = null;
  7413. break
  7414. }
  7415. a = a.nextSibling
  7416. }
  7417. return b
  7418. },
  7419. write: function(a) {
  7420. GeoGlobe.Util.isArray(a) || (a = [a]);
  7421. for (var b = this.createElementNS("http://www.opengis.net/wfs", "wfs:" + this.collectionName), c = 0; c < a.length; c++) b.appendChild(this.createFeatureXML(a[c]));
  7422. return GeoGlobe.Format.XML.prototype.write.apply(this, [b])
  7423. },
  7424. createFeatureXML: function(a) {
  7425. var b = this.buildGeometryNode(a.geometry),
  7426. c = this.createElementNS(this.featureNS, this.featurePrefix +
  7427. ":" + this.geometryName);
  7428. c.appendChild(b);
  7429. var b = this.createElementNS(this.gmlns, "gml:" + this.featureName),
  7430. d = this.createElementNS(this.featureNS, this.featurePrefix + ":" + this.layerName);
  7431. d.setAttribute("fid", a.fid || a.id);
  7432. d.appendChild(c);
  7433. for (var e in a.attributes) {
  7434. var c = this.createTextNode(a.attributes[e]),
  7435. f = this.createElementNS(this.featureNS, this.featurePrefix + ":" + e.substring(e.lastIndexOf(":") + 1));
  7436. f.appendChild(c);
  7437. d.appendChild(f)
  7438. }
  7439. b.appendChild(d);
  7440. return b
  7441. },
  7442. buildGeometryNode: function(a) {
  7443. this.externalProjection &&
  7444. this.internalProjection && (a = a.clone(), a.transform(this.internalProjection, this.externalProjection));
  7445. var b = a.CLASS_NAME;
  7446. return this.buildGeometry[b.substring(b.lastIndexOf(".") + 1).toLowerCase()].apply(this, [a])
  7447. },
  7448. buildGeometry: {
  7449. point: function(a) {
  7450. var b = this.createElementNS(this.gmlns, "gml:Point");
  7451. b.appendChild(this.buildCoordinatesNode(a));
  7452. return b
  7453. },
  7454. multipoint: function(a) {
  7455. for (var b = this.createElementNS(this.gmlns, "gml:MultiPoint"), a = a.components, c, d, e = 0; e < a.length; e++) c = this.createElementNS(this.gmlns,
  7456. "gml:pointMember"), d = this.buildGeometry.point.apply(this, [a[e]]), c.appendChild(d), b.appendChild(c);
  7457. return b
  7458. },
  7459. linestring: function(a) {
  7460. var b = this.createElementNS(this.gmlns, "gml:LineString");
  7461. b.appendChild(this.buildCoordinatesNode(a));
  7462. return b
  7463. },
  7464. multilinestring: function(a) {
  7465. for (var b = this.createElementNS(this.gmlns, "gml:MultiLineString"), a = a.components, c, d, e = 0; e < a.length; ++e) c = this.createElementNS(this.gmlns, "gml:lineStringMember"), d = this.buildGeometry.linestring.apply(this, [a[e]]), c.appendChild(d), b.appendChild(c);
  7466. return b
  7467. },
  7468. linearring: function(a) {
  7469. var b = this.createElementNS(this.gmlns, "gml:LinearRing");
  7470. b.appendChild(this.buildCoordinatesNode(a));
  7471. return b
  7472. },
  7473. polygon: function(a) {
  7474. for (var b = this.createElementNS(this.gmlns, "gml:Polygon"), a = a.components, c, d, e = 0; e < a.length; ++e) c = e == 0 ? "outerBoundaryIs" : "innerBoundaryIs", c = this.createElementNS(this.gmlns, "gml:" + c), d = this.buildGeometry.linearring.apply(this, [a[e]]), c.appendChild(d), b.appendChild(c);
  7475. return b
  7476. },
  7477. multipolygon: function(a) {
  7478. for (var b = this.createElementNS(this.gmlns,
  7479. "gml:MultiPolygon"), a = a.components, c, d, e = 0; e < a.length; ++e) c = this.createElementNS(this.gmlns, "gml:polygonMember"), d = this.buildGeometry.polygon.apply(this, [a[e]]), c.appendChild(d), b.appendChild(c);
  7480. return b
  7481. },
  7482. lnglatbounds: function(a) {
  7483. var b = this.createElementNS(this.gmlns, "gml:Box");
  7484. b.appendChild(this.buildCoordinatesNode(a));
  7485. return b
  7486. }
  7487. },
  7488. buildCoordinatesNode: function(a) {
  7489. var b = this.createElementNS(this.gmlns, "gml:coordinates");
  7490. b.setAttribute("decimal", ".");
  7491. b.setAttribute("cs", ",");
  7492. b.setAttribute("ts", " ");
  7493. var c = [];
  7494. if (a instanceof mapboxgl.LngLatBounds) c.push(a.getWest() + "," + a.getSouth()), c.push(a.getEast() + "," + a.getNorth());
  7495. else
  7496. for (var a = a.components ? a.components : [a], d = 0; d < a.length; d++) c.push(a[d].x + "," + a[d].y);
  7497. c = this.createTextNode(c.join(" "));
  7498. b.appendChild(c);
  7499. return b
  7500. },
  7501. CLASS_NAME: "GeoGlobe.Format.GML"
  7502. });
  7503. if (!GeoGlobe.Format.GML) GeoGlobe.Format.GML = {};
  7504. GeoGlobe.Format.GML.Base = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  7505. namespaces: {
  7506. gml: "http://www.opengis.net/gml",
  7507. xlink: "http://www.w3.org/1999/xlink",
  7508. xsi: "http://www.w3.org/2001/XMLSchema-instance",
  7509. wfs: "http://www.opengis.net/wfs"
  7510. },
  7511. defaultPrefix: "gml",
  7512. schemaLocation: null,
  7513. featureType: null,
  7514. featureNS: null,
  7515. geometryName: "geometry",
  7516. extractAttributes: !0,
  7517. srsName: null,
  7518. xy: !0,
  7519. geometryTypes: null,
  7520. singleFeatureType: null,
  7521. regExes: {
  7522. trimSpace: /^\s*|\s*$/g,
  7523. removeSpace: /\s*/g,
  7524. splitSpace: /\s+/,
  7525. trimComma: /\s*,\s*/g,
  7526. featureMember: /^(.*:)?featureMembers?$/
  7527. },
  7528. initialize: function(a) {
  7529. GeoGlobe.Format.XML.prototype.initialize.apply(this, [a]);
  7530. this.setGeometryTypes();
  7531. a && a.featureNS && this.setNamespace("feature", a.featureNS);
  7532. this.singleFeatureType = !a || typeof a.featureType === "string"
  7533. },
  7534. read: function(a) {
  7535. typeof a == "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  7536. if (a && a.nodeType == 9) a = a.documentElement;
  7537. var b = [];
  7538. this.readNode(a, {
  7539. features: b
  7540. }, !0);
  7541. if (b.length == 0) {
  7542. var c = this.getElementsByTagNameNS(a, this.namespaces.gml, "featureMember");
  7543. if (c.length)
  7544. for (var a =
  7545. 0, d = c.length; a < d; ++a) this.readNode(c[a], {
  7546. features: b
  7547. }, !0);
  7548. else c = this.getElementsByTagNameNS(a, this.namespaces.gml, "featureMembers"), c.length && this.readNode(c[0], {
  7549. features: b
  7550. }, !0)
  7551. }
  7552. return b
  7553. },
  7554. readNode: function(a, b, c) {
  7555. if (c === !0 && this.autoConfig === !0) this.featureType = null, delete this.namespaceAlias[this.featureNS], delete this.namespaces.feature, this.featureNS = null;
  7556. if (!this.featureNS && !(a.prefix in this.namespaces) && a.parentNode.namespaceURI == this.namespaces.gml && this.regExes.featureMember.test(a.parentNode.nodeName)) this.featureType =
  7557. a.nodeName.split(":").pop(), this.setNamespace("feature", a.namespaceURI), this.featureNS = a.namespaceURI, this.autoConfig = !0;
  7558. return GeoGlobe.Format.XML.prototype.readNode.apply(this, [a, b])
  7559. },
  7560. readers: {
  7561. gml: {
  7562. _inherit: function() {},
  7563. featureMember: function(a, b) {
  7564. this.readChildNodes(a, b)
  7565. },
  7566. featureMembers: function(a, b) {
  7567. this.readChildNodes(a, b)
  7568. },
  7569. name: function(a, b) {
  7570. b.name = this.getChildValue(a)
  7571. },
  7572. boundedBy: function(a, b) {
  7573. var c = {};
  7574. this.readChildNodes(a, c);
  7575. if (c.components && c.components.length > 0) b.bounds = c.components[0]
  7576. },
  7577. Point: function(a, b) {
  7578. var c = {
  7579. points: []
  7580. };
  7581. this.readChildNodes(a, c);
  7582. if (!b.components) b.components = [];
  7583. b.components.push(c.points[0])
  7584. },
  7585. coordinates: function(a, b) {
  7586. for (var c = this.getChildValue(a).replace(this.regExes.trimSpace, ""), c = c.replace(this.regExes.trimComma, ","), c = c.split(this.regExes.splitSpace), d, e = c.length, f = Array(e), g = 0; g < e; ++g) d = c[g].split(","), f[g] = this.xy ? new GeoGlobe.Geometry.Point(d[0], d[1], d[2]) : new GeoGlobe.Geometry.Point(d[1], d[0], d[2]);
  7587. b.points = f
  7588. },
  7589. coord: function(a, b) {
  7590. var c = {};
  7591. this.readChildNodes(a,
  7592. c);
  7593. if (!b.points) b.points = [];
  7594. b.points.push(new GeoGlobe.Geometry.Point(c.x, c.y, c.z))
  7595. },
  7596. X: function(a, b) {
  7597. b.x = this.getChildValue(a)
  7598. },
  7599. Y: function(a, b) {
  7600. b.y = this.getChildValue(a)
  7601. },
  7602. Z: function(a, b) {
  7603. b.z = this.getChildValue(a)
  7604. },
  7605. MultiPoint: function(a, b) {
  7606. var c = {
  7607. components: []
  7608. };
  7609. this.readers.gml._inherit.apply(this, [a, c, b]);
  7610. this.readChildNodes(a, c);
  7611. b.components = [new GeoGlobe.Geometry.MultiPoint(c.components)]
  7612. },
  7613. pointMember: function(a, b) {
  7614. this.readChildNodes(a, b)
  7615. },
  7616. LineString: function(a, b) {
  7617. var c = {};
  7618. this.readers.gml._inherit.apply(this, [a, c, b]);
  7619. this.readChildNodes(a, c);
  7620. if (!b.components) b.components = [];
  7621. b.components.push(new GeoGlobe.Geometry.LineString(c.points))
  7622. },
  7623. MultiLineString: function(a, b) {
  7624. var c = {
  7625. components: []
  7626. };
  7627. this.readers.gml._inherit.apply(this, [a, c, b]);
  7628. this.readChildNodes(a, c);
  7629. b.components = [new GeoGlobe.Geometry.MultiLineString(c.components)]
  7630. },
  7631. lineStringMember: function(a, b) {
  7632. this.readChildNodes(a, b)
  7633. },
  7634. Polygon: function(a, b) {
  7635. var c = {
  7636. outer: null,
  7637. inner: []
  7638. };
  7639. this.readers.gml._inherit.apply(this, [a, c, b]);
  7640. this.readChildNodes(a, c);
  7641. c.inner.unshift(c.outer);
  7642. if (!b.components) b.components = [];
  7643. b.components.push(new GeoGlobe.Geometry.Polygon(c.inner))
  7644. },
  7645. LinearRing: function(a, b) {
  7646. var c = {};
  7647. this.readers.gml._inherit.apply(this, [a, c]);
  7648. this.readChildNodes(a, c);
  7649. b.components = [new GeoGlobe.Geometry.LinearRing(c.points)]
  7650. },
  7651. MultiPolygon: function(a, b) {
  7652. var c = {
  7653. components: []
  7654. };
  7655. this.readers.gml._inherit.apply(this, [a, c, b]);
  7656. this.readChildNodes(a, c);
  7657. b.components = [new GeoGlobe.Geometry.MultiPolygon(c.components)]
  7658. },
  7659. polygonMember: function(a, b) {
  7660. this.readChildNodes(a, b)
  7661. },
  7662. GeometryCollection: function(a,
  7663. b) {
  7664. var c = {
  7665. components: []
  7666. };
  7667. this.readers.gml._inherit.apply(this, [a, c, b]);
  7668. this.readChildNodes(a, c);
  7669. b.components = [new GeoGlobe.Geometry.Collection(c.components)]
  7670. },
  7671. geometryMember: function(a, b) {
  7672. this.readChildNodes(a, b)
  7673. }
  7674. },
  7675. feature: {
  7676. "*": function(a, b) {
  7677. var c, d = a.localName || a.nodeName.split(":").pop();
  7678. if (b.features)
  7679. if (!this.singleFeatureType && GeoGlobe.Util.indexOf(this.featureType, d) !== -1) c = "_typeName";
  7680. else if (d === this.featureType) c = "_typeName";
  7681. else {
  7682. if (GeoGlobe.Util.isArray(this.featureType_))
  7683. for (var e = 0; e < this.featureType_.length; e++)
  7684. if (this.featureType_[e] ===
  7685. d) {
  7686. c = "_typeName";
  7687. break
  7688. }
  7689. } else a.childNodes.length == 0 || a.childNodes.length == 1 && a.firstChild.nodeType == 3 ? this.extractAttributes && (c = "_attribute") : c = "_geometry";
  7690. c && this.readers.feature[c].apply(this, [a, b])
  7691. },
  7692. _typeName: function(a, b) {
  7693. var c = {
  7694. components: [],
  7695. attributes: {}
  7696. };
  7697. this.readChildNodes(a, c);
  7698. if (c.name) c.attributes.name = c.name;
  7699. var d = new GeoGlobe.Feature(c.components[0], c.attributes);
  7700. if (!this.singleFeatureType) d.type = a.nodeName.split(":").pop(), d.namespace = a.namespaceURI;
  7701. var e = a.getAttribute("fid") || this.getAttributeNS(a,
  7702. this.namespaces.gml, "id");
  7703. if (e) d.fid = e;
  7704. this.internalProjection && this.externalProjection && d.geometry && d.geometry.transform(this.externalProjection, this.internalProjection);
  7705. if (c.bounds) d.bounds = c.bounds;
  7706. b.features.push(d)
  7707. },
  7708. _geometry: function(a, b) {
  7709. if (!this.geometryName) this.geometryName = a.nodeName.split(":").pop();
  7710. this.readChildNodes(a, b)
  7711. },
  7712. _attribute: function(a, b) {
  7713. var c = a.localName || a.nodeName.split(":").pop(),
  7714. d = this.getChildValue(a);
  7715. b.attributes[c] = d
  7716. }
  7717. },
  7718. wfs: {
  7719. FeatureCollection: function(a, b) {
  7720. this.readChildNodes(a,
  7721. b)
  7722. }
  7723. }
  7724. },
  7725. write: function(a) {
  7726. a = this.writeNode("gml:" + (GeoGlobe.Util.isArray(a) ? "featureMembers" : "featureMember"), a);
  7727. this.setAttributeNS(a, this.namespaces.xsi, "xsi:schemaLocation", this.schemaLocation);
  7728. return GeoGlobe.Format.XML.prototype.write.apply(this, [a])
  7729. },
  7730. writers: {
  7731. gml: {
  7732. featureMember: function(a) {
  7733. var b = this.createElementNSPlus("gml:featureMember");
  7734. this.writeNode("feature:_typeName", a, b);
  7735. return b
  7736. },
  7737. MultiPoint: function(a) {
  7738. for (var b = this.createElementNSPlus("gml:MultiPoint"), a = a.components || [a], c = 0, d = a.length; c <
  7739. d; ++c) this.writeNode("pointMember", a[c], b);
  7740. return b
  7741. },
  7742. pointMember: function(a) {
  7743. var b = this.createElementNSPlus("gml:pointMember");
  7744. this.writeNode("Point", a, b);
  7745. return b
  7746. },
  7747. MultiLineString: function(a) {
  7748. for (var b = this.createElementNSPlus("gml:MultiLineString"), a = a.components || [a], c = 0, d = a.length; c < d; ++c) this.writeNode("lineStringMember", a[c], b);
  7749. return b
  7750. },
  7751. lineStringMember: function(a) {
  7752. var b = this.createElementNSPlus("gml:lineStringMember");
  7753. this.writeNode("LineString", a, b);
  7754. return b
  7755. },
  7756. MultiPolygon: function(a) {
  7757. for (var b =
  7758. this.createElementNSPlus("gml:MultiPolygon"), a = a.components || [a], c = 0, d = a.length; c < d; ++c) this.writeNode("polygonMember", a[c], b);
  7759. return b
  7760. },
  7761. polygonMember: function(a) {
  7762. var b = this.createElementNSPlus("gml:polygonMember");
  7763. this.writeNode("Polygon", a, b);
  7764. return b
  7765. },
  7766. GeometryCollection: function(a) {
  7767. for (var b = this.createElementNSPlus("gml:GeometryCollection"), c = 0, d = a.components.length; c < d; ++c) this.writeNode("geometryMember", a.components[c], b);
  7768. return b
  7769. },
  7770. geometryMember: function(a) {
  7771. var b = this.createElementNSPlus("gml:geometryMember"),
  7772. a = this.writeNode("feature:_geometry", a);
  7773. b.appendChild(a.firstChild);
  7774. return b
  7775. }
  7776. },
  7777. feature: {
  7778. _typeName: function(a) {
  7779. var b = this.createElementNSPlus("feature:" + this.featureType, {
  7780. attributes: {
  7781. fid: a.fid
  7782. }
  7783. });
  7784. a.geometry && this.writeNode("feature:_geometry", a.geometry, b);
  7785. for (var c in a.attributes) {
  7786. var d = a.attributes[c];
  7787. d != null && this.writeNode("feature:_attribute", {
  7788. name: c,
  7789. value: d
  7790. }, b)
  7791. }
  7792. return b
  7793. },
  7794. _geometry: function(a) {
  7795. this.externalProjection && this.internalProjection && (a = a.clone().transform(this.internalProjection, this.externalProjection));
  7796. var b = this.createElementNSPlus("feature:" + this.geometryName),
  7797. a = this.writeNode("gml:" + this.geometryTypes[a.CLASS_NAME], a, b);
  7798. this.srsName && a.setAttribute("srsName", this.srsName);
  7799. return b
  7800. },
  7801. _attribute: function(a) {
  7802. return this.createElementNSPlus("feature:" + a.name, {
  7803. value: a.value
  7804. })
  7805. }
  7806. },
  7807. wfs: {
  7808. FeatureCollection: function(a) {
  7809. for (var b = this.createElementNSPlus("wfs:FeatureCollection"), c = 0, d = a.length; c < d; ++c) this.writeNode("gml:featureMember", a[c], b);
  7810. return b
  7811. }
  7812. }
  7813. },
  7814. setGeometryTypes: function() {
  7815. this.geometryTypes = {
  7816. "GeoGlobe.Geometry.Point": "Point",
  7817. "GeoGlobe.Geometry.MultiPoint": "MultiPoint",
  7818. "GeoGlobe.Geometry.LineString": "LineString",
  7819. "GeoGlobe.Geometry.MultiLineString": "MultiLineString",
  7820. "GeoGlobe.Geometry.Polygon": "Polygon",
  7821. "GeoGlobe.Geometry.MultiPolygon": "MultiPolygon",
  7822. "GeoGlobe.Geometry.Collection": "GeometryCollection"
  7823. }
  7824. },
  7825. setFeatureType_: function(a) {
  7826. this.featureType_ = a
  7827. },
  7828. CLASS_NAME: "GeoGlobe.Format.GML.Base"
  7829. });
  7830. GeoGlobe.Format.GML.v2 = GeoGlobe.Class4OL(GeoGlobe.Format.GML.Base, {
  7831. schemaLocation: "http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",
  7832. initialize: function(a) {
  7833. GeoGlobe.Format.GML.Base.prototype.initialize.apply(this, [a])
  7834. },
  7835. readers: {
  7836. gml: GeoGlobe.Util.applyDefaults({
  7837. outerBoundaryIs: function(a, b) {
  7838. var c = {};
  7839. this.readChildNodes(a, c);
  7840. b.outer = c.components[0]
  7841. },
  7842. innerBoundaryIs: function(a, b) {
  7843. var c = {};
  7844. this.readChildNodes(a, c);
  7845. b.inner.push(c.components[0])
  7846. },
  7847. Box: function(a, b) {
  7848. var c = {};
  7849. this.readChildNodes(a,
  7850. c);
  7851. if (!b.components) b.components = [];
  7852. var d = c.points[0],
  7853. c = c.points[1],
  7854. d = new GeoGlobe.LngLat(d.x, d.y),
  7855. c = new GeoGlobe.LngLat(c.x, c.y);
  7856. b.components.push(new GeoGlobe.LngLatBounds(d, c))
  7857. }
  7858. }, GeoGlobe.Format.GML.Base.prototype.readers.gml),
  7859. feature: GeoGlobe.Format.GML.Base.prototype.readers.feature,
  7860. wfs: GeoGlobe.Format.GML.Base.prototype.readers.wfs
  7861. },
  7862. write: function(a) {
  7863. a = this.writeNode(GeoGlobe.Util.isArray(a) ? "wfs:FeatureCollection" : "gml:featureMember", a);
  7864. this.setAttributeNS(a, this.namespaces.xsi, "xsi:schemaLocation",
  7865. this.schemaLocation);
  7866. return GeoGlobe.Format.XML.prototype.write.apply(this, [a])
  7867. },
  7868. writers: {
  7869. gml: GeoGlobe.Util.applyDefaults({
  7870. Point: function(a) {
  7871. var b = this.createElementNSPlus("gml:Point");
  7872. this.writeNode("coordinates", [a], b);
  7873. return b
  7874. },
  7875. coordinates: function(a) {
  7876. for (var b = a.length, c = Array(b), d, e = 0; e < b; ++e) d = a[e], c[e] = this.xy ? d.x + "," + d.y : d.y + "," + d.x, d.z != void 0 && (c[e] += "," + d.z);
  7877. return this.createElementNSPlus("gml:coordinates", {
  7878. attributes: {
  7879. decimal: ".",
  7880. cs: ",",
  7881. ts: " "
  7882. },
  7883. value: b == 1 ? c[0] : c.join(" ")
  7884. })
  7885. },
  7886. LineString: function(a) {
  7887. var b =
  7888. this.createElementNSPlus("gml:LineString");
  7889. this.writeNode("coordinates", a.components, b);
  7890. return b
  7891. },
  7892. Polygon: function(a) {
  7893. var b = this.createElementNSPlus("gml:Polygon");
  7894. this.writeNode("outerBoundaryIs", a.components[0], b);
  7895. for (var c = 1; c < a.components.length; ++c) this.writeNode("innerBoundaryIs", a.components[c], b);
  7896. return b
  7897. },
  7898. outerBoundaryIs: function(a) {
  7899. var b = this.createElementNSPlus("gml:outerBoundaryIs");
  7900. this.writeNode("LinearRing", a, b);
  7901. return b
  7902. },
  7903. innerBoundaryIs: function(a) {
  7904. var b = this.createElementNSPlus("gml:innerBoundaryIs");
  7905. this.writeNode("LinearRing", a, b);
  7906. return b
  7907. },
  7908. LinearRing: function(a) {
  7909. var b = this.createElementNSPlus("gml:LinearRing");
  7910. this.writeNode("coordinates", a.components, b);
  7911. return b
  7912. },
  7913. Box: function(a) {
  7914. var b = this.createElementNSPlus("gml:Box");
  7915. this.writeNode("coordinates", [{
  7916. x: a._sw.lng,
  7917. y: a._sw.lat
  7918. }, {
  7919. x: a._ne.lng,
  7920. y: a._ne.lat
  7921. }], b);
  7922. this.srsName && b.setAttribute("srsName", this.srsName);
  7923. return b
  7924. }
  7925. }, GeoGlobe.Format.GML.Base.prototype.writers.gml),
  7926. feature: GeoGlobe.Format.GML.Base.prototype.writers.feature,
  7927. wfs: GeoGlobe.Format.GML.Base.prototype.writers.wfs
  7928. },
  7929. CLASS_NAME: "GeoGlobe.Format.GML.v2"
  7930. });
  7931. GeoGlobe.Format.GML.v3 = GeoGlobe.Class4OL(GeoGlobe.Format.GML.Base, {
  7932. schemaLocation: "http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",
  7933. curve: !1,
  7934. multiCurve: !0,
  7935. surface: !1,
  7936. multiSurface: !0,
  7937. initialize: function(a) {
  7938. GeoGlobe.Format.GML.Base.prototype.initialize.apply(this, [a])
  7939. },
  7940. readers: {
  7941. gml: GeoGlobe.Util.applyDefaults({
  7942. _inherit: function(a, b, c) {
  7943. if (a = parseInt(a.getAttribute("srsDimension"), 10) || c && c.srsDimension) b.srsDimension = a
  7944. },
  7945. featureMembers: function(a,
  7946. b) {
  7947. this.readChildNodes(a, b)
  7948. },
  7949. Curve: function(a, b) {
  7950. var c = {
  7951. points: []
  7952. };
  7953. this.readers.gml._inherit.apply(this, [a, c, b]);
  7954. this.readChildNodes(a, c);
  7955. if (!b.components) b.components = [];
  7956. b.components.push(new GeoGlobe.Geometry.LineString(c.points))
  7957. },
  7958. segments: function(a, b) {
  7959. this.readChildNodes(a, b)
  7960. },
  7961. LineStringSegment: function(a, b) {
  7962. var c = {};
  7963. this.readChildNodes(a, c);
  7964. c.points && Array.prototype.push.apply(b.points, c.points)
  7965. },
  7966. pos: function(a, b) {
  7967. var c = this.getChildValue(a).replace(this.regExes.trimSpace, "").split(this.regExes.splitSpace),
  7968. c = this.xy ? new GeoGlobe.Geometry.Point(c[0], c[1], c[2]) : new GeoGlobe.Geometry.Point(c[1], c[0], c[2]);
  7969. b.points = [c]
  7970. },
  7971. posList: function(a, b) {
  7972. for (var c = this.getChildValue(a).replace(this.regExes.trimSpace, "").split(this.regExes.splitSpace), d = b.srsDimension || parseInt(a.getAttribute("srsDimension") || a.getAttribute("dimension"), 10) || 2, e, f, g, h = Array(c.length / d), j = 0, l = c.length; j < l; j += d) e = c[j], f = c[j + 1], g = d == 2 ? void 0 : c[j + 2], h[j / d] = this.xy ? new GeoGlobe.Geometry.Point(e, f, g) : new GeoGlobe.Geometry.Point(f, e, g);
  7973. b.points =
  7974. h
  7975. },
  7976. Surface: function(a, b) {
  7977. this.readChildNodes(a, b)
  7978. },
  7979. patches: function(a, b) {
  7980. this.readChildNodes(a, b)
  7981. },
  7982. PolygonPatch: function(a, b) {
  7983. this.readers.gml.Polygon.apply(this, [a, b])
  7984. },
  7985. exterior: function(a, b) {
  7986. var c = {};
  7987. this.readChildNodes(a, c);
  7988. b.outer = c.components[0]
  7989. },
  7990. interior: function(a, b) {
  7991. var c = {};
  7992. this.readChildNodes(a, c);
  7993. b.inner.push(c.components[0])
  7994. },
  7995. MultiCurve: function(a, b) {
  7996. var c = {
  7997. components: []
  7998. };
  7999. this.readers.gml._inherit.apply(this, [a, c, b]);
  8000. this.readChildNodes(a, c);
  8001. if (c.components.length > 0) b.components = [new GeoGlobe.Geometry.MultiLineString(c.components)]
  8002. },
  8003. curveMember: function(a, b) {
  8004. this.readChildNodes(a, b)
  8005. },
  8006. MultiSurface: function(a, b) {
  8007. var c = {
  8008. components: []
  8009. };
  8010. this.readers.gml._inherit.apply(this, [a, c, b]);
  8011. this.readChildNodes(a, c);
  8012. if (c.components.length > 0) b.components = [new GeoGlobe.Geometry.MultiPolygon(c.components)]
  8013. },
  8014. surfaceMember: function(a, b) {
  8015. this.readChildNodes(a, b)
  8016. },
  8017. surfaceMembers: function(a, b) {
  8018. this.readChildNodes(a, b)
  8019. },
  8020. pointMembers: function(a, b) {
  8021. this.readChildNodes(a, b)
  8022. },
  8023. lineStringMembers: function(a, b) {
  8024. this.readChildNodes(a, b)
  8025. },
  8026. polygonMembers: function(a,
  8027. b) {
  8028. this.readChildNodes(a, b)
  8029. },
  8030. geometryMembers: function(a, b) {
  8031. this.readChildNodes(a, b)
  8032. },
  8033. Envelope: function(a, b) {
  8034. var c = {
  8035. points: Array(2)
  8036. };
  8037. this.readChildNodes(a, c);
  8038. if (!b.components) b.components = [];
  8039. var d = c.points[0],
  8040. c = c.points[1],
  8041. d = new GeoGlobe.LngLat(d.x, d.y),
  8042. c = new GeoGlobe.LngLat(c.x, c.y);
  8043. b.components.push(new GeoGlobe.LngLatBounds(d, c))
  8044. },
  8045. lowerCorner: function(a, b) {
  8046. var c = {};
  8047. this.readers.gml.pos.apply(this, [a, c]);
  8048. b.points[0] = c.points[0]
  8049. },
  8050. upperCorner: function(a, b) {
  8051. var c = {};
  8052. this.readers.gml.pos.apply(this, [a, c]);
  8053. b.points[1] = c.points[0]
  8054. }
  8055. }, GeoGlobe.Format.GML.Base.prototype.readers.gml),
  8056. feature: GeoGlobe.Format.GML.Base.prototype.readers.feature,
  8057. wfs: GeoGlobe.Format.GML.Base.prototype.readers.wfs
  8058. },
  8059. write: function(a) {
  8060. a = this.writeNode("gml:" + (GeoGlobe.Util.isArray(a) ? "featureMembers" : "featureMember"), a);
  8061. this.setAttributeNS(a, this.namespaces.xsi, "xsi:schemaLocation", this.schemaLocation);
  8062. return GeoGlobe.Format.XML.prototype.write.apply(this, [a])
  8063. },
  8064. writers: {
  8065. gml: GeoGlobe.Util.applyDefaults({
  8066. featureMembers: function(a) {
  8067. for (var b =
  8068. this.createElementNSPlus("gml:featureMembers"), c = 0, d = a.length; c < d; ++c) this.writeNode("feature:_typeName", a[c], b);
  8069. return b
  8070. },
  8071. Point: function(a) {
  8072. var b = this.createElementNSPlus("gml:Point");
  8073. this.writeNode("pos", a, b);
  8074. return b
  8075. },
  8076. pos: function(a) {
  8077. return this.createElementNSPlus("gml:pos", {
  8078. value: this.xy ? a.x + " " + a.y : a.y + " " + a.x
  8079. })
  8080. },
  8081. LineString: function(a) {
  8082. var b = this.createElementNSPlus("gml:LineString");
  8083. this.writeNode("posList", a.components, b);
  8084. return b
  8085. },
  8086. Curve: function(a) {
  8087. var b = this.createElementNSPlus("gml:Curve");
  8088. this.writeNode("segments", a, b);
  8089. return b
  8090. },
  8091. segments: function(a) {
  8092. var b = this.createElementNSPlus("gml:segments");
  8093. this.writeNode("LineStringSegment", a, b);
  8094. return b
  8095. },
  8096. LineStringSegment: function(a) {
  8097. var b = this.createElementNSPlus("gml:LineStringSegment");
  8098. this.writeNode("posList", a.components, b);
  8099. return b
  8100. },
  8101. posList: function(a) {
  8102. for (var b = a.length, c = Array(b), d, e = 0; e < b; ++e) d = a[e], c[e] = this.xy ? d.x + " " + d.y : d.y + " " + d.x;
  8103. return this.createElementNSPlus("gml:posList", {
  8104. value: c.join(" ")
  8105. })
  8106. },
  8107. Surface: function(a) {
  8108. var b = this.createElementNSPlus("gml:Surface");
  8109. this.writeNode("patches", a, b);
  8110. return b
  8111. },
  8112. patches: function(a) {
  8113. var b = this.createElementNSPlus("gml:patches");
  8114. this.writeNode("PolygonPatch", a, b);
  8115. return b
  8116. },
  8117. PolygonPatch: function(a) {
  8118. var b = this.createElementNSPlus("gml:PolygonPatch", {
  8119. attributes: {
  8120. interpolation: "planar"
  8121. }
  8122. });
  8123. this.writeNode("exterior", a.components[0], b);
  8124. for (var c = 1, d = a.components.length; c < d; ++c) this.writeNode("interior", a.components[c], b);
  8125. return b
  8126. },
  8127. Polygon: function(a) {
  8128. var b = this.createElementNSPlus("gml:Polygon");
  8129. this.writeNode("exterior", a.components[0],
  8130. b);
  8131. for (var c = 1, d = a.components.length; c < d; ++c) this.writeNode("interior", a.components[c], b);
  8132. return b
  8133. },
  8134. exterior: function(a) {
  8135. var b = this.createElementNSPlus("gml:exterior");
  8136. this.writeNode("LinearRing", a, b);
  8137. return b
  8138. },
  8139. interior: function(a) {
  8140. var b = this.createElementNSPlus("gml:interior");
  8141. this.writeNode("LinearRing", a, b);
  8142. return b
  8143. },
  8144. LinearRing: function(a) {
  8145. var b = this.createElementNSPlus("gml:LinearRing");
  8146. this.writeNode("posList", a.components, b);
  8147. return b
  8148. },
  8149. MultiCurve: function(a) {
  8150. for (var b = this.createElementNSPlus("gml:MultiCurve"),
  8151. a = a.components || [a], c = 0, d = a.length; c < d; ++c) this.writeNode("curveMember", a[c], b);
  8152. return b
  8153. },
  8154. curveMember: function(a) {
  8155. var b = this.createElementNSPlus("gml:curveMember");
  8156. this.curve ? this.writeNode("Curve", a, b) : this.writeNode("LineString", a, b);
  8157. return b
  8158. },
  8159. MultiSurface: function(a) {
  8160. for (var b = this.createElementNSPlus("gml:MultiSurface"), a = a.components || [a], c = 0, d = a.length; c < d; ++c) this.writeNode("surfaceMember", a[c], b);
  8161. return b
  8162. },
  8163. surfaceMember: function(a) {
  8164. var b = this.createElementNSPlus("gml:surfaceMember");
  8165. this.surface ?
  8166. this.writeNode("Surface", a, b) : this.writeNode("Polygon", a, b);
  8167. return b
  8168. },
  8169. Envelope: function(a) {
  8170. var b = this.createElementNSPlus("gml:Envelope");
  8171. this.writeNode("lowerCorner", a, b);
  8172. this.writeNode("upperCorner", a, b);
  8173. this.srsName && b.setAttribute("srsName", this.srsName);
  8174. return b
  8175. },
  8176. lowerCorner: function(a) {
  8177. return this.createElementNSPlus("gml:lowerCorner", {
  8178. value: this.xy ? a._sw.lng + " " + a._sw.lat : a._sw.lat + " " + a._sw.lng
  8179. })
  8180. },
  8181. upperCorner: function(a) {
  8182. return this.createElementNSPlus("gml:upperCorner", {
  8183. value: this.xy ? a._ne.lng +
  8184. " " + a._ne.lat : a._ne.lat + " " + a._ne.lng
  8185. })
  8186. }
  8187. }, GeoGlobe.Format.GML.Base.prototype.writers.gml),
  8188. feature: GeoGlobe.Format.GML.Base.prototype.writers.feature,
  8189. wfs: GeoGlobe.Format.GML.Base.prototype.writers.wfs
  8190. },
  8191. setGeometryTypes: function() {
  8192. this.geometryTypes = {
  8193. "GeoGlobe.Geometry.Point": "Point",
  8194. "GeoGlobe.Geometry.MultiPoint": "MultiPoint",
  8195. "GeoGlobe.Geometry.LineString": this.curve === !0 ? "Curve" : "LineString",
  8196. "GeoGlobe.Geometry.MultiLineString": this.multiCurve === !1 ? "MultiLineString" : "MultiCurve",
  8197. "GeoGlobe.Geometry.Polygon": this.surface ===
  8198. !0 ? "Surface" : "Polygon",
  8199. "GeoGlobe.Geometry.MultiPolygon": this.multiSurface === !1 ? "MultiPolygon" : "MultiSurface",
  8200. "GeoGlobe.Geometry.Collection": "GeometryCollection"
  8201. }
  8202. },
  8203. CLASS_NAME: "GeoGlobe.Format.GML.v3"
  8204. });
  8205. GeoGlobe.Format.KML = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  8206. namespaces: {
  8207. kml: "http://www.opengis.net/kml/2.2",
  8208. gx: "http://www.google.com/kml/ext/2.2"
  8209. },
  8210. kmlns: "http://earth.google.com/kml/2.0",
  8211. placemarksDesc: "No description available",
  8212. foldersName: "GeoGlobe export",
  8213. foldersDesc: "Exported on " + new Date,
  8214. extractAttributes: !0,
  8215. kvpAttributes: !1,
  8216. extractStyles: !1,
  8217. extractTracks: !1,
  8218. trackAttributes: null,
  8219. internalns: null,
  8220. features: null,
  8221. styles: null,
  8222. styleBaseUrl: "",
  8223. fetched: null,
  8224. maxDepth: 0,
  8225. initialize: function(a) {
  8226. this.regExes = {
  8227. trimSpace: /^\s*|\s*$/g,
  8228. removeSpace: /\s*/g,
  8229. splitSpace: /\s+/,
  8230. trimComma: /\s*,\s*/g,
  8231. kmlColor: /(\w{2})(\w{2})(\w{2})(\w{2})/,
  8232. kmlIconPalette: /root:\/\/icons\/palette-(\d+)(\.\w+)/,
  8233. straightBracket: /\$\[(.*?)\]/g
  8234. };
  8235. this.externalProjection = new GeoGlobe.SpatialReference("EPSG:4326");
  8236. GeoGlobe.Format.XML.prototype.initialize.apply(this, [a])
  8237. },
  8238. read: function(a) {
  8239. this.features = [];
  8240. this.styles = {};
  8241. this.fetched = {};
  8242. return this.parseData(a, {
  8243. depth: 0,
  8244. styleBaseUrl: this.styleBaseUrl
  8245. })
  8246. },
  8247. parseData: function(a, b) {
  8248. typeof a == "string" &&
  8249. (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  8250. for (var c = ["Link", "NetworkLink", "Style", "StyleMap", "Placemark"], d = 0, e = c.length; d < e; ++d) {
  8251. var f = c[d],
  8252. g = this.getElementsByTagNameNS(a, "*", f);
  8253. if (g.length != 0) switch (f.toLowerCase()) {
  8254. case "link":
  8255. case "networklink":
  8256. this.parseLinks(g, b);
  8257. break;
  8258. case "style":
  8259. this.extractStyles && this.parseStyles(g, b);
  8260. break;
  8261. case "stylemap":
  8262. this.extractStyles && this.parseStyleMaps(g, b);
  8263. break;
  8264. case "placemark":
  8265. this.parseFeatures(g, b)
  8266. }
  8267. }
  8268. return this.features
  8269. },
  8270. parseLinks: function(a,
  8271. b) {
  8272. if (b.depth >= this.maxDepth) return !1;
  8273. var c = GeoGlobe.Util.extend({}, b);
  8274. c.depth++;
  8275. for (var d = 0, e = a.length; d < e; d++) {
  8276. var f = this.parseProperty(a[d], "*", "href");
  8277. f && !this.fetched[f] && (this.fetched[f] = !0, (f = this.fetchLink(f)) && this.parseData(f, c))
  8278. }
  8279. },
  8280. fetchLink: function(a) {
  8281. if (a = GeoGlobe.Request.GET({
  8282. url: a,
  8283. async: !1
  8284. })) return a.responseText
  8285. },
  8286. parseStyles: function(a, b) {
  8287. for (var c = 0, d = a.length; c < d; c++) {
  8288. var e = this.parseStyle(a[c]);
  8289. e && (this.styles[(b.styleBaseUrl || "") + "#" + e.id] = e)
  8290. }
  8291. },
  8292. parseKmlColor: function(a) {
  8293. var b =
  8294. null;
  8295. a && (a = a.match(this.regExes.kmlColor)) && (b = {
  8296. color: "#" + a[4] + a[3] + a[2],
  8297. opacity: parseInt(a[1], 16) / 255
  8298. });
  8299. return b
  8300. },
  8301. parseStyle: function(a) {
  8302. for (var b = {}, c = ["LineStyle", "PolyStyle", "IconStyle", "BalloonStyle", "LabelStyle"], d, e, f = 0, g = c.length; f < g; ++f)
  8303. if (d = c[f], e = this.getElementsByTagNameNS(a, "*", d)[0]) switch (d.toLowerCase()) {
  8304. case "linestyle":
  8305. d = this.parseProperty(e, "*", "color");
  8306. if (d = this.parseKmlColor(d)) b.strokeColor = d.color, b.strokeOpacity = d.opacity;
  8307. (d = this.parseProperty(e, "*", "width")) && (b.strokeWidth =
  8308. d);
  8309. break;
  8310. case "polystyle":
  8311. d = this.parseProperty(e, "*", "color");
  8312. if (d = this.parseKmlColor(d)) b.fillOpacity = d.opacity, b.fillColor = d.color;
  8313. this.parseProperty(e, "*", "fill") == "0" && (b.fillColor = "none");
  8314. this.parseProperty(e, "*", "outline") == "0" && (b.strokeWidth = "0");
  8315. break;
  8316. case "iconstyle":
  8317. var h = parseFloat(this.parseProperty(e, "*", "scale") || 1);
  8318. d = 32 * h;
  8319. var j = 32 * h,
  8320. l = this.getElementsByTagNameNS(e, "*", "Icon")[0];
  8321. if (l) {
  8322. var m = this.parseProperty(l, "*", "href");
  8323. if (m) {
  8324. var n = this.parseProperty(l, "*", "w"),
  8325. p = this.parseProperty(l,
  8326. "*", "h");
  8327. GeoGlobe.String.startsWith(m, "http://maps.google.com/mapfiles/kml") && !n && !p && (p = n = 64, h /= 2);
  8328. n = n || p;
  8329. p = p || n;
  8330. n && (d = parseInt(n) * h);
  8331. p && (j = parseInt(p) * h);
  8332. if (p = m.match(this.regExes.kmlIconPalette)) n = p[1], p = p[2], m = this.parseProperty(l, "*", "x"), l = this.parseProperty(l, "*", "y"), m = "http://maps.google.com/mapfiles/kml/pal" + n + "/icon" + ((l ? 7 - l / 32 : 7) * 8 + (m ? m / 32 : 0)) + p;
  8333. b.graphicOpacity = 1;
  8334. b.externalGraphic = m
  8335. }
  8336. }
  8337. if (e = this.getElementsByTagNameNS(e, "*", "hotSpot")[0]) m = parseFloat(e.getAttribute("x")), l = parseFloat(e.getAttribute("y")),
  8338. n = e.getAttribute("xunits"), n == "pixels" ? b.graphicXOffset = -m * h : n == "insetPixels" ? b.graphicXOffset = -d + m * h : n == "fraction" && (b.graphicXOffset = -d * m), e = e.getAttribute("yunits"), e == "pixels" ? b.graphicYOffset = -j + l * h + 1 : e == "insetPixels" ? b.graphicYOffset = -(l * h) + 1 : e == "fraction" && (b.graphicYOffset = -j * (1 - l) + 1);
  8339. b.graphicWidth = d;
  8340. b.graphicHeight = j;
  8341. break;
  8342. case "balloonstyle":
  8343. (e = GeoGlobe.Util.getXmlNodeValue(e)) && (b.balloonStyle = e.replace(this.regExes.straightBracket, "${$1}"));
  8344. break;
  8345. case "labelstyle":
  8346. if (d = this.parseProperty(e,
  8347. "*", "color"), d = this.parseKmlColor(d)) b.fontColor = d.color, b.fontOpacity = d.opacity
  8348. }!b.strokeColor && b.fillColor && (b.strokeColor = b.fillColor);
  8349. if ((a = a.getAttribute("id")) && b) b.id = a;
  8350. return b
  8351. },
  8352. parseStyleMaps: function(a, b) {
  8353. for (var c = 0, d = a.length; c < d; c++)
  8354. for (var e = a[c], f = this.getElementsByTagNameNS(e, "*", "Pair"), e = e.getAttribute("id"), g = 0, h = f.length; g < h; g++) {
  8355. var j = f[g],
  8356. l = this.parseProperty(j, "*", "key");
  8357. (j = this.parseProperty(j, "*", "styleUrl")) && l == "normal" && (this.styles[(b.styleBaseUrl || "") + "#" + e] = this.styles[(b.styleBaseUrl ||
  8358. "") + j])
  8359. }
  8360. },
  8361. parseFeatures: function(a, b) {
  8362. for (var c = [], d = 0, e = a.length; d < e; d++) {
  8363. var f = a[d],
  8364. g = this.parseFeature.apply(this, [f]);
  8365. if (g) {
  8366. if (this.extractStyles && g.attributes && g.attributes.styleUrl) g.style = this.getStyle(g.attributes.styleUrl, b);
  8367. if (this.extractStyles) {
  8368. var h = this.getElementsByTagNameNS(f, "*", "Style")[0];
  8369. if (h && (h = this.parseStyle(h))) g.style = GeoGlobe.Util.extend(g.style, h)
  8370. }
  8371. if (this.extractTracks) {
  8372. if ((f = this.getElementsByTagNameNS(f, this.namespaces.gx, "Track")) && f.length > 0) g = {
  8373. features: [],
  8374. feature: g
  8375. },
  8376. this.readNode(f[0], g), g.features.length > 0 && c.push.apply(c, g.features)
  8377. } else c.push(g)
  8378. } else throw "Bad Placemark: " + d;
  8379. }
  8380. this.features = this.features.concat(c)
  8381. },
  8382. readers: {
  8383. kml: {
  8384. when: function(a, b) {
  8385. b.whens.push(GeoGlobe.Date.parse(this.getChildValue(a)))
  8386. },
  8387. _trackPointAttribute: function(a, b) {
  8388. var c = a.nodeName.split(":").pop();
  8389. b.attributes[c].push(this.getChildValue(a))
  8390. }
  8391. },
  8392. gx: {
  8393. Track: function(a, b) {
  8394. var c = {
  8395. whens: [],
  8396. points: [],
  8397. angles: []
  8398. };
  8399. if (this.trackAttributes) {
  8400. var d;
  8401. c.attributes = {};
  8402. for (var e = 0, f = this.trackAttributes.length; e <
  8403. f; ++e)
  8404. if (d = this.trackAttributes[e], c.attributes[d] = [], !(d in this.readers.kml)) this.readers.kml[d] = this.readers.kml._trackPointAttribute
  8405. }
  8406. this.readChildNodes(a, c);
  8407. if (c.whens.length !== c.points.length) throw Error("gx:Track with unequal number of when (" + c.whens.length + ") and gx:coord (" + c.points.length + ") elements.");
  8408. var g = c.angles.length > 0;
  8409. if (g && c.whens.length !== c.angles.length) throw Error("gx:Track with unequal number of when (" + c.whens.length + ") and gx:angles (" + c.angles.length + ") elements.");
  8410. for (var h,
  8411. e = 0, f = c.whens.length; e < f; ++e) {
  8412. h = b.feature.clone();
  8413. h.fid = b.feature.fid || b.feature.id;
  8414. d = c.points[e];
  8415. h.geometry = d;
  8416. if ("z" in d) h.attributes.altitude = d.z;
  8417. this.internalProjection && this.externalProjection && h.geometry.transform(this.externalProjection, this.internalProjection);
  8418. if (this.trackAttributes)
  8419. for (var j = 0, l = this.trackAttributes.length; j < l; ++j) d = this.trackAttributes[j], h.attributes[d] = c.attributes[d][e];
  8420. h.attributes.when = c.whens[e];
  8421. h.attributes.trackId = b.feature.id;
  8422. if (g) d = c.angles[e], h.attributes.heading =
  8423. parseFloat(d[0]), h.attributes.tilt = parseFloat(d[1]), h.attributes.roll = parseFloat(d[2]);
  8424. b.features.push(h)
  8425. }
  8426. },
  8427. coord: function(a, b) {
  8428. var c = this.getChildValue(a).replace(this.regExes.trimSpace, "").split(/\s+/),
  8429. d = new GeoGlobe.Geometry.Point(c[0], c[1]);
  8430. if (c.length > 2) d.z = parseFloat(c[2]);
  8431. b.points.push(d)
  8432. },
  8433. angles: function(a, b) {
  8434. var c = this.getChildValue(a).replace(this.regExes.trimSpace, "").split(/\s+/);
  8435. b.angles.push(c)
  8436. }
  8437. }
  8438. },
  8439. parseFeature: function(a) {
  8440. for (var b = ["MultiGeometry", "Polygon", "LineString", "Point"], c,
  8441. d, e, f = 0, g = b.length; f < g; ++f)
  8442. if (c = b[f], this.internalns = a.namespaceURI ? a.namespaceURI : this.kmlns, d = this.getElementsByTagNameNS(a, this.internalns, c), d.length > 0) {
  8443. if (b = this.parseGeometry[c.toLowerCase()]) e = b.apply(this, [d[0]]), this.internalProjection && this.externalProjection && e.transform(this.externalProjection, this.internalProjection);
  8444. else throw new TypeError("Unsupported geometry type: " + c);
  8445. break
  8446. }
  8447. var h;
  8448. this.extractAttributes && (h = this.parseAttributes(a));
  8449. c = new GeoGlobe.Feature(e, h);
  8450. a = a.getAttribute("id") ||
  8451. a.getAttribute("name");
  8452. if (a != null) c.fid = a;
  8453. return c
  8454. },
  8455. getStyle: function(a, b) {
  8456. var c = GeoGlobe.Util.removeTail(a),
  8457. d = GeoGlobe.Util.extend({}, b);
  8458. d.depth++;
  8459. d.styleBaseUrl = c;
  8460. !this.styles[a] && !GeoGlobe.String.startsWith(a, "#") && d.depth <= this.maxDepth && !this.fetched[c] && (c = this.fetchLink(c)) && this.parseData(c, d);
  8461. return GeoGlobe.Util.extend({}, this.styles[a])
  8462. },
  8463. parseGeometry: {
  8464. point: function(a) {
  8465. var b = this.getElementsByTagNameNS(a, this.internalns, "coordinates"),
  8466. a = [];
  8467. if (b.length > 0) var c = b[0].firstChild.nodeValue,
  8468. c = c.replace(this.regExes.removeSpace, ""),
  8469. a = c.split(",");
  8470. b = null;
  8471. if (a.length > 1) a.length == 2 && (a[2] = null), b = new GeoGlobe.Geometry.Point(a[0], a[1], a[2]);
  8472. else throw "Bad coordinate string: " + c;
  8473. return b
  8474. },
  8475. linestring: function(a, b) {
  8476. var c = this.getElementsByTagNameNS(a, this.internalns, "coordinates"),
  8477. d = null;
  8478. if (c.length > 0) {
  8479. for (var c = this.getChildValue(c[0]), c = c.replace(this.regExes.trimSpace, ""), c = c.replace(this.regExes.trimComma, ","), d = c.split(this.regExes.splitSpace), e = d.length, f = Array(e), g, h, j = 0; j < e; ++j)
  8480. if (g =
  8481. d[j].split(","), h = g.length, h > 1) g.length == 2 && (g[2] = null), f[j] = new GeoGlobe.Geometry.Point(g[0], g[1], g[2]);
  8482. else throw "Bad LineString point coordinates: " + d[j];
  8483. if (e) d = b ? new GeoGlobe.Geometry.LinearRing(f) : new GeoGlobe.Geometry.LineString(f);
  8484. else throw "Bad LineString coordinates: " + c;
  8485. }
  8486. return d
  8487. },
  8488. polygon: function(a) {
  8489. var a = this.getElementsByTagNameNS(a, this.internalns, "LinearRing"),
  8490. b = a.length,
  8491. c = Array(b);
  8492. if (b > 0)
  8493. for (var d = 0, e = a.length; d < e; ++d)
  8494. if (b = this.parseGeometry.linestring.apply(this, [a[d], !0])) c[d] = b;
  8495. else throw "Bad LinearRing geometry: " + d;
  8496. return new GeoGlobe.Geometry.Polygon(c)
  8497. },
  8498. multigeometry: function(a) {
  8499. for (var b, c = [], d = a.childNodes, e = 0, f = d.length; e < f; ++e) a = d[e], a.nodeType == 1 && (b = this.parseGeometry[(a.prefix ? a.nodeName.split(":")[1] : a.nodeName).toLowerCase()]) && c.push(b.apply(this, [a]));
  8500. return new GeoGlobe.Geometry.Collection(c)
  8501. }
  8502. },
  8503. parseAttributes: function(a) {
  8504. var b = {},
  8505. c = a.getElementsByTagName("ExtendedData");
  8506. c.length && (b = this.parseExtendedData(c[0]));
  8507. for (var d, e, f, a = a.childNodes, c = 0, g = a.length; c <
  8508. g; ++c)
  8509. if (d = a[c], d.nodeType == 1 && (e = d.childNodes, e.length >= 1 && e.length <= 3)) {
  8510. switch (e.length) {
  8511. case 1:
  8512. f = e[0];
  8513. break;
  8514. case 2:
  8515. f = e[0];
  8516. e = e[1];
  8517. f = f.nodeType == 3 || f.nodeType == 4 ? f : e;
  8518. break;
  8519. default:
  8520. f = e[1]
  8521. }
  8522. if (f.nodeType == 3 || f.nodeType == 4)
  8523. if (d = d.prefix ? d.nodeName.split(":")[1] : d.nodeName, f = GeoGlobe.Util.getXmlNodeValue(f)) f = f.replace(this.regExes.trimSpace, ""), b[d] = f
  8524. }
  8525. return b
  8526. },
  8527. parseExtendedData: function(a) {
  8528. var b = {},
  8529. c, d, e, f, g = a.getElementsByTagName("Data");
  8530. c = 0;
  8531. for (d = g.length; c < d; c++) {
  8532. e = g[c];
  8533. f = e.getAttribute("name");
  8534. var h = {},
  8535. j = e.getElementsByTagName("value");
  8536. j.length && (h.value = this.getChildValue(j[0]));
  8537. this.kvpAttributes ? b[f] = h.value : (e = e.getElementsByTagName("displayName"), e.length && (h.displayName = this.getChildValue(e[0])), b[f] = h)
  8538. }
  8539. a = a.getElementsByTagName("SimpleData");
  8540. c = 0;
  8541. for (d = a.length; c < d; c++) h = {}, e = a[c], f = e.getAttribute("name"), h.value = this.getChildValue(e), this.kvpAttributes ? b[f] = h.value : (h.displayName = f, b[f] = h);
  8542. return b
  8543. },
  8544. parseProperty: function(a, b, c) {
  8545. var d, a = this.getElementsByTagNameNS(a, b, c);
  8546. try {
  8547. d = GeoGlobe.Util.getXmlNodeValue(a[0])
  8548. } catch (e) {
  8549. d =
  8550. null
  8551. }
  8552. return d
  8553. },
  8554. write: function(a) {
  8555. GeoGlobe.Util.isArray(a) || (a = [a]);
  8556. for (var b = this.createElementNS(this.kmlns, "kml"), c = this.createFolderXML(), d = 0, e = a.length; d < e; ++d) c.appendChild(this.createPlacemarkXML(a[d]));
  8557. b.appendChild(c);
  8558. return GeoGlobe.Format.XML.prototype.write.apply(this, [b])
  8559. },
  8560. createFolderXML: function() {
  8561. var a = this.createElementNS(this.kmlns, "Folder");
  8562. if (this.foldersName) {
  8563. var b = this.createElementNS(this.kmlns, "name"),
  8564. c = this.createTextNode(this.foldersName);
  8565. b.appendChild(c);
  8566. a.appendChild(b)
  8567. }
  8568. this.foldersDesc &&
  8569. (b = this.createElementNS(this.kmlns, "description"), c = this.createTextNode(this.foldersDesc), b.appendChild(c), a.appendChild(b));
  8570. return a
  8571. },
  8572. createPlacemarkXML: function(a) {
  8573. var b = this.createElementNS(this.kmlns, "name"),
  8574. c = a.style && a.style.label ? a.style.label : a.id;
  8575. b.appendChild(this.createTextNode(a.attributes.name || c));
  8576. var d = this.createElementNS(this.kmlns, "description");
  8577. d.appendChild(this.createTextNode(a.attributes.description || this.placemarksDesc));
  8578. c = this.createElementNS(this.kmlns, "Placemark");
  8579. a.fid !=
  8580. null && c.setAttribute("id", a.fid);
  8581. c.appendChild(b);
  8582. c.appendChild(d);
  8583. b = this.buildGeometryNode(a.geometry);
  8584. c.appendChild(b);
  8585. a.attributes && (a = this.buildExtendedData(a.attributes)) && c.appendChild(a);
  8586. return c
  8587. },
  8588. buildGeometryNode: function(a) {
  8589. var b = a.CLASS_NAME,
  8590. b = this.buildGeometry[b.substring(b.lastIndexOf(".") + 1).toLowerCase()],
  8591. c = null;
  8592. b && (c = b.apply(this, [a]));
  8593. return c
  8594. },
  8595. buildGeometry: {
  8596. point: function(a) {
  8597. var b = this.createElementNS(this.kmlns, "Point");
  8598. b.appendChild(this.buildCoordinatesNode(a));
  8599. return b
  8600. },
  8601. multipoint: function(a) {
  8602. return this.buildGeometry.collection.apply(this, [a])
  8603. },
  8604. linestring: function(a) {
  8605. var b = this.createElementNS(this.kmlns, "LineString");
  8606. b.appendChild(this.buildCoordinatesNode(a));
  8607. return b
  8608. },
  8609. multilinestring: function(a) {
  8610. return this.buildGeometry.collection.apply(this, [a])
  8611. },
  8612. linearring: function(a) {
  8613. var b = this.createElementNS(this.kmlns, "LinearRing");
  8614. b.appendChild(this.buildCoordinatesNode(a));
  8615. return b
  8616. },
  8617. polygon: function(a) {
  8618. for (var b = this.createElementNS(this.kmlns, "Polygon"), a = a.components, c, d, e = 0, f = a.length; e < f; ++e) c = e == 0 ? "outerBoundaryIs" : "innerBoundaryIs",
  8619. c = this.createElementNS(this.kmlns, c), d = this.buildGeometry.linearring.apply(this, [a[e]]), c.appendChild(d), b.appendChild(c);
  8620. return b
  8621. },
  8622. multipolygon: function(a) {
  8623. return this.buildGeometry.collection.apply(this, [a])
  8624. },
  8625. collection: function(a) {
  8626. for (var b = this.createElementNS(this.kmlns, "MultiGeometry"), c, d = 0, e = a.components.length; d < e; ++d)(c = this.buildGeometryNode.apply(this, [a.components[d]])) && b.appendChild(c);
  8627. return b
  8628. }
  8629. },
  8630. buildCoordinatesNode: function(a) {
  8631. var b = this.createElementNS(this.kmlns, "coordinates"),
  8632. c;
  8633. if (c = a.components) {
  8634. for (var d = c.length, e = Array(d), f = 0; f < d; ++f) a = c[f], e[f] = this.buildCoordinates(a);
  8635. c = e.join(" ")
  8636. } else c = this.buildCoordinates(a);
  8637. c = this.createTextNode(c);
  8638. b.appendChild(c);
  8639. return b
  8640. },
  8641. buildCoordinates: function(a) {
  8642. this.internalProjection && this.externalProjection && (a = a.clone(), a.transform(this.internalProjection, this.externalProjection));
  8643. return a.x + "," + a.y
  8644. },
  8645. buildExtendedData: function(a) {
  8646. var b = this.createElementNS(this.kmlns, "ExtendedData"),
  8647. c;
  8648. for (c in a)
  8649. if (a[c] && c != "name" && c != "description" &&
  8650. c != "styleUrl") {
  8651. var d = this.createElementNS(this.kmlns, "Data");
  8652. d.setAttribute("name", c);
  8653. var e = this.createElementNS(this.kmlns, "value");
  8654. if (typeof a[c] == "object") {
  8655. if (a[c].value && e.appendChild(this.createTextNode(a[c].value)), a[c].displayName) {
  8656. var f = this.createElementNS(this.kmlns, "displayName");
  8657. f.appendChild(this.getXMLDoc().createCDATASection(a[c].displayName));
  8658. d.appendChild(f)
  8659. }
  8660. } else e.appendChild(this.createTextNode(a[c]));
  8661. d.appendChild(e);
  8662. b.appendChild(d)
  8663. }
  8664. return this.isSimpleContent(b) ? null : b
  8665. },
  8666. CLASS_NAME: "GeoGlobe.Format.KML"
  8667. });
  8668. GeoGlobe.Format.OWSCommon = GeoGlobe.Class4OL(GeoGlobe.Format.XML.VersionedOGC, {
  8669. defaultVersion: "1.0.0",
  8670. getVersion: function(a) {
  8671. var b = this.version;
  8672. if (!b && ((a = a.getAttribute("xmlns:ows")) && a.substring(a.lastIndexOf("/") + 1) === "1.1" && (b = "1.1.0"), !b)) b = this.defaultVersion;
  8673. return b
  8674. },
  8675. CLASS_NAME: "GeoGlobe.Format.OWSCommon"
  8676. });
  8677. GeoGlobe.Format.OWSCommon.v1 = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  8678. regExes: {
  8679. trimSpace: /^\s*|\s*$/g,
  8680. removeSpace: /\s*/g,
  8681. splitSpace: /\s+/,
  8682. trimComma: /\s*,\s*/g
  8683. },
  8684. read: function(a, b) {
  8685. GeoGlobe.Util.applyDefaults(b, this.options);
  8686. var c = {};
  8687. this.readChildNodes(a, c);
  8688. return c
  8689. },
  8690. readers: {
  8691. ows: {
  8692. Exception: function(a, b) {
  8693. var c = {
  8694. code: a.getAttribute("exceptionCode"),
  8695. locator: a.getAttribute("locator"),
  8696. texts: []
  8697. };
  8698. b.exceptions.push(c);
  8699. this.readChildNodes(a, c)
  8700. },
  8701. ExceptionText: function(a, b) {
  8702. var c = this.getChildValue(a);
  8703. b.texts.push(c)
  8704. },
  8705. ServiceIdentification: function(a, b) {
  8706. b.serviceIdentification = {};
  8707. this.readChildNodes(a, b.serviceIdentification)
  8708. },
  8709. Title: function(a, b) {
  8710. b.title = this.getChildValue(a)
  8711. },
  8712. Abstract: function(a, b) {
  8713. b["abstract"] = this.getChildValue(a)
  8714. },
  8715. Keywords: function(a, b) {
  8716. b.keywords = {};
  8717. this.readChildNodes(a, b.keywords)
  8718. },
  8719. Keyword: function(a, b) {
  8720. b[this.getChildValue(a)] = !0
  8721. },
  8722. ServiceType: function(a, b) {
  8723. b.serviceType = {
  8724. codeSpace: a.getAttribute("codeSpace"),
  8725. value: this.getChildValue(a)
  8726. }
  8727. },
  8728. ServiceTypeVersion: function(a, b) {
  8729. b.serviceTypeVersion =
  8730. this.getChildValue(a)
  8731. },
  8732. Fees: function(a, b) {
  8733. b.fees = this.getChildValue(a)
  8734. },
  8735. AccessConstraints: function(a, b) {
  8736. b.accessConstraints = this.getChildValue(a)
  8737. },
  8738. ServiceProvider: function(a, b) {
  8739. b.serviceProvider = {};
  8740. this.readChildNodes(a, b.serviceProvider)
  8741. },
  8742. ProviderName: function(a, b) {
  8743. b.providerName = this.getChildValue(a)
  8744. },
  8745. ProviderSite: function(a, b) {
  8746. b.providerSite = this.getAttributeNS(a, this.namespaces.xlink, "href")
  8747. },
  8748. ServiceContact: function(a, b) {
  8749. b.serviceContact = {};
  8750. this.readChildNodes(a, b.serviceContact)
  8751. },
  8752. IndividualName: function(a,
  8753. b) {
  8754. b.individualName = this.getChildValue(a)
  8755. },
  8756. PositionName: function(a, b) {
  8757. b.positionName = this.getChildValue(a)
  8758. },
  8759. ContactInfo: function(a, b) {
  8760. b.contactInfo = {};
  8761. this.readChildNodes(a, b.contactInfo)
  8762. },
  8763. Phone: function(a, b) {
  8764. b.phone = {};
  8765. this.readChildNodes(a, b.phone)
  8766. },
  8767. Voice: function(a, b) {
  8768. b.voice = this.getChildValue(a)
  8769. },
  8770. Address: function(a, b) {
  8771. b.address = {};
  8772. this.readChildNodes(a, b.address)
  8773. },
  8774. DeliveryPoint: function(a, b) {
  8775. b.deliveryPoint = this.getChildValue(a)
  8776. },
  8777. City: function(a, b) {
  8778. b.city = this.getChildValue(a)
  8779. },
  8780. AdministrativeArea: function(a,
  8781. b) {
  8782. b.administrativeArea = this.getChildValue(a)
  8783. },
  8784. PostalCode: function(a, b) {
  8785. b.postalCode = this.getChildValue(a)
  8786. },
  8787. Country: function(a, b) {
  8788. b.country = this.getChildValue(a)
  8789. },
  8790. ElectronicMailAddress: function(a, b) {
  8791. b.electronicMailAddress = this.getChildValue(a)
  8792. },
  8793. Role: function(a, b) {
  8794. b.role = this.getChildValue(a)
  8795. },
  8796. OperationsMetadata: function(a, b) {
  8797. b.operationsMetadata = {};
  8798. this.readChildNodes(a, b.operationsMetadata)
  8799. },
  8800. Operation: function(a, b) {
  8801. var c = a.getAttribute("name");
  8802. b[c] = {};
  8803. this.readChildNodes(a, b[c])
  8804. },
  8805. DCP: function(a,
  8806. b) {
  8807. b.dcp = {};
  8808. this.readChildNodes(a, b.dcp)
  8809. },
  8810. HTTP: function(a, b) {
  8811. b.http = {};
  8812. this.readChildNodes(a, b.http)
  8813. },
  8814. Get: function(a, b) {
  8815. if (!b.get) b.get = [];
  8816. var c = {
  8817. url: this.getAttributeNS(a, this.namespaces.xlink, "href")
  8818. };
  8819. this.readChildNodes(a, c);
  8820. b.get.push(c)
  8821. },
  8822. Post: function(a, b) {
  8823. if (!b.post) b.post = [];
  8824. var c = {
  8825. url: this.getAttributeNS(a, this.namespaces.xlink, "href")
  8826. };
  8827. this.readChildNodes(a, c);
  8828. b.post.push(c)
  8829. },
  8830. Parameter: function(a, b) {
  8831. if (!b.parameters) b.parameters = {};
  8832. var c = a.getAttribute("name");
  8833. b.parameters[c] = {};
  8834. this.readChildNodes(a,
  8835. b.parameters[c])
  8836. },
  8837. Constraint: function(a, b) {
  8838. if (!b.constraints) b.constraints = {};
  8839. var c = a.getAttribute("name");
  8840. b.constraints[c] = {};
  8841. this.readChildNodes(a, b.constraints[c])
  8842. },
  8843. Value: function(a, b) {
  8844. b[this.getChildValue(a)] = !0
  8845. },
  8846. OutputFormat: function(a, b) {
  8847. b.formats.push({
  8848. value: this.getChildValue(a)
  8849. });
  8850. this.readChildNodes(a, b)
  8851. },
  8852. WGS84BoundingBox: function(a, b) {
  8853. var c = {};
  8854. c.crs = a.getAttribute("crs");
  8855. b.BoundingBox ? b.BoundingBox.push(c) : (b.projection = c.crs, c = b);
  8856. this.readChildNodes(a, c)
  8857. },
  8858. BoundingBox: function(a, b) {
  8859. this.readers.ows.WGS84BoundingBox.apply(this, [a, b])
  8860. },
  8861. LowerCorner: function(a, b) {
  8862. if (a.parentNode.tagName === "ows:BoundingBox") {
  8863. var c = this.getChildValue(a).replace(this.regExes.trimSpace, ""),
  8864. c = c.replace(this.regExes.trimComma, ","),
  8865. c = c.split(this.regExes.splitSpace);
  8866. b.left = c[0];
  8867. b.bottom = c[1]
  8868. }
  8869. },
  8870. UpperCorner: function(a, b) {
  8871. if (a.parentNode.tagName === "ows:BoundingBox") {
  8872. var c = this.getChildValue(a).replace(this.regExes.trimSpace, ""),
  8873. c = c.replace(this.regExes.trimComma, ","),
  8874. c = c.split(this.regExes.splitSpace);
  8875. b.right = c[0];
  8876. b.top = c[1];
  8877. b.bounds = new GeoGlobe.LngLatBounds(new GeoGlobe.LngLat(b.left,
  8878. b.bottom), new GeoGlobe.LngLat(b.right, b.top));
  8879. delete b.left;
  8880. delete b.bottom;
  8881. delete b.right;
  8882. delete b.top
  8883. }
  8884. },
  8885. Language: function(a, b) {
  8886. b.language = this.getChildValue(a)
  8887. }
  8888. }
  8889. },
  8890. writers: {
  8891. ows: {
  8892. BoundingBox: function(a, b) {
  8893. var c = this.createElementNSPlus(b || "ows:BoundingBox", {
  8894. attributes: {
  8895. crs: a.projection
  8896. }
  8897. });
  8898. this.writeNode("ows:LowerCorner", a, c);
  8899. this.writeNode("ows:UpperCorner", a, c);
  8900. return c
  8901. },
  8902. LowerCorner: function(a) {
  8903. return this.createElementNSPlus("ows:LowerCorner", {
  8904. value: a.bounds._sw.lng + " " + a.bounds._sw.lat
  8905. })
  8906. },
  8907. UpperCorner: function(a) {
  8908. return this.createElementNSPlus("ows:UpperCorner", {
  8909. value: a.bounds._ne.lng + " " + a.bounds._ne.lat
  8910. })
  8911. },
  8912. Identifier: function(a) {
  8913. return this.createElementNSPlus("ows:Identifier", {
  8914. value: a
  8915. })
  8916. },
  8917. Title: function(a) {
  8918. return this.createElementNSPlus("ows:Title", {
  8919. value: a
  8920. })
  8921. },
  8922. Abstract: function(a) {
  8923. return this.createElementNSPlus("ows:Abstract", {
  8924. value: a
  8925. })
  8926. },
  8927. OutputFormat: function(a) {
  8928. return this.createElementNSPlus("ows:OutputFormat", {
  8929. value: a
  8930. })
  8931. }
  8932. }
  8933. },
  8934. CLASS_NAME: "GeoGlobe.Format.OWSCommon.v1"
  8935. });
  8936. GeoGlobe.Format.OWSCommon.v1_0_0 = GeoGlobe.Class4OL(GeoGlobe.Format.OWSCommon.v1, {
  8937. namespaces: {
  8938. ows: "http://www.opengis.net/ows",
  8939. xlink: "http://www.w3.org/1999/xlink"
  8940. },
  8941. readers: {
  8942. ows: GeoGlobe.Util.applyDefaults({
  8943. ExceptionReport: function(a, b) {
  8944. b.success = !1;
  8945. b.exceptionReport = {
  8946. version: a.getAttribute("version"),
  8947. language: a.getAttribute("language"),
  8948. exceptions: []
  8949. };
  8950. this.readChildNodes(a, b.exceptionReport)
  8951. }
  8952. }, GeoGlobe.Format.OWSCommon.v1.prototype.readers.ows)
  8953. },
  8954. writers: {
  8955. ows: GeoGlobe.Format.OWSCommon.v1.prototype.writers.ows
  8956. },
  8957. CLASS_NAME: "GeoGlobe.Format.OWSCommon.v1_0_0"
  8958. });
  8959. GeoGlobe.Format.OWSCommon.v1_1_0 = GeoGlobe.Class4OL(GeoGlobe.Format.OWSCommon.v1, {
  8960. namespaces: {
  8961. ows: "http://www.opengis.net/ows/1.1",
  8962. xlink: "http://www.w3.org/1999/xlink"
  8963. },
  8964. readers: {
  8965. ows: GeoGlobe.Util.applyDefaults({
  8966. ExceptionReport: function(a, b) {
  8967. b.exceptionReport = {
  8968. version: a.getAttribute("version"),
  8969. language: a.getAttribute("xml:lang"),
  8970. exceptions: []
  8971. };
  8972. this.readChildNodes(a, b.exceptionReport)
  8973. },
  8974. AllowedValues: function(a, b) {
  8975. b.allowedValues = {};
  8976. this.readChildNodes(a, b.allowedValues)
  8977. },
  8978. AnyValue: function(a, b) {
  8979. b.anyValue = !0
  8980. },
  8981. DataType: function(a, b) {
  8982. b.dataType = this.getChildValue(a)
  8983. },
  8984. Range: function(a, b) {
  8985. b.range = {};
  8986. this.readChildNodes(a, b.range)
  8987. },
  8988. MinimumValue: function(a, b) {
  8989. b.minValue = this.getChildValue(a)
  8990. },
  8991. MaximumValue: function(a, b) {
  8992. b.maxValue = this.getChildValue(a)
  8993. },
  8994. Identifier: function(a, b) {
  8995. b.identifier = this.getChildValue(a)
  8996. },
  8997. SupportedCRS: function(a, b) {
  8998. b.supportedCRS = this.getChildValue(a)
  8999. }
  9000. }, GeoGlobe.Format.OWSCommon.v1.prototype.readers.ows)
  9001. },
  9002. writers: {
  9003. ows: GeoGlobe.Util.applyDefaults({
  9004. Range: function(a) {
  9005. var b = this.createElementNSPlus("ows:Range", {
  9006. attributes: {
  9007. "ows:rangeClosure": a.closure
  9008. }
  9009. });
  9010. this.writeNode("ows:MinimumValue", a.minValue, b);
  9011. this.writeNode("ows:MaximumValue", a.maxValue, b);
  9012. return b
  9013. },
  9014. MinimumValue: function(a) {
  9015. return this.createElementNSPlus("ows:MinimumValue", {
  9016. value: a
  9017. })
  9018. },
  9019. MaximumValue: function(a) {
  9020. return this.createElementNSPlus("ows:MaximumValue", {
  9021. value: a
  9022. })
  9023. },
  9024. Value: function(a) {
  9025. return this.createElementNSPlus("ows:Value", {
  9026. value: a
  9027. })
  9028. }
  9029. }, GeoGlobe.Format.OWSCommon.v1.prototype.writers.ows)
  9030. },
  9031. CLASS_NAME: "GeoGlobe.Format.OWSCommon.v1_1_0"
  9032. });
  9033. GeoGlobe.Format.WFSCapabilities = GeoGlobe.Class4OL(GeoGlobe.Format.XML.VersionedOGC, {
  9034. defaultVersion: "1.1.0",
  9035. CLASS_NAME: "GeoGlobe.Format.WFSCapabilities"
  9036. });
  9037. GeoGlobe.Format.WFSCapabilities.v1 = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  9038. namespaces: {
  9039. wfs: "http://www.opengis.net/wfs",
  9040. xlink: "http://www.w3.org/1999/xlink",
  9041. xsi: "http://www.w3.org/2001/XMLSchema-instance",
  9042. ows: "http://www.opengis.net/ows"
  9043. },
  9044. errorProperty: "featureTypeList",
  9045. defaultPrefix: "wfs",
  9046. read: function(a) {
  9047. typeof a == "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  9048. if (a && a.nodeType == 9) a = a.documentElement;
  9049. var b = {};
  9050. this.readNode(a, b);
  9051. return b
  9052. },
  9053. readers: {
  9054. wfs: {
  9055. WFS_Capabilities: function(a,
  9056. b) {
  9057. this.readChildNodes(a, b)
  9058. },
  9059. FeatureTypeList: function(a, b) {
  9060. b.featureTypeList = {
  9061. featureTypes: []
  9062. };
  9063. this.readChildNodes(a, b.featureTypeList)
  9064. },
  9065. FeatureType: function(a, b) {
  9066. var c = {};
  9067. this.readChildNodes(a, c);
  9068. b.featureTypes.push(c)
  9069. },
  9070. Name: function(a, b) {
  9071. var c = this.getChildValue(a);
  9072. b.realName = c;
  9073. if (c && (c = c.split(":"), b.name = c.pop(), c.length > 0)) b.featureNS = this.lookupNamespaceURI(a, c[0])
  9074. },
  9075. Title: function(a, b) {
  9076. var c = this.getChildValue(a);
  9077. if (c) b.title = c
  9078. },
  9079. Abstract: function(a, b) {
  9080. var c = this.getChildValue(a);
  9081. c && (b["abstract"] = c)
  9082. }
  9083. }
  9084. },
  9085. CLASS_NAME: "GeoGlobe.Format.WFSCapabilities.v1"
  9086. });
  9087. GeoGlobe.Format.WFSCapabilities.v1_0_0 = GeoGlobe.Class4OL(GeoGlobe.Format.WFSCapabilities.v1, {
  9088. readers: {
  9089. wfs: GeoGlobe.Util.applyDefaults({
  9090. Service: function(a, b) {
  9091. b.service = {};
  9092. this.readChildNodes(a, b.service)
  9093. },
  9094. Fees: function(a, b) {
  9095. var c = this.getChildValue(a);
  9096. if (c && c.toLowerCase() != "none") b.fees = c
  9097. },
  9098. AccessConstraints: function(a, b) {
  9099. var c = this.getChildValue(a);
  9100. if (c && c.toLowerCase() != "none") b.accessConstraints = c
  9101. },
  9102. OnlineResource: function(a, b) {
  9103. var c = this.getChildValue(a);
  9104. if (c && c.toLowerCase() != "none") b.onlineResource =
  9105. c
  9106. },
  9107. Keywords: function(a, b) {
  9108. var c = this.getChildValue(a);
  9109. if (c && c.toLowerCase() != "none") b.keywords = c.split(", ")
  9110. },
  9111. Capability: function(a, b) {
  9112. b.capability = {};
  9113. this.readChildNodes(a, b.capability)
  9114. },
  9115. Request: function(a, b) {
  9116. b.request = {};
  9117. this.readChildNodes(a, b.request)
  9118. },
  9119. GetFeature: function(a, b) {
  9120. b.getfeature = {
  9121. href: {},
  9122. formats: []
  9123. };
  9124. this.readChildNodes(a, b.getfeature)
  9125. },
  9126. ResultFormat: function(a, b) {
  9127. for (var c = a.childNodes, d, e = 0; e < c.length; e++) d = c[e], d.nodeType == 1 && b.formats.push(d.nodeName)
  9128. },
  9129. DCPType: function(a, b) {
  9130. this.readChildNodes(a,
  9131. b)
  9132. },
  9133. HTTP: function(a, b) {
  9134. this.readChildNodes(a, b.href)
  9135. },
  9136. Get: function(a, b) {
  9137. b.get = a.getAttribute("onlineResource")
  9138. },
  9139. Post: function(a, b) {
  9140. b.post = a.getAttribute("onlineResource")
  9141. },
  9142. SRS: function(a, b) {
  9143. var c = this.getChildValue(a);
  9144. if (c) b.srs = c
  9145. },
  9146. LatLongBoundingBox: function(a, b) {
  9147. var c = a.getAttribute("minx"),
  9148. d = a.getAttribute("miny"),
  9149. e = a.getAttribute("maxx"),
  9150. f = a.getAttribute("maxy");
  9151. b.bbox = c + "," + d + "," + e + "," + f
  9152. },
  9153. TemporalFeatureLayer: function(a, b) {
  9154. b.temporalFeatureLayers = [];
  9155. var c = {};
  9156. this.readChildNodes(a, c);
  9157. b.temporalFeatureLayers.push(c)
  9158. },
  9159. Extent: function(a, b) {
  9160. b.defaultTime = a.getAttribute("default");
  9161. var c = this.getChildValue(a).split("/");
  9162. b.time = c
  9163. },
  9164. Dimension: function(a, b) {
  9165. b.defaultTime = a.getAttribute("default");
  9166. var c = this.getChildValue(a).split("/");
  9167. b.time = c
  9168. }
  9169. }, GeoGlobe.Format.WFSCapabilities.v1.prototype.readers.wfs)
  9170. },
  9171. CLASS_NAME: "GeoGlobe.Format.WFSCapabilities.v1_0_0"
  9172. });
  9173. GeoGlobe.Format.WFSCapabilities.v1_1_0 = GeoGlobe.Class4OL(GeoGlobe.Format.WFSCapabilities.v1, {
  9174. regExes: {
  9175. trimSpace: /^\s*|\s*$/g,
  9176. removeSpace: /\s*/g,
  9177. splitSpace: /\s+/,
  9178. trimComma: /\s*,\s*/g
  9179. },
  9180. readers: {
  9181. wfs: GeoGlobe.Util.applyDefaults({
  9182. DefaultSRS: function(a, b) {
  9183. var c = this.getChildValue(a);
  9184. if (c) b.srs = c
  9185. },
  9186. WGS84BoundingBox: function(a, b) {
  9187. var c = this.getChildValue(a.getElementsByTagName("ows:LowerCorner")[0]).split(" "),
  9188. d = this.getChildValue(a.getElementsByTagName("ows:UpperCorner")[0]).split(" ");
  9189. b.bbox = c[0] + "," + c[1] +
  9190. "," + d[0] + "," + d[1]
  9191. },
  9192. TemporalFeatureLayer: function(a, b) {
  9193. b.temporalFeatureLayers = [];
  9194. var c = {};
  9195. this.readChildNodes(a, c);
  9196. b.temporalFeatureLayers.push(c)
  9197. },
  9198. Extent: function(a, b) {
  9199. b.defaultTime = a.getAttribute("default");
  9200. var c = this.getChildValue(a).split("/");
  9201. b.time = c
  9202. },
  9203. Dimension: function(a, b) {
  9204. b.defaultTime = a.getAttribute("default");
  9205. var c = this.getChildValue(a).split("/");
  9206. b.time = c
  9207. }
  9208. }, GeoGlobe.Format.WFSCapabilities.v1.prototype.readers.wfs),
  9209. ows: GeoGlobe.Format.OWSCommon.v1.prototype.readers.ows
  9210. },
  9211. CLASS_NAME: "GeoGlobe.Format.WFSCapabilities.v1_1_0"
  9212. });
  9213. GeoGlobe.Format.WFSDescribeFeatureType = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  9214. regExes: {
  9215. trimSpace: /^\s*|\s*$/g
  9216. },
  9217. namespaces: {
  9218. xsd: "http://www.w3.org/2001/XMLSchema"
  9219. },
  9220. readers: {
  9221. xsd: {
  9222. schema: function(a, b) {
  9223. var c = [],
  9224. d = {},
  9225. e, f;
  9226. this.readChildNodes(a, {
  9227. complexTypes: c,
  9228. customTypes: d
  9229. });
  9230. var g = a.attributes,
  9231. h, j;
  9232. e = 0;
  9233. for (f = g.length; e < f; ++e) h = g[e], j = h.name, j.indexOf("xmlns") === 0 ? this.setNamespace(j.split(":")[1] || "", h.value) : b[j] = h.value;
  9234. b.featureTypes = c;
  9235. b.targetPrefix = this.namespaceAlias[b.targetNamespace];
  9236. e = 0;
  9237. for (f = c.length; e <
  9238. f; ++e)
  9239. if (g = c[e], h = d[g.typeName], d[g.typeName]) g.typeName = h.name
  9240. },
  9241. complexType: function(a, b) {
  9242. var c = {
  9243. typeName: a.getAttribute("name")
  9244. };
  9245. this.readChildNodes(a, c);
  9246. b.complexTypes.push(c)
  9247. },
  9248. complexContent: function(a, b) {
  9249. this.readChildNodes(a, b)
  9250. },
  9251. extension: function(a, b) {
  9252. this.readChildNodes(a, b)
  9253. },
  9254. sequence: function(a, b) {
  9255. var c = {
  9256. elements: []
  9257. };
  9258. this.readChildNodes(a, c);
  9259. b.properties = c.elements
  9260. },
  9261. element: function(a, b) {
  9262. var c;
  9263. if (b.elements) {
  9264. var d = {};
  9265. c = a.attributes;
  9266. for (var e, f = 0, g = c.length; f < g; ++f) e = c[f], d[e.name] = e.value;
  9267. c = d.type || d.ref;
  9268. if (!c) c = {}, this.readChildNodes(a, c), d.restriction = c, d.type = c.base;
  9269. d.localType = (c.base || c).split(":").pop();
  9270. b.elements.push(d);
  9271. this.readChildNodes(a, d)
  9272. }
  9273. b.complexTypes && (c = a.getAttribute("type"), d = c.split(":").pop(), b.customTypes[d] = {
  9274. name: a.getAttribute("name"),
  9275. type: c
  9276. })
  9277. },
  9278. annotation: function(a, b) {
  9279. b.annotation = {};
  9280. this.readChildNodes(a, b.annotation)
  9281. },
  9282. appinfo: function(a, b) {
  9283. if (!b.appinfo) b.appinfo = [];
  9284. b.appinfo.push(this.getChildValue(a))
  9285. },
  9286. documentation: function(a, b) {
  9287. if (!b.documentation) b.documentation = [];
  9288. var c = this.getChildValue(a);
  9289. b.documentation.push({
  9290. lang: a.getAttribute("xml:lang"),
  9291. textContent: c.replace(this.regExes.trimSpace, "")
  9292. })
  9293. },
  9294. simpleType: function(a, b) {
  9295. this.readChildNodes(a, b)
  9296. },
  9297. restriction: function(a, b) {
  9298. b.base = a.getAttribute("base");
  9299. this.readRestriction(a, b)
  9300. }
  9301. }
  9302. },
  9303. readRestriction: function(a, b) {
  9304. for (var c = a.childNodes, d, e, f = 0, g = c.length; f < g; ++f) d = c[f], d.nodeType == 1 && (e = d.nodeName.split(":").pop(), d = d.getAttribute("value"), b[e] ? (typeof b[e] == "string" && (b[e] = [b[e]]), b[e].push(d)) : b[e] = d)
  9305. },
  9306. read: function(a) {
  9307. typeof a ==
  9308. "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  9309. if (a && a.nodeType == 9) a = a.documentElement;
  9310. var b = {};
  9311. if (a.nodeName.split(":").pop() === "ExceptionReport") {
  9312. var c = new GeoGlobe.Format.OGCExceptionReport;
  9313. b.error = c.read(a)
  9314. } else this.readNode(a, b);
  9315. return b
  9316. },
  9317. CLASS_NAME: "GeoGlobe.Format.WFSDescribeFeatureType"
  9318. });
  9319. GeoGlobe.Format.WKT = GeoGlobe.Class4OL(GeoGlobe.Format, {
  9320. initialize: function(a) {
  9321. this.regExes = {
  9322. typeStr: /^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,
  9323. spaces: /\s+/,
  9324. parenComma: /\)\s*,\s*\(/,
  9325. doubleParenComma: /\)\s*\)\s*,\s*\(\s*\(/,
  9326. trimParens: /^\s*\(?(.*?)\)?\s*$/
  9327. };
  9328. GeoGlobe.Format.prototype.initialize.apply(this, [a])
  9329. },
  9330. read: function(a) {
  9331. var b, c, a = a.replace(/[\n\r]/g, " ");
  9332. if (c = this.regExes.typeStr.exec(a))
  9333. if (a = c[1].toLowerCase(), c = c[2], this.parse[a] && (b = this.parse[a].apply(this, [c])), this.internalProjection && this.externalProjection)
  9334. if (b &&
  9335. b.CLASS_NAME == "GeoGlobe.Feature") b.geometry.transform(this.externalProjection, this.internalProjection);
  9336. else if (b && a != "geometrycollection" && typeof b == "object") {
  9337. a = 0;
  9338. for (c = b.length; a < c; a++) b[a].geometry.transform(this.externalProjection, this.internalProjection)
  9339. }
  9340. return b
  9341. },
  9342. write: function(a) {
  9343. var b, c;
  9344. a.constructor == Array ? c = !0 : (a = [a], c = !1);
  9345. var d = [];
  9346. c && d.push("GEOMETRYCOLLECTION(");
  9347. for (var e = 0, f = a.length; e < f; ++e) c && e > 0 && d.push(","), b = a[e].geometry, d.push(this.extractGeometry(b));
  9348. c && d.push(")");
  9349. return d.join("")
  9350. },
  9351. extractGeometry: function(a) {
  9352. var b = a.CLASS_NAME.split(".")[2].toLowerCase();
  9353. if (!this.extract[b]) return null;
  9354. this.internalProjection && this.externalProjection && (a = a.clone(), a.transform(this.internalProjection, this.externalProjection));
  9355. return (b == "collection" ? "GEOMETRYCOLLECTION" : b.toUpperCase()) + "(" + this.extract[b].apply(this, [a]) + ")"
  9356. },
  9357. extract: {
  9358. point: function(a) {
  9359. return a.x + " " + a.y
  9360. },
  9361. multipoint: function(a) {
  9362. for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push("(" + this.extract.point.apply(this, [a.components[c]]) +
  9363. ")");
  9364. return b.join(",")
  9365. },
  9366. linestring: function(a) {
  9367. for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push(this.extract.point.apply(this, [a.components[c]]));
  9368. return b.join(",")
  9369. },
  9370. multilinestring: function(a) {
  9371. for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push("(" + this.extract.linestring.apply(this, [a.components[c]]) + ")");
  9372. return b.join(",")
  9373. },
  9374. polygon: function(a) {
  9375. for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push("(" + this.extract.linestring.apply(this, [a.components[c]]) + ")");
  9376. return b.join(",")
  9377. },
  9378. multipolygon: function(a) {
  9379. for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push("(" + this.extract.polygon.apply(this, [a.components[c]]) + ")");
  9380. return b.join(",")
  9381. },
  9382. collection: function(a) {
  9383. for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push(this.extractGeometry.apply(this, [a.components[c]]));
  9384. return b.join(",")
  9385. }
  9386. },
  9387. parse: {
  9388. point: function(a) {
  9389. a = GeoGlobe.String.trim(a).split(this.regExes.spaces);
  9390. return new GeoGlobe.Feature(new GeoGlobe.Geometry.Point(a[0], a[1]))
  9391. },
  9392. multipoint: function(a) {
  9393. for (var b = GeoGlobe.String.trim(a).split(","), c = [], d = 0, e = b.length; d <
  9394. e; ++d) a = b[d].replace(this.regExes.trimParens, "$1"), c.push(this.parse.point.apply(this, [a]).geometry);
  9395. return new GeoGlobe.Feature(new GeoGlobe.Geometry.MultiPoint(c))
  9396. },
  9397. linestring: function(a) {
  9398. for (var a = GeoGlobe.String.trim(a).split(","), b = [], c = 0, d = a.length; c < d; ++c) b.push(this.parse.point.apply(this, [a[c]]).geometry);
  9399. return new GeoGlobe.Feature(new GeoGlobe.Geometry.LineString(b))
  9400. },
  9401. multilinestring: function(a) {
  9402. for (var b = GeoGlobe.String.trim(a).split(this.regExes.parenComma), c = [], d = 0, e = b.length; d < e; ++d) a =
  9403. b[d].replace(this.regExes.trimParens, "$1"), c.push(this.parse.linestring.apply(this, [a]).geometry);
  9404. return new GeoGlobe.Feature(new GeoGlobe.Geometry.MultiLineString(c))
  9405. },
  9406. polygon: function(a) {
  9407. for (var b, a = GeoGlobe.String.trim(a).split(this.regExes.parenComma), c = [], d = 0, e = a.length; d < e; ++d) b = a[d].replace(this.regExes.trimParens, "$1"), b = this.parse.linestring.apply(this, [b]).geometry, b = new GeoGlobe.Geometry.LinearRing(b.components), c.push(b);
  9408. return new GeoGlobe.Feature(new GeoGlobe.Geometry.Polygon(c))
  9409. },
  9410. multipolygon: function(a) {
  9411. for (var b =
  9412. GeoGlobe.String.trim(a).split(this.regExes.doubleParenComma), c = [], d = 0, e = b.length; d < e; ++d) a = b[d].replace(this.regExes.trimParens, "$1"), c.push(this.parse.polygon.apply(this, [a]).geometry);
  9413. return new GeoGlobe.Feature(new GeoGlobe.Geometry.MultiPolygon(c))
  9414. },
  9415. geometrycollection: function(a) {
  9416. for (var a = a.replace(/,\s*([A-Za-z])/g, "|$1"), a = GeoGlobe.String.trim(a).split("|"), b = [], c = 0, d = a.length; c < d; ++c) b.push(GeoGlobe.Format.WKT.prototype.read.apply(this, [a[c]]));
  9417. return b
  9418. }
  9419. },
  9420. CLASS_NAME: "GeoGlobe.Format.WKT"
  9421. });
  9422. GeoGlobe.Format.CQL = function() {
  9423. function a(a) {
  9424. function b() {
  9425. var a = e.pop();
  9426. switch (a.type) {
  9427. case "LOGICAL":
  9428. var c = b(),
  9429. g = b();
  9430. return new GeoGlobe.Filter.Logical({
  9431. filters: [g, c],
  9432. type: f[a.text.toUpperCase()]
  9433. });
  9434. case "NOT":
  9435. return a = b(), new GeoGlobe.Filter.Logical({
  9436. filters: [a],
  9437. type: GeoGlobe.Filter.Logical.NOT
  9438. });
  9439. case "BETWEEN":
  9440. return e.pop(), g = b(), a = b(), c = b(), new GeoGlobe.Filter.Comparison({
  9441. property: c,
  9442. lowerBoundary: a,
  9443. upperBoundary: g,
  9444. type: GeoGlobe.Filter.Comparison.BETWEEN
  9445. });
  9446. case "COMPARISON":
  9447. return g = b(), c = b(),
  9448. new GeoGlobe.Filter.Comparison({
  9449. property: c,
  9450. value: g,
  9451. type: d[a.text.toUpperCase()]
  9452. });
  9453. case "IS_NULL":
  9454. return c = b(), new GeoGlobe.Filter.Comparison({
  9455. property: c,
  9456. type: d[a.text.toUpperCase()]
  9457. });
  9458. case "VALUE":
  9459. return (c = a.text.match(/^'(.*)'$/)) ? c[1].replace(/''/g, "'") : Number(a.text);
  9460. case "SPATIAL":
  9461. switch (a.text.toUpperCase()) {
  9462. case "BBOX":
  9463. var a = b(),
  9464. c = b(),
  9465. g = b(),
  9466. h = b(),
  9467. j = b();
  9468. return new GeoGlobe.Filter.Spatial({
  9469. type: GeoGlobe.Filter.Spatial.BBOX,
  9470. property: j,
  9471. value: GeoGlobe.LngLatBounds.fromArray([h, g, c, a])
  9472. });
  9473. case "INTERSECTS":
  9474. return g =
  9475. b(), c = b(), new GeoGlobe.Filter.Spatial({
  9476. type: GeoGlobe.Filter.Spatial.INTERSECTS,
  9477. property: c,
  9478. value: g
  9479. });
  9480. case "WITHIN":
  9481. return g = b(), c = b(), new GeoGlobe.Filter.Spatial({
  9482. type: GeoGlobe.Filter.Spatial.WITHIN,
  9483. property: c,
  9484. value: g
  9485. });
  9486. case "CONTAINS":
  9487. return g = b(), c = b(), new GeoGlobe.Filter.Spatial({
  9488. type: GeoGlobe.Filter.Spatial.CONTAINS,
  9489. property: c,
  9490. value: g
  9491. });
  9492. case "DWITHIN":
  9493. return a = b(), g = b(), c = b(), new GeoGlobe.Filter.Spatial({
  9494. type: GeoGlobe.Filter.Spatial.DWITHIN,
  9495. value: g,
  9496. property: c,
  9497. distance: Number(a)
  9498. })
  9499. }
  9500. case "GEOMETRY":
  9501. return GeoGlobe.Geometry.fromWKT(a.text);
  9502. default:
  9503. return a.text
  9504. }
  9505. }
  9506. for (var c = [], e = []; a.length;) {
  9507. var g = a.shift();
  9508. switch (g.type) {
  9509. case "PROPERTY":
  9510. case "GEOMETRY":
  9511. case "VALUE":
  9512. e.push(g);
  9513. break;
  9514. case "COMPARISON":
  9515. case "BETWEEN":
  9516. case "IS_NULL":
  9517. case "LOGICAL":
  9518. for (var j = h[g.type]; c.length > 0 && h[c[c.length - 1].type] <= j;) e.push(c.pop());
  9519. c.push(g);
  9520. break;
  9521. case "SPATIAL":
  9522. case "NOT":
  9523. case "LPAREN":
  9524. c.push(g);
  9525. break;
  9526. case "RPAREN":
  9527. for (; c.length > 0 && c[c.length - 1].type != "LPAREN";) e.push(c.pop());
  9528. c.pop();
  9529. c.length > 0 && c[c.length - 1].type == "SPATIAL" && e.push(c.pop());
  9530. case "COMMA":
  9531. case "END":
  9532. break;
  9533. default:
  9534. throw Error("Unknown token type " + g.type);
  9535. }
  9536. }
  9537. for (; c.length > 0;) e.push(c.pop());
  9538. a = b();
  9539. if (e.length > 0) {
  9540. a = "Remaining tokens after building AST: \n";
  9541. for (c = e.length - 1; c >= 0; c--) a += e[c].type + ": " + e[c].text + "\n";
  9542. throw Error(a);
  9543. }
  9544. return a
  9545. }
  9546. var b = {
  9547. PROPERTY: /^[_a-zA-Z]\w*/,
  9548. COMPARISON: /^(=|<>|<=|<|>=|>|LIKE)/i,
  9549. IS_NULL: /^IS NULL/i,
  9550. COMMA: /^,/,
  9551. LOGICAL: /^(AND|OR)/i,
  9552. VALUE: /^('([^']|'')*'|\d+(\.\d*)?|\.\d+)/,
  9553. LPAREN: /^\(/,
  9554. RPAREN: /^\)/,
  9555. SPATIAL: /^(BBOX|INTERSECTS|DWITHIN|WITHIN|CONTAINS)/i,
  9556. NOT: /^NOT/i,
  9557. BETWEEN: /^BETWEEN/i,
  9558. GEOMETRY: function(a) {
  9559. var b = /^(POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)/.exec(a);
  9560. if (b) {
  9561. var c = a.length,
  9562. b = a.indexOf("(", b[0].length);
  9563. if (b > -1)
  9564. for (var d = 1; b < c && d > 0;) switch (b++, a.charAt(b)) {
  9565. case "(":
  9566. d++;
  9567. break;
  9568. case ")":
  9569. d--
  9570. }
  9571. return [a.substr(0, b + 1)]
  9572. }
  9573. },
  9574. END: /^$/
  9575. },
  9576. c = {
  9577. LPAREN: ["GEOMETRY", "SPATIAL", "PROPERTY", "VALUE", "LPAREN"],
  9578. RPAREN: ["NOT", "LOGICAL", "END", "RPAREN"],
  9579. PROPERTY: ["COMPARISON", "BETWEEN", "COMMA", "IS_NULL"],
  9580. BETWEEN: ["VALUE"],
  9581. IS_NULL: ["END"],
  9582. COMPARISON: ["VALUE"],
  9583. COMMA: ["GEOMETRY", "VALUE", "PROPERTY"],
  9584. VALUE: ["LOGICAL", "COMMA", "RPAREN", "END"],
  9585. SPATIAL: ["LPAREN"],
  9586. LOGICAL: ["NOT", "VALUE", "SPATIAL", "PROPERTY", "LPAREN"],
  9587. NOT: ["PROPERTY", "LPAREN"],
  9588. GEOMETRY: ["COMMA", "RPAREN"]
  9589. },
  9590. d = {
  9591. "=": GeoGlobe.Filter.Comparison.EQUAL_TO,
  9592. "<>": GeoGlobe.Filter.Comparison.NOT_EQUAL_TO,
  9593. "<": GeoGlobe.Filter.Comparison.LESS_THAN,
  9594. "<=": GeoGlobe.Filter.Comparison.LESS_THAN_OR_EQUAL_TO,
  9595. ">": GeoGlobe.Filter.Comparison.GREATER_THAN,
  9596. ">=": GeoGlobe.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
  9597. LIKE: GeoGlobe.Filter.Comparison.LIKE,
  9598. BETWEEN: GeoGlobe.Filter.Comparison.BETWEEN,
  9599. "IS NULL": GeoGlobe.Filter.Comparison.IS_NULL
  9600. },
  9601. e = {},
  9602. f = {
  9603. AND: GeoGlobe.Filter.Logical.AND,
  9604. OR: GeoGlobe.Filter.Logical.OR
  9605. },
  9606. g = {},
  9607. h = {
  9608. RPAREN: 3,
  9609. LOGICAL: 2,
  9610. COMPARISON: 1
  9611. },
  9612. j;
  9613. for (j in d) d.hasOwnProperty(j) && (e[d[j]] = j);
  9614. for (j in f) f.hasOwnProperty(j) && (g[f[j]] = j);
  9615. return GeoGlobe.Class4OL(GeoGlobe.Format, {
  9616. read: function(d) {
  9617. var e = d,
  9618. d = [],
  9619. f, g = ["NOT", "GEOMETRY", "SPATIAL", "PROPERTY", "LPAREN"];
  9620. do {
  9621. a: {
  9622. f = g;
  9623. for (var h = void 0, g = void 0, j = f.length, h = 0; h < j; h++) {
  9624. var g = f[h],
  9625. s = b[g] instanceof
  9626. RegExp ? b[g].exec(e) : (0, b[g])(e);
  9627. if (s) {
  9628. f = s[0];
  9629. e = e.substr(f.length).replace(/^\s*/, "");
  9630. f = {
  9631. type: g,
  9632. text: f,
  9633. remainder: e
  9634. };
  9635. break a
  9636. }
  9637. }
  9638. d = "ERROR: In parsing: [" + e + "], expected one of: ";
  9639. for (h = 0; h < j; h++) g = f[h],
  9640. d += "\n " + g + ": " + b[g];
  9641. throw Error(d);
  9642. }
  9643. e = f.remainder;g = c[f.type];
  9644. if (f.type != "END" && !g) throw Error("No follows list for " + f.type);d.push(f)
  9645. } while (f.type != "END");
  9646. d = a(d);
  9647. if (this.keepData) this.data = d;
  9648. return d
  9649. },
  9650. write: function(a) {
  9651. if (a instanceof GeoGlobe.Geometry) return a.toString();
  9652. switch (a.CLASS_NAME) {
  9653. case "GeoGlobe.Filter.Spatial":
  9654. switch (a.type) {
  9655. case GeoGlobe.Filter.Spatial.BBOX:
  9656. return "BBOX(" +
  9657. a.property + "," + a.value.toBBOX() + ")";
  9658. case GeoGlobe.Filter.Spatial.DWITHIN:
  9659. return "DWITHIN(" + a.property + ", " + this.write(a.value) + ", " + a.distance + ")";
  9660. case GeoGlobe.Filter.Spatial.WITHIN:
  9661. return "WITHIN(" + a.property + ", " + this.write(a.value) + ")";
  9662. case GeoGlobe.Filter.Spatial.INTERSECTS:
  9663. return "INTERSECTS(" + a.property + ", " + this.write(a.value) + ")";
  9664. case GeoGlobe.Filter.Spatial.CONTAINS:
  9665. return "CONTAINS(" + a.property + ", " + this.write(a.value) + ")";
  9666. default:
  9667. throw Error("Unknown spatial filter type: " + a.type);
  9668. }
  9669. case "GeoGlobe.Filter.Logical":
  9670. if (a.type ==
  9671. GeoGlobe.Filter.Logical.NOT) return "NOT (" + this.write(a.filters[0]) + ")";
  9672. else {
  9673. for (var b = "(", c = !0, d = 0; d < a.filters.length; d++) c ? c = !1 : b += ") " + g[a.type] + " (", b += this.write(a.filters[d]);
  9674. return b + ")"
  9675. }
  9676. case "GeoGlobe.Filter.Comparison":
  9677. return a.type == GeoGlobe.Filter.Comparison.BETWEEN ? a.property + " BETWEEN " + this.write(a.lowerBoundary) + " AND " + this.write(a.upperBoundary) : a.value !== null ? a.property + " " + e[a.type] + " " + this.write(a.value) : a.property + " " + e[a.type];
  9678. case void 0:
  9679. if (typeof a === "string") return "'" + a.replace(/'/g,
  9680. "''") + "'";
  9681. else if (typeof a === "number") return String(a);
  9682. default:
  9683. throw Error("Can't encode: " + a.CLASS_NAME + " " + a);
  9684. }
  9685. },
  9686. CLASS_NAME: "GeoGlobe.Format.CQL"
  9687. })
  9688. }();
  9689. GeoGlobe.Format.Filter = GeoGlobe.Class4OL(GeoGlobe.Format.XML.VersionedOGC, {
  9690. defaultVersion: "1.0.0",
  9691. CLASS_NAME: "GeoGlobe.Format.Filter"
  9692. });
  9693. GeoGlobe.Format.Filter.v1 = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  9694. namespaces: {
  9695. ogc: "http://www.opengis.net/ogc",
  9696. gml: "http://www.opengis.net/gml",
  9697. xlink: "http://www.w3.org/1999/xlink",
  9698. xsi: "http://www.w3.org/2001/XMLSchema-instance"
  9699. },
  9700. defaultPrefix: "ogc",
  9701. schemaLocation: null,
  9702. initialize: function(a) {
  9703. GeoGlobe.Format.XML.prototype.initialize.apply(this, [a])
  9704. },
  9705. read: function(a) {
  9706. var b = {};
  9707. this.readers.ogc.Filter.apply(this, [a, b]);
  9708. return b.filter
  9709. },
  9710. readers: {
  9711. ogc: {
  9712. _expression: function(a) {
  9713. for (var b = "", c = a.firstChild; c; c =
  9714. c.nextSibling) switch (c.nodeType) {
  9715. case 1:
  9716. a = this.readNode(c);
  9717. a.property ? b += "${" + a.property + "}" : a.value !== void 0 && (b += a.value);
  9718. break;
  9719. case 3:
  9720. case 4:
  9721. b += c.nodeValue
  9722. }
  9723. return b
  9724. },
  9725. Filter: function(a, b) {
  9726. var c = {
  9727. fids: [],
  9728. filters: []
  9729. };
  9730. this.readChildNodes(a, c);
  9731. if (c.fids.length > 0) b.filter = new GeoGlobe.Filter.FeatureId({
  9732. fids: c.fids
  9733. });
  9734. else if (c.filters.length > 0) b.filter = c.filters[0]
  9735. },
  9736. FeatureId: function(a, b) {
  9737. var c = a.getAttribute("fid");
  9738. c && b.fids.push(c)
  9739. },
  9740. And: function(a, b) {
  9741. var c = new GeoGlobe.Filter.Logical({
  9742. type: GeoGlobe.Filter.Logical.AND
  9743. });
  9744. this.readChildNodes(a, c);
  9745. b.filters.push(c)
  9746. },
  9747. Or: function(a, b) {
  9748. var c = new GeoGlobe.Filter.Logical({
  9749. type: GeoGlobe.Filter.Logical.OR
  9750. });
  9751. this.readChildNodes(a, c);
  9752. b.filters.push(c)
  9753. },
  9754. Not: function(a, b) {
  9755. var c = new GeoGlobe.Filter.Logical({
  9756. type: GeoGlobe.Filter.Logical.NOT
  9757. });
  9758. this.readChildNodes(a, c);
  9759. b.filters.push(c)
  9760. },
  9761. PropertyIsLessThan: function(a, b) {
  9762. var c = new GeoGlobe.Filter.Comparison({
  9763. type: GeoGlobe.Filter.Comparison.LESS_THAN
  9764. });
  9765. this.readChildNodes(a, c);
  9766. b.filters.push(c)
  9767. },
  9768. PropertyIsGreaterThan: function(a, b) {
  9769. var c =
  9770. new GeoGlobe.Filter.Comparison({
  9771. type: GeoGlobe.Filter.Comparison.GREATER_THAN
  9772. });
  9773. this.readChildNodes(a, c);
  9774. b.filters.push(c)
  9775. },
  9776. PropertyIsLessThanOrEqualTo: function(a, b) {
  9777. var c = new GeoGlobe.Filter.Comparison({
  9778. type: GeoGlobe.Filter.Comparison.LESS_THAN_OR_EQUAL_TO
  9779. });
  9780. this.readChildNodes(a, c);
  9781. b.filters.push(c)
  9782. },
  9783. PropertyIsGreaterThanOrEqualTo: function(a, b) {
  9784. var c = new GeoGlobe.Filter.Comparison({
  9785. type: GeoGlobe.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO
  9786. });
  9787. this.readChildNodes(a, c);
  9788. b.filters.push(c)
  9789. },
  9790. PropertyIsBetween: function(a,
  9791. b) {
  9792. var c = new GeoGlobe.Filter.Comparison({
  9793. type: GeoGlobe.Filter.Comparison.BETWEEN
  9794. });
  9795. this.readChildNodes(a, c);
  9796. b.filters.push(c)
  9797. },
  9798. Literal: function(a, b) {
  9799. b.value = GeoGlobe.String.numericIf(this.getChildValue(a), !0)
  9800. },
  9801. PropertyName: function(a, b) {
  9802. b.property = this.getChildValue(a)
  9803. },
  9804. LowerBoundary: function(a, b) {
  9805. b.lowerBoundary = GeoGlobe.String.numericIf(this.readers.ogc._expression.call(this, a), !0)
  9806. },
  9807. UpperBoundary: function(a, b) {
  9808. b.upperBoundary = GeoGlobe.String.numericIf(this.readers.ogc._expression.call(this, a), !0)
  9809. },
  9810. Intersects: function(a, b) {
  9811. this.readSpatial(a, b, GeoGlobe.Filter.Spatial.INTERSECTS)
  9812. },
  9813. Within: function(a, b) {
  9814. this.readSpatial(a, b, GeoGlobe.Filter.Spatial.WITHIN)
  9815. },
  9816. Contains: function(a, b) {
  9817. this.readSpatial(a, b, GeoGlobe.Filter.Spatial.CONTAINS)
  9818. },
  9819. DWithin: function(a, b) {
  9820. this.readSpatial(a, b, GeoGlobe.Filter.Spatial.DWITHIN)
  9821. },
  9822. Distance: function(a, b) {
  9823. b.distance = parseInt(this.getChildValue(a));
  9824. b.distanceUnits = a.getAttribute("units")
  9825. },
  9826. Function: function() {},
  9827. PropertyIsNull: function(a, b) {
  9828. var c = new GeoGlobe.Filter.Comparison({
  9829. type: GeoGlobe.Filter.Comparison.IS_NULL
  9830. });
  9831. this.readChildNodes(a, c);
  9832. b.filters.push(c)
  9833. }
  9834. }
  9835. },
  9836. readSpatial: function(a, b, c) {
  9837. c = new GeoGlobe.Filter.Spatial({
  9838. type: c
  9839. });
  9840. this.readChildNodes(a, c);
  9841. c.value = c.components[0];
  9842. delete c.components;
  9843. b.filters.push(c)
  9844. },
  9845. encodeLiteral: function(a) {
  9846. a instanceof Date && (a = GeoGlobe.Date.toISOString(a));
  9847. return a
  9848. },
  9849. writeOgcExpression: function(a, b) {
  9850. a instanceof GeoGlobe.Filter.Function ? this.writeNode("Function", a, b) : this.writeNode("Literal", a, b);
  9851. return b
  9852. },
  9853. write: function(a) {
  9854. return this.writers.ogc.Filter.apply(this, [a])
  9855. },
  9856. writers: {
  9857. ogc: {
  9858. Filter: function(a) {
  9859. var b =
  9860. this.createElementNSPlus("ogc:Filter");
  9861. this.writeNode(this.getFilterType(a), a, b);
  9862. return b
  9863. },
  9864. _featureIds: function(a) {
  9865. for (var b = this.createDocumentFragment(), c = 0, d = a.fids.length; c < d; ++c) this.writeNode("ogc:FeatureId", a.fids[c], b);
  9866. return b
  9867. },
  9868. FeatureId: function(a) {
  9869. return this.createElementNSPlus("ogc:FeatureId", {
  9870. attributes: {
  9871. fid: a
  9872. }
  9873. })
  9874. },
  9875. And: function(a) {
  9876. for (var b = this.createElementNSPlus("ogc:And"), c, d = 0, e = a.filters.length; d < e; ++d) c = a.filters[d], this.writeNode(this.getFilterType(c), c, b);
  9877. return b
  9878. },
  9879. Or: function(a) {
  9880. for (var b =
  9881. this.createElementNSPlus("ogc:Or"), c, d = 0, e = a.filters.length; d < e; ++d) c = a.filters[d], this.writeNode(this.getFilterType(c), c, b);
  9882. return b
  9883. },
  9884. Not: function(a) {
  9885. var b = this.createElementNSPlus("ogc:Not"),
  9886. a = a.filters[0];
  9887. this.writeNode(this.getFilterType(a), a, b);
  9888. return b
  9889. },
  9890. PropertyIsLessThan: function(a) {
  9891. var b = this.createElementNSPlus("ogc:PropertyIsLessThan");
  9892. this.writeNode("PropertyName", a, b);
  9893. this.writeOgcExpression(a.value, b);
  9894. return b
  9895. },
  9896. PropertyIsGreaterThan: function(a) {
  9897. var b = this.createElementNSPlus("ogc:PropertyIsGreaterThan");
  9898. this.writeNode("PropertyName", a, b);
  9899. this.writeOgcExpression(a.value, b);
  9900. return b
  9901. },
  9902. PropertyIsLessThanOrEqualTo: function(a) {
  9903. var b = this.createElementNSPlus("ogc:PropertyIsLessThanOrEqualTo");
  9904. this.writeNode("PropertyName", a, b);
  9905. this.writeOgcExpression(a.value, b);
  9906. return b
  9907. },
  9908. PropertyIsGreaterThanOrEqualTo: function(a) {
  9909. var b = this.createElementNSPlus("ogc:PropertyIsGreaterThanOrEqualTo");
  9910. this.writeNode("PropertyName", a, b);
  9911. this.writeOgcExpression(a.value, b);
  9912. return b
  9913. },
  9914. PropertyIsBetween: function(a) {
  9915. var b = this.createElementNSPlus("ogc:PropertyIsBetween");
  9916. this.writeNode("PropertyName", a, b);
  9917. this.writeNode("LowerBoundary", a, b);
  9918. this.writeNode("UpperBoundary", a, b);
  9919. return b
  9920. },
  9921. PropertyName: function(a) {
  9922. return this.createElementNSPlus("ogc:PropertyName", {
  9923. value: a.property
  9924. })
  9925. },
  9926. Literal: function(a) {
  9927. return this.createElementNSPlus("ogc:Literal", {
  9928. value: (this.encodeLiteral || GeoGlobe.Format.Filter.v1.prototype.encodeLiteral)(a)
  9929. })
  9930. },
  9931. LowerBoundary: function(a) {
  9932. var b = this.createElementNSPlus("ogc:LowerBoundary");
  9933. this.writeOgcExpression(a.lowerBoundary, b);
  9934. return b
  9935. },
  9936. UpperBoundary: function(a) {
  9937. var b =
  9938. this.createElementNSPlus("ogc:UpperBoundary");
  9939. this.writeNode("Literal", a.upperBoundary, b);
  9940. return b
  9941. },
  9942. INTERSECTS: function(a) {
  9943. return this.writeSpatial(a, "Intersects")
  9944. },
  9945. WITHIN: function(a) {
  9946. return this.writeSpatial(a, "Within")
  9947. },
  9948. CONTAINS: function(a) {
  9949. return this.writeSpatial(a, "Contains")
  9950. },
  9951. DWITHIN: function(a) {
  9952. var b = this.writeSpatial(a, "DWithin");
  9953. this.writeNode("Distance", a, b);
  9954. return b
  9955. },
  9956. Distance: function(a) {
  9957. return this.createElementNSPlus("ogc:Distance", {
  9958. attributes: {
  9959. units: a.distanceUnits
  9960. },
  9961. value: a.distance
  9962. })
  9963. },
  9964. Function: function(a) {
  9965. for (var b = this.createElementNSPlus("ogc:Function", {
  9966. attributes: {
  9967. name: a.name
  9968. }
  9969. }), a = a.params, c = 0, d = a.length; c < d; c++) this.writeOgcExpression(a[c], b);
  9970. return b
  9971. },
  9972. PropertyIsNull: function(a) {
  9973. var b = this.createElementNSPlus("ogc:PropertyIsNull");
  9974. this.writeNode("PropertyName", a, b);
  9975. return b
  9976. },
  9977. SortBy: function(a) {
  9978. for (var b = this.createElementNSPlus("ogc:SortBy"), c = 0, d = a.length; c < d; c++) this.writeNode("ogc:SortProperty", a[c], b);
  9979. return b
  9980. },
  9981. SortProperty: function(a) {
  9982. var b = this.createElementNSPlus("ogc:SortProperty");
  9983. this.writeNode("ogc:PropertyName", a, b);
  9984. this.writeNode("ogc:SortOrder", a.order == "DESC" ? "DESC" : "ASC", b);
  9985. return b
  9986. },
  9987. SortOrder: function(a) {
  9988. return this.createElementNSPlus("ogc:SortOrder", {
  9989. value: a
  9990. })
  9991. }
  9992. }
  9993. },
  9994. getFilterType: function(a) {
  9995. var b = this.filterMap[a.type];
  9996. if (!b) throw "Filter writing not supported for rule type: " + a.type;
  9997. return b
  9998. },
  9999. filterMap: {
  10000. "&&": "And",
  10001. "||": "Or",
  10002. "!": "Not",
  10003. "==": "PropertyIsEqualTo",
  10004. "!=": "PropertyIsNotEqualTo",
  10005. "<": "PropertyIsLessThan",
  10006. ">": "PropertyIsGreaterThan",
  10007. "<=": "PropertyIsLessThanOrEqualTo",
  10008. ">=": "PropertyIsGreaterThanOrEqualTo",
  10009. "..": "PropertyIsBetween",
  10010. "~": "PropertyIsLike",
  10011. NULL: "PropertyIsNull",
  10012. BBOX: "BBOX",
  10013. DWITHIN: "DWITHIN",
  10014. WITHIN: "WITHIN",
  10015. CONTAINS: "CONTAINS",
  10016. INTERSECTS: "INTERSECTS",
  10017. FID: "_featureIds"
  10018. },
  10019. CLASS_NAME: "GeoGlobe.Format.Filter.v1"
  10020. });
  10021. GeoGlobe.Format.Filter.v1_0_0 = GeoGlobe.Class4OL(GeoGlobe.Format.GML.v2, GeoGlobe.Format.Filter.v1, {
  10022. VERSION: "1.0.0",
  10023. schemaLocation: "http://www.opengis.net/ogc/filter/1.0.0/filter.xsd",
  10024. initialize: function(a) {
  10025. GeoGlobe.Format.GML.v2.prototype.initialize.apply(this, [a])
  10026. },
  10027. readers: {
  10028. ogc: GeoGlobe.Util.applyDefaults({
  10029. PropertyIsEqualTo: function(a, b) {
  10030. var c = new GeoGlobe.Filter.Comparison({
  10031. type: GeoGlobe.Filter.Comparison.EQUAL_TO
  10032. });
  10033. this.readChildNodes(a, c);
  10034. b.filters.push(c)
  10035. },
  10036. PropertyIsNotEqualTo: function(a, b) {
  10037. var c =
  10038. new GeoGlobe.Filter.Comparison({
  10039. type: GeoGlobe.Filter.Comparison.NOT_EQUAL_TO
  10040. });
  10041. this.readChildNodes(a, c);
  10042. b.filters.push(c)
  10043. },
  10044. PropertyIsLike: function(a, b) {
  10045. var c = new GeoGlobe.Filter.Comparison({
  10046. type: GeoGlobe.Filter.Comparison.LIKE
  10047. });
  10048. this.readChildNodes(a, c);
  10049. var d = a.getAttribute("wildCard"),
  10050. e = a.getAttribute("singleChar"),
  10051. f = a.getAttribute("escape");
  10052. c.value2regex(d, e, f);
  10053. b.filters.push(c)
  10054. }
  10055. }, GeoGlobe.Format.Filter.v1.prototype.readers.ogc),
  10056. gml: GeoGlobe.Format.GML.v2.prototype.readers.gml,
  10057. feature: GeoGlobe.Format.GML.v2.prototype.readers.feature
  10058. },
  10059. writers: {
  10060. ogc: GeoGlobe.Util.applyDefaults({
  10061. PropertyIsEqualTo: function(a) {
  10062. var b = this.createElementNSPlus("ogc:PropertyIsEqualTo");
  10063. this.writeNode("PropertyName", a, b);
  10064. this.writeOgcExpression(a.value, b);
  10065. return b
  10066. },
  10067. PropertyIsNotEqualTo: function(a) {
  10068. var b = this.createElementNSPlus("ogc:PropertyIsNotEqualTo");
  10069. this.writeNode("PropertyName", a, b);
  10070. this.writeOgcExpression(a.value, b);
  10071. return b
  10072. },
  10073. PropertyIsLike: function(a) {
  10074. var b = this.createElementNSPlus("ogc:PropertyIsLike", {
  10075. attributes: {
  10076. wildCard: "*",
  10077. singleChar: ".",
  10078. escape: "!"
  10079. }
  10080. });
  10081. this.writeNode("PropertyName", a, b);
  10082. this.writeNode("Literal", a.regex2value(), b);
  10083. return b
  10084. },
  10085. BBOX: function(a) {
  10086. var b = this.createElementNSPlus("ogc:BBOX");
  10087. a.property && this.writeNode("PropertyName", a, b);
  10088. var c = this.writeNode("gml:Box", a.value, b);
  10089. a.projection && c.setAttribute("srsName", a.projection);
  10090. return b
  10091. }
  10092. }, GeoGlobe.Format.Filter.v1.prototype.writers.ogc),
  10093. gml: GeoGlobe.Format.GML.v2.prototype.writers.gml,
  10094. feature: GeoGlobe.Format.GML.v2.prototype.writers.feature
  10095. },
  10096. writeSpatial: function(a, b) {
  10097. var c = this.createElementNSPlus("ogc:" +
  10098. b);
  10099. this.writeNode("PropertyName", a, c);
  10100. if (a.value instanceof GeoGlobe.Filter.Function) this.writeNode("Function", a.value, c);
  10101. else {
  10102. var d;
  10103. d = a.value instanceof GeoGlobe.Geometry ? this.writeNode("feature:_geometry", a.value).firstChild : this.writeNode("gml:Box", a.value);
  10104. a.projection && d.setAttribute("srsName", a.projection);
  10105. c.appendChild(d)
  10106. }
  10107. return c
  10108. },
  10109. CLASS_NAME: "GeoGlobe.Format.Filter.v1_0_0"
  10110. });
  10111. GeoGlobe.Format.Filter.v1_1_0 = GeoGlobe.Class4OL(GeoGlobe.Format.GML.v3, GeoGlobe.Format.Filter.v1, {
  10112. VERSION: "1.1.0",
  10113. schemaLocation: "http://www.opengis.net/ogc/filter/1.1.0/filter.xsd",
  10114. initialize: function(a) {
  10115. GeoGlobe.Format.GML.v3.prototype.initialize.apply(this, [a])
  10116. },
  10117. readers: {
  10118. ogc: GeoGlobe.Util.applyDefaults({
  10119. PropertyIsEqualTo: function(a, b) {
  10120. var c = a.getAttribute("matchCase"),
  10121. c = new GeoGlobe.Filter.Comparison({
  10122. type: GeoGlobe.Filter.Comparison.EQUAL_TO,
  10123. matchCase: !(c === "false" || c === "0")
  10124. });
  10125. this.readChildNodes(a,
  10126. c);
  10127. b.filters.push(c)
  10128. },
  10129. PropertyIsNotEqualTo: function(a, b) {
  10130. var c = a.getAttribute("matchCase"),
  10131. c = new GeoGlobe.Filter.Comparison({
  10132. type: GeoGlobe.Filter.Comparison.NOT_EQUAL_TO,
  10133. matchCase: !(c === "false" || c === "0")
  10134. });
  10135. this.readChildNodes(a, c);
  10136. b.filters.push(c)
  10137. },
  10138. PropertyIsLike: function(a, b) {
  10139. var c = new GeoGlobe.Filter.Comparison({
  10140. type: GeoGlobe.Filter.Comparison.LIKE
  10141. });
  10142. this.readChildNodes(a, c);
  10143. var d = a.getAttribute("wildCard"),
  10144. e = a.getAttribute("singleChar"),
  10145. f = a.getAttribute("escapeChar");
  10146. c.value2regex(d, e, f);
  10147. b.filters.push(c)
  10148. }
  10149. },
  10150. GeoGlobe.Format.Filter.v1.prototype.readers.ogc),
  10151. gml: GeoGlobe.Format.GML.v3.prototype.readers.gml,
  10152. feature: GeoGlobe.Format.GML.v3.prototype.readers.feature
  10153. },
  10154. writers: {
  10155. ogc: GeoGlobe.Util.applyDefaults({
  10156. PropertyIsEqualTo: function(a) {
  10157. var b = this.createElementNSPlus("ogc:PropertyIsEqualTo", {
  10158. attributes: {
  10159. matchCase: a.matchCase
  10160. }
  10161. });
  10162. this.writeNode("PropertyName", a, b);
  10163. this.writeOgcExpression(a.value, b);
  10164. return b
  10165. },
  10166. PropertyIsNotEqualTo: function(a) {
  10167. var b = this.createElementNSPlus("ogc:PropertyIsNotEqualTo", {
  10168. attributes: {
  10169. matchCase: a.matchCase
  10170. }
  10171. });
  10172. this.writeNode("PropertyName", a, b);
  10173. this.writeOgcExpression(a.value, b);
  10174. return b
  10175. },
  10176. PropertyIsLike: function(a) {
  10177. var b = this.createElementNSPlus("ogc:PropertyIsLike", {
  10178. attributes: {
  10179. matchCase: a.matchCase,
  10180. wildCard: "*",
  10181. singleChar: ".",
  10182. escapeChar: "!"
  10183. }
  10184. });
  10185. this.writeNode("PropertyName", a, b);
  10186. this.writeNode("Literal", a.regex2value(), b);
  10187. return b
  10188. },
  10189. BBOX: function(a) {
  10190. var b = this.createElementNSPlus("ogc:BBOX");
  10191. a.property && this.writeNode("PropertyName", a, b);
  10192. var c = this.writeNode("gml:Envelope", a.value);
  10193. a.projection && c.setAttribute("srsName",
  10194. a.projection);
  10195. b.appendChild(c);
  10196. return b
  10197. },
  10198. SortBy: function(a) {
  10199. for (var b = this.createElementNSPlus("ogc:SortBy"), c = 0, d = a.length; c < d; c++) this.writeNode("ogc:SortProperty", a[c], b);
  10200. return b
  10201. },
  10202. SortProperty: function(a) {
  10203. var b = this.createElementNSPlus("ogc:SortProperty");
  10204. this.writeNode("ogc:PropertyName", a, b);
  10205. this.writeNode("ogc:SortOrder", a.order == "DESC" ? "DESC" : "ASC", b);
  10206. return b
  10207. },
  10208. SortOrder: function(a) {
  10209. return this.createElementNSPlus("ogc:SortOrder", {
  10210. value: a
  10211. })
  10212. }
  10213. }, GeoGlobe.Format.Filter.v1.prototype.writers.ogc),
  10214. gml: GeoGlobe.Format.GML.v3.prototype.writers.gml,
  10215. feature: GeoGlobe.Format.GML.v3.prototype.writers.feature
  10216. },
  10217. writeSpatial: function(a, b) {
  10218. var c = this.createElementNSPlus("ogc:" + b);
  10219. this.writeNode("PropertyName", a, c);
  10220. if (a.value instanceof GeoGlobe.Filter.Function) this.writeNode("Function", a.value, c);
  10221. else {
  10222. var d;
  10223. d = a.value instanceof GeoGlobe.Geometry ? this.writeNode("feature:_geometry", a.value).firstChild : this.writeNode("gml:Envelope", a.value);
  10224. a.projection && d.setAttribute("srsName", a.projection);
  10225. c.appendChild(d)
  10226. }
  10227. return c
  10228. },
  10229. CLASS_NAME: "GeoGlobe.Format.Filter.v1_1_0"
  10230. });
  10231. GeoGlobe.Format.WFST = function(a) {
  10232. var a = GeoGlobe.Util.applyDefaults(a, GeoGlobe.Format.WFST.DEFAULTS),
  10233. b = GeoGlobe.Format.WFST["v" + a.version.replace(/\./g, "_")];
  10234. if (!b) throw "Unsupported WFST version: " + a.version;
  10235. return new b(a)
  10236. };
  10237. GeoGlobe.Format.WFST.DEFAULTS = {
  10238. version: "1.0.0"
  10239. };
  10240. GeoGlobe.Format.WFST.v1 = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  10241. namespaces: {
  10242. xlink: "http://www.w3.org/1999/xlink",
  10243. xsi: "http://www.w3.org/2001/XMLSchema-instance",
  10244. wfs: "http://www.opengis.net/wfs",
  10245. gml: "http://www.opengis.net/gml",
  10246. ogc: "http://www.opengis.net/ogc",
  10247. ows: "http://www.opengis.net/ows"
  10248. },
  10249. defaultPrefix: "wfs",
  10250. version: null,
  10251. schemaLocations: null,
  10252. srsName: null,
  10253. extractAttributes: !0,
  10254. xy: !0,
  10255. stateName: null,
  10256. initialize: function(a) {
  10257. this.stateName = {};
  10258. this.stateName[GeoGlobe.State.INSERT] = "wfs:Insert";
  10259. this.stateName[GeoGlobe.State.UPDATE] =
  10260. "wfs:Update";
  10261. this.stateName[GeoGlobe.State.DELETE] = "wfs:Delete";
  10262. GeoGlobe.Format.XML.prototype.initialize.apply(this, [a])
  10263. },
  10264. getSrsName: function(a, b) {
  10265. var c = b && b.srsName;
  10266. c || (c = a && a.layer ? a.layer.projection.getCode() : this.srsName);
  10267. return c
  10268. },
  10269. read: function(a, b) {
  10270. b = b || {};
  10271. GeoGlobe.Util.applyDefaults(b, {
  10272. output: "features"
  10273. });
  10274. typeof a == "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  10275. if (a && a.nodeType == 9) a = a.documentElement;
  10276. var c = {};
  10277. a && this.readNode(a, c, !0);
  10278. if (c.features && b.output === "features") c =
  10279. c.features;
  10280. return c
  10281. },
  10282. readers: {
  10283. wfs: {
  10284. FeatureCollection: function(a, b) {
  10285. b.features = [];
  10286. this.readChildNodes(a, b)
  10287. }
  10288. }
  10289. },
  10290. write: function(a, b) {
  10291. var c = this.writeNode("wfs:Transaction", {
  10292. features: a,
  10293. options: b
  10294. }),
  10295. d = this.schemaLocationAttr();
  10296. d && this.setAttributeNS(c, this.namespaces.xsi, "xsi:schemaLocation", d);
  10297. return GeoGlobe.Format.XML.prototype.write.apply(this, [c])
  10298. },
  10299. writers: {
  10300. wfs: {
  10301. GetFeature: function(a) {
  10302. var b = this.createElementNSPlus("wfs:GetFeature", {
  10303. attributes: {
  10304. service: "WFS",
  10305. version: this.version,
  10306. outputFormat: a && a.outputFormat,
  10307. maxFeatures: a && a.maxFeatures,
  10308. resultType: a && a.resultType,
  10309. startPosition: a && a.startPosition,
  10310. "xsi:schemaLocation": this.schemaLocationAttr(a)
  10311. }
  10312. });
  10313. if (typeof this.featureType == "string") this.writeNode("Query", a, b);
  10314. else
  10315. for (var c = 0, d = this.featureType.length; c < d; c++) a.featureType = this.featureType[c], this.writeNode("Query", a, b);
  10316. return b
  10317. },
  10318. Transaction: function(a) {
  10319. var a = a || {},
  10320. b = a.options || {},
  10321. c = this.createElementNSPlus("wfs:Transaction", {
  10322. attributes: {
  10323. service: "WFS",
  10324. version: this.version,
  10325. handle: b.handle
  10326. }
  10327. }),
  10328. d, e = a.features;
  10329. if (e) {
  10330. b.multi === !0 && GeoGlobe.Util.extend(this.geometryTypes, {
  10331. "GeoGlobe.Geometry.Point": "MultiPoint",
  10332. "GeoGlobe.Geometry.LineString": this.multiCurve === !0 ? "MultiCurve" : "MultiLineString",
  10333. "GeoGlobe.Geometry.Polygon": this.multiSurface === !0 ? "MultiSurface" : "MultiPolygon"
  10334. });
  10335. var f, g, a = 0;
  10336. for (d = e.length; a < d; ++a) g = e[a], (f = this.stateName[g.state]) && this.writeNode(f, {
  10337. feature: g,
  10338. options: b
  10339. }, c);
  10340. b.multi === !0 && this.setGeometryTypes()
  10341. }
  10342. if (b.nativeElements) {
  10343. a = 0;
  10344. for (d = b.nativeElements.length; a < d; ++a) this.writeNode("wfs:Native",
  10345. b.nativeElements[a], c)
  10346. }
  10347. return c
  10348. },
  10349. Native: function(a) {
  10350. return this.createElementNSPlus("wfs:Native", {
  10351. attributes: {
  10352. vendorId: a.vendorId,
  10353. safeToIgnore: a.safeToIgnore
  10354. },
  10355. value: a.value
  10356. })
  10357. },
  10358. Insert: function(a) {
  10359. var b = a.feature,
  10360. a = a.options,
  10361. a = this.createElementNSPlus("wfs:Insert", {
  10362. attributes: {
  10363. handle: a && a.handle
  10364. }
  10365. });
  10366. this.srsName = this.getSrsName(b);
  10367. this.writeNode("feature:_typeName", b, a);
  10368. return a
  10369. },
  10370. Update: function(a) {
  10371. var b = a.feature,
  10372. a = a.options,
  10373. a = this.createElementNSPlus("wfs:Update", {
  10374. attributes: {
  10375. handle: a && a.handle,
  10376. typeName: (this.featureNS ?
  10377. this.featurePrefix + ":" : "") + this.featureType
  10378. }
  10379. });
  10380. this.featureNS && a.setAttribute("xmlns:" + this.featurePrefix, this.featureNS);
  10381. var c = b.modified;
  10382. if (this.geometryName !== null && (!c || c.geometry !== void 0)) this.srsName = this.getSrsName(b), this.writeNode("Property", {
  10383. name: this.geometryName,
  10384. value: b.geometry
  10385. }, a);
  10386. for (var d in b.attributes) b.attributes[d] !== void 0 && (!c || !c.attributes || c.attributes && c.attributes[d] !== void 0) && this.writeNode("Property", {
  10387. name: d,
  10388. value: b.attributes[d]
  10389. }, a);
  10390. this.writeNode("ogc:Filter", new GeoGlobe.Filter.FeatureId({
  10391. fids: [b.fid]
  10392. }),
  10393. a);
  10394. return a
  10395. },
  10396. Property: function(a) {
  10397. var b = this.createElementNSPlus("wfs:Property");
  10398. this.writeNode("Name", a.name, b);
  10399. a.value !== null && this.writeNode("Value", a.value, b);
  10400. return b
  10401. },
  10402. Name: function(a) {
  10403. return this.createElementNSPlus("wfs:Name", {
  10404. value: a
  10405. })
  10406. },
  10407. Value: function(a) {
  10408. var b;
  10409. a instanceof GeoGlobe.Geometry ? (b = this.createElementNSPlus("wfs:Value"), a = this.writeNode("feature:_geometry", a).firstChild, b.appendChild(a)) : b = this.createElementNSPlus("wfs:Value", {
  10410. value: a
  10411. });
  10412. return b
  10413. },
  10414. Delete: function(a) {
  10415. var b = a.feature,
  10416. a = a.options,
  10417. a = this.createElementNSPlus("wfs:Delete", {
  10418. attributes: {
  10419. handle: a && a.handle,
  10420. typeName: (this.featureNS ? this.featurePrefix + ":" : "") + this.featureType
  10421. }
  10422. });
  10423. this.featureNS && a.setAttribute("xmlns:" + this.featurePrefix, this.featureNS);
  10424. this.writeNode("ogc:Filter", new GeoGlobe.Filter.FeatureId({
  10425. fids: [b.fid]
  10426. }), a);
  10427. return a
  10428. }
  10429. }
  10430. },
  10431. schemaLocationAttr: function(a) {
  10432. var a = GeoGlobe.Util.extend({
  10433. featurePrefix: this.featurePrefix,
  10434. schema: this.schema
  10435. }, a),
  10436. b = GeoGlobe.Util.extend({}, this.schemaLocations);
  10437. if (a.schema) b[a.featurePrefix] =
  10438. a.schema;
  10439. var a = [],
  10440. c, d;
  10441. for (d in b)(c = this.namespaces[d]) && a.push(c + " " + b[d]);
  10442. return a.join(" ") || void 0
  10443. },
  10444. setFilterProperty: function(a) {
  10445. if (a.filters)
  10446. for (var b = 0, c = a.filters.length; b < c; ++b) GeoGlobe.Format.WFST.v1.prototype.setFilterProperty.call(this, a.filters[b]);
  10447. else if (a instanceof GeoGlobe.Filter.Spatial && !a.property) a.property = this.geometryName
  10448. },
  10449. CLASS_NAME: "GeoGlobe.Format.WFST.v1"
  10450. });
  10451. GeoGlobe.Format.WFST.v1_0_0 = GeoGlobe.Class4OL(GeoGlobe.Format.Filter.v1_0_0, GeoGlobe.Format.WFST.v1, {
  10452. version: "1.0.0",
  10453. srsNameInQuery: !1,
  10454. schemaLocations: {
  10455. wfs: "http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"
  10456. },
  10457. initialize: function(a) {
  10458. GeoGlobe.Format.Filter.v1_0_0.prototype.initialize.apply(this, [a]);
  10459. GeoGlobe.Format.WFST.v1.prototype.initialize.apply(this, [a])
  10460. },
  10461. readNode: function() {
  10462. return GeoGlobe.Format.GML.v2.prototype.readNode.apply(this, arguments)
  10463. },
  10464. readers: {
  10465. wfs: GeoGlobe.Util.applyDefaults({
  10466. WFS_TransactionResponse: function(a,
  10467. b) {
  10468. b.insertIds = [];
  10469. b.success = !1;
  10470. this.readChildNodes(a, b)
  10471. },
  10472. InsertResult: function(a, b) {
  10473. var c = {
  10474. fids: []
  10475. };
  10476. this.readChildNodes(a, c);
  10477. b.insertIds = b.insertIds.concat(c.fids)
  10478. },
  10479. TransactionResult: function(a, b) {
  10480. this.readChildNodes(a, b)
  10481. },
  10482. Status: function(a, b) {
  10483. this.readChildNodes(a, b)
  10484. },
  10485. SUCCESS: function(a, b) {
  10486. b.success = !0
  10487. }
  10488. }, GeoGlobe.Format.WFST.v1.prototype.readers.wfs),
  10489. gml: GeoGlobe.Format.GML.v2.prototype.readers.gml,
  10490. feature: GeoGlobe.Format.GML.v2.prototype.readers.feature,
  10491. ogc: GeoGlobe.Format.Filter.v1_0_0.prototype.readers.ogc
  10492. },
  10493. writers: {
  10494. wfs: GeoGlobe.Util.applyDefaults({
  10495. Query: function(a) {
  10496. var a = GeoGlobe.Util.extend({
  10497. featureNS: this.featureNS,
  10498. featurePrefix: this.featurePrefix,
  10499. featureType: this.featureType,
  10500. srsName: this.srsName,
  10501. srsNameInQuery: this.srsNameInQuery
  10502. }, a),
  10503. b = a.featurePrefix,
  10504. c = this.createElementNSPlus("wfs:Query", {
  10505. attributes: {
  10506. typeName: (a.featureNS ? b + ":" : "") + a.featureType,
  10507. time: a && a.time,
  10508. userecent: a && a.userecent
  10509. }
  10510. });
  10511. a.srsNameInQuery && a.srsName && c.setAttribute("srsName", a.srsName);
  10512. a.featureNS && c.setAttribute("xmlns:" + b, a.featureNS);
  10513. if (a.propertyNames)
  10514. for (var b = 0, d = a.propertyNames.length; b < d; b++) this.writeNode("ogc:PropertyName", {
  10515. property: a.propertyNames[b]
  10516. }, c);
  10517. a.filter && (this.setFilterProperty(a.filter), this.writeNode("ogc:Filter", a.filter, c));
  10518. a.sortBy && this.writeNode("ogc:SortBy", a.sortBy, c);
  10519. a.groupBy && this.writeNode("ogc:GroupBy", a.groupBy, c);
  10520. return c
  10521. }
  10522. }, GeoGlobe.Format.WFST.v1.prototype.writers.wfs),
  10523. gml: GeoGlobe.Format.GML.v2.prototype.writers.gml,
  10524. feature: GeoGlobe.Format.GML.v2.prototype.writers.feature,
  10525. ogc: GeoGlobe.Format.Filter.v1_0_0.prototype.writers.ogc
  10526. },
  10527. CLASS_NAME: "GeoGlobe.Format.WFST.v1_0_0"
  10528. });
  10529. GeoGlobe.Format.WFST.v1_1_0 = GeoGlobe.Class4OL(GeoGlobe.Format.Filter.v1_1_0, GeoGlobe.Format.WFST.v1, {
  10530. version: "1.1.0",
  10531. schemaLocations: {
  10532. wfs: "http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
  10533. },
  10534. initialize: function(a) {
  10535. GeoGlobe.Format.Filter.v1_1_0.prototype.initialize.apply(this, [a]);
  10536. GeoGlobe.Format.WFST.v1.prototype.initialize.apply(this, [a])
  10537. },
  10538. readNode: function() {
  10539. return GeoGlobe.Format.GML.v3.prototype.readNode.apply(this, arguments)
  10540. },
  10541. readers: {
  10542. wfs: GeoGlobe.Util.applyDefaults({
  10543. FeatureCollection: function(a, b) {
  10544. b.numberOfFeatures =
  10545. parseInt(a.getAttribute("numberOfFeatures"));
  10546. GeoGlobe.Format.WFST.v1.prototype.readers.wfs.FeatureCollection.apply(this, arguments)
  10547. },
  10548. TransactionResponse: function(a, b) {
  10549. b.insertIds = [];
  10550. b.success = !1;
  10551. this.readChildNodes(a, b)
  10552. },
  10553. TransactionSummary: function(a, b) {
  10554. b.success = !0
  10555. },
  10556. InsertResults: function(a, b) {
  10557. this.readChildNodes(a, b)
  10558. },
  10559. Feature: function(a, b) {
  10560. var c = {
  10561. fids: []
  10562. };
  10563. this.readChildNodes(a, c);
  10564. b.insertIds.push(c.fids[0])
  10565. }
  10566. }, GeoGlobe.Format.WFST.v1.prototype.readers.wfs),
  10567. gml: GeoGlobe.Format.GML.v3.prototype.readers.gml,
  10568. feature: GeoGlobe.Format.GML.v3.prototype.readers.feature,
  10569. ogc: GeoGlobe.Format.Filter.v1_1_0.prototype.readers.ogc,
  10570. ows: GeoGlobe.Format.OWSCommon.v1_0_0.prototype.readers.ows
  10571. },
  10572. writers: {
  10573. wfs: GeoGlobe.Util.applyDefaults({
  10574. GetFeature: function(a) {
  10575. var b = GeoGlobe.Format.WFST.v1.prototype.writers.wfs.GetFeature.apply(this, arguments);
  10576. a && this.setAttributes(b, {
  10577. resultType: a.resultType,
  10578. startIndex: a.startIndex,
  10579. count: a.count
  10580. });
  10581. return b
  10582. },
  10583. Query: function(a) {
  10584. var a = GeoGlobe.Util.extend({
  10585. featureNS: this.featureNS,
  10586. featurePrefix: this.featurePrefix,
  10587. featureType: this.featureType,
  10588. srsName: this.srsName
  10589. }, a),
  10590. b = a.featurePrefix,
  10591. c = this.createElementNSPlus("wfs:Query", {
  10592. attributes: {
  10593. typeName: (a.featureNS ? b + ":" : "") + a.featureType,
  10594. srsName: a.srsName,
  10595. time: a && a.time,
  10596. userecent: a && a.userecent
  10597. }
  10598. });
  10599. a.featureNS && c.setAttribute("xmlns:" + b, a.featureNS);
  10600. if (a.propertyNames)
  10601. for (var b = 0, d = a.propertyNames.length; b < d; b++) this.writeNode("wfs:PropertyName", {
  10602. property: a.propertyNames[b]
  10603. }, c);
  10604. a.filter && (GeoGlobe.Format.WFST.v1_1_0.prototype.setFilterProperty.call(this, a.filter),
  10605. this.writeNode("ogc:Filter", a.filter, c));
  10606. a.sortBy && this.writeNode("ogc:SortBy", a.sortBy, c);
  10607. a.groupBy && this.writeNode("ogc:GroupBy", a.groupBy, c);
  10608. return c
  10609. },
  10610. PropertyName: function(a) {
  10611. return this.createElementNSPlus("wfs:PropertyName", {
  10612. value: a.property
  10613. })
  10614. }
  10615. }, GeoGlobe.Format.WFST.v1.prototype.writers.wfs),
  10616. gml: GeoGlobe.Format.GML.v3.prototype.writers.gml,
  10617. feature: GeoGlobe.Format.GML.v3.prototype.writers.feature,
  10618. ogc: GeoGlobe.Format.Filter.v1_1_0.prototype.writers.ogc
  10619. },
  10620. CLASS_NAME: "GeoGlobe.Format.WFST.v1_1_0"
  10621. });
  10622. GeoGlobe.Format.JSON = GeoGlobe.Class4OL(GeoGlobe.Format, {
  10623. indent: " ",
  10624. space: " ",
  10625. newline: "\n",
  10626. level: 0,
  10627. pretty: !1,
  10628. nativeJSON: function() {
  10629. return !(!window.JSON || !(typeof JSON.parse == "function" && typeof JSON.stringify == "function"))
  10630. }(),
  10631. read: function(a, b) {
  10632. var c;
  10633. if (this.nativeJSON) c = JSON.parse(a, b);
  10634. else try {
  10635. if (/^[\],:{}\s]*$/.test(a.replace(/\\["\\\/bfnrtu]/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, "")) && (c = eval("(" + a + ")"), typeof b ===
  10636. "function")) {
  10637. var d = function(a, c) {
  10638. if (c && typeof c === "object")
  10639. for (var e in c) c.hasOwnProperty(e) && (c[e] = d(e, c[e]));
  10640. return b(a, c)
  10641. };
  10642. c = d("", c)
  10643. }
  10644. } catch (e) {}
  10645. if (this.keepData) this.data = c;
  10646. return c
  10647. },
  10648. write: function(a, b) {
  10649. this.pretty = !!b;
  10650. var c = null,
  10651. d = typeof a;
  10652. if (this.serialize[d]) try {
  10653. c = !this.pretty && this.nativeJSON ? JSON.stringify(a) : this.serialize[d].apply(this, [a])
  10654. } catch (e) {
  10655. GeoGlobe.Console.error("Trouble serializing: " + e)
  10656. }
  10657. return c
  10658. },
  10659. writeIndent: function() {
  10660. var a = [];
  10661. if (this.pretty)
  10662. for (var b = 0; b < this.level; ++b) a.push(this.indent);
  10663. return a.join("")
  10664. },
  10665. writeNewline: function() {
  10666. return this.pretty ? this.newline : ""
  10667. },
  10668. writeSpace: function() {
  10669. return this.pretty ? this.space : ""
  10670. },
  10671. serialize: {
  10672. object: function(a) {
  10673. if (a == null) return "null";
  10674. if (a.constructor == Date) return this.serialize.date.apply(this, [a]);
  10675. if (a.constructor == Array) return this.serialize.array.apply(this, [a]);
  10676. var b = ["{"];
  10677. this.level += 1;
  10678. var c, d, e, f = !1;
  10679. for (c in a) a.hasOwnProperty(c) && (d = GeoGlobe.Format.JSON.prototype.write.apply(this, [c, this.pretty]), e = GeoGlobe.Format.JSON.prototype.write.apply(this, [a[c], this.pretty]), d != null && e != null && (f && b.push(","), b.push(this.writeNewline(), this.writeIndent(), d, ":", this.writeSpace(), e), f = !0));
  10680. this.level -= 1;
  10681. b.push(this.writeNewline(), this.writeIndent(), "}");
  10682. return b.join("")
  10683. },
  10684. array: function(a) {
  10685. var b, c = ["["];
  10686. this.level += 1;
  10687. for (var d = 0, e = a.length; d < e; ++d) b = GeoGlobe.Format.JSON.prototype.write.apply(this, [a[d], this.pretty]), b != null && (d > 0 && c.push(","), c.push(this.writeNewline(), this.writeIndent(), b));
  10688. this.level -= 1;
  10689. c.push(this.writeNewline(), this.writeIndent(),
  10690. "]");
  10691. return c.join("")
  10692. },
  10693. string: function(a) {
  10694. var b = {
  10695. "\u0008": "\\b",
  10696. "\t": "\\t",
  10697. "\n": "\\n",
  10698. "\u000c": "\\f",
  10699. "\r": "\\r",
  10700. '"': '\\"',
  10701. "\\": "\\\\"
  10702. };
  10703. if (/["\\\x00-\x1f]/.test(a)) return '"' + a.replace(/([\x00-\x1f\\"])/g, function(a, d) {
  10704. var e = b[d];
  10705. if (e) return e;
  10706. e = d.charCodeAt();
  10707. return "\\u00" + Math.floor(e / 16).toString(16) + (e % 16).toString(16)
  10708. }) + '"';
  10709. return '"' + a + '"'
  10710. },
  10711. number: function(a) {
  10712. return isFinite(a) ? String(a) : "null"
  10713. },
  10714. "boolean": function(a) {
  10715. return String(a)
  10716. },
  10717. date: function(a) {
  10718. function b(a) {
  10719. return a < 10 ? "0" + a : a
  10720. }
  10721. return '"' +
  10722. a.getFullYear() + "-" + b(a.getMonth() + 1) + "-" + b(a.getDate()) + "T" + b(a.getHours()) + ":" + b(a.getMinutes()) + ":" + b(a.getSeconds()) + '"'
  10723. }
  10724. },
  10725. CLASS_NAME: "GeoGlobe.Format.JSON"
  10726. });
  10727. GeoGlobe.Format.GeoJSON = GeoGlobe.Class4OL(GeoGlobe.Format.JSON, {
  10728. ignoreExtraDims: !1,
  10729. read: function(a, b, c) {
  10730. var b = b ? b : "FeatureCollection",
  10731. d = null,
  10732. e = null;
  10733. if (e = typeof a == "string" ? GeoGlobe.Format.JSON.prototype.read.apply(this, [a, c]) : a)
  10734. if (typeof e.type != "string") GeoGlobe.Console.error("Bad GeoJSON - no type: " + a);
  10735. else {
  10736. if (this.isValidType(e, b)) switch (b) {
  10737. case "Geometry":
  10738. try {
  10739. d = this.parseGeometry(e)
  10740. } catch (f) {
  10741. GeoGlobe.Console.error(f)
  10742. }
  10743. break;
  10744. case "Feature":
  10745. try {
  10746. d = this.parseFeature(e), d.type = "Feature"
  10747. } catch (g) {
  10748. GeoGlobe.Console.error(g)
  10749. }
  10750. break;
  10751. case "FeatureCollection":
  10752. switch (d = [], e.type) {
  10753. case "Feature":
  10754. try {
  10755. d.push(this.parseFeature(e))
  10756. } catch (h) {
  10757. d = null, GeoGlobe.Console.error(h)
  10758. }
  10759. break;
  10760. case "FeatureCollection":
  10761. a = 0;
  10762. for (b = e.features.length; a < b; ++a) try {
  10763. d.push(this.parseFeature(e.features[a]))
  10764. } catch (j) {
  10765. d = null, GeoGlobe.Console.error(j)
  10766. }
  10767. break;
  10768. default:
  10769. try {
  10770. var l = this.parseGeometry(e);
  10771. d.push(new GeoGlobe.Feature(l))
  10772. } catch (m) {
  10773. d = null, GeoGlobe.Console.error(m)
  10774. }
  10775. }
  10776. }
  10777. }
  10778. else GeoGlobe.Console.error("Bad JSON: " + a);
  10779. return d
  10780. },
  10781. isValidType: function(a, b) {
  10782. var c = !1;
  10783. switch (b) {
  10784. case "Geometry":
  10785. GeoGlobe.Util.indexOf(["Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", "Box", "GeometryCollection"], a.type) == -1 ? GeoGlobe.Console.error("Unsupported geometry type: " + a.type) : c = !0;
  10786. break;
  10787. case "FeatureCollection":
  10788. c = !0;
  10789. break;
  10790. default:
  10791. a.type == b ? c = !0 : GeoGlobe.Console.error("Cannot convert types from " + a.type + " to " + b)
  10792. }
  10793. return c
  10794. },
  10795. parseFeature: function(a) {
  10796. var b, c, d;
  10797. c = a.properties ? a.properties : {};
  10798. d = a.geometry && a.geometry.bbox || a.bbox;
  10799. try {
  10800. b = this.parseGeometry(a.geometry)
  10801. } catch (e) {
  10802. throw e;
  10803. }
  10804. b = new GeoGlobe.Feature(b, c);
  10805. if (d) b.bounds = GeoGlobe.LngLatBounds.fromArray(d);
  10806. if (a.id) b.fid = a.id;
  10807. return b
  10808. },
  10809. parseGeometry: function(a) {
  10810. if (a == null) return null;
  10811. var b, c = !1;
  10812. if (a.type == "GeometryCollection") {
  10813. if (!GeoGlobe.Util.isArray(a.geometries)) throw "GeometryCollection must have geometries array: " + a;
  10814. b = a.geometries.length;
  10815. for (var c = Array(b), d = 0; d < b; ++d) c[d] = this.parseGeometry.apply(this, [a.geometries[d]]);
  10816. b = new GeoGlobe.Geometry.Collection(c);
  10817. c = !0
  10818. } else {
  10819. if (!GeoGlobe.Util.isArray(a.coordinates)) throw "Geometry must have coordinates array: " +
  10820. a;
  10821. if (!this.parseCoords[a.type.toLowerCase()]) throw "Unsupported geometry type: " + a.type;
  10822. try {
  10823. b = this.parseCoords[a.type.toLowerCase()].apply(this, [a.coordinates])
  10824. } catch (e) {
  10825. throw e;
  10826. }
  10827. }
  10828. this.internalProjection && this.externalProjection && !c && b.transform(this.externalProjection, this.internalProjection);
  10829. return b
  10830. },
  10831. parseCoords: {
  10832. point: function(a) {
  10833. if (this.ignoreExtraDims == !1 && a.length != 2) throw "Only 2D points are supported: " + a;
  10834. return new GeoGlobe.Geometry.Point(a[0], a[1])
  10835. },
  10836. multipoint: function(a) {
  10837. for (var b = [], c =
  10838. null, d = 0, e = a.length; d < e; ++d) {
  10839. try {
  10840. c = this.parseCoords.point.apply(this, [a[d]])
  10841. } catch (f) {
  10842. throw f;
  10843. }
  10844. b.push(c)
  10845. }
  10846. return new GeoGlobe.Geometry.MultiPoint(b)
  10847. },
  10848. linestring: function(a) {
  10849. for (var b = [], c = null, d = 0, e = a.length; d < e; ++d) {
  10850. try {
  10851. c = this.parseCoords.point.apply(this, [a[d]])
  10852. } catch (f) {
  10853. throw f;
  10854. }
  10855. b.push(c)
  10856. }
  10857. return new GeoGlobe.Geometry.LineString(b)
  10858. },
  10859. multilinestring: function(a) {
  10860. for (var b = [], c = null, d = 0, e = a.length; d < e; ++d) {
  10861. try {
  10862. c = this.parseCoords.linestring.apply(this, [a[d]])
  10863. } catch (f) {
  10864. throw f;
  10865. }
  10866. b.push(c)
  10867. }
  10868. return new GeoGlobe.Geometry.MultiLineString(b)
  10869. },
  10870. polygon: function(a) {
  10871. for (var b = [], c, d, e = 0, f = a.length; e < f; ++e) {
  10872. try {
  10873. d = this.parseCoords.linestring.apply(this, [a[e]])
  10874. } catch (g) {
  10875. throw g;
  10876. }
  10877. c = new GeoGlobe.Geometry.LinearRing(d.components);
  10878. b.push(c)
  10879. }
  10880. return new GeoGlobe.Geometry.Polygon(b)
  10881. },
  10882. multipolygon: function(a) {
  10883. for (var b = [], c = null, d = 0, e = a.length; d < e; ++d) {
  10884. try {
  10885. c = this.parseCoords.polygon.apply(this, [a[d]])
  10886. } catch (f) {
  10887. throw f;
  10888. }
  10889. b.push(c)
  10890. }
  10891. return new GeoGlobe.Geometry.MultiPolygon(b)
  10892. },
  10893. box: function(a) {
  10894. if (a.length != 2) throw "GeoJSON box coordinates must have 2 elements";
  10895. return new GeoGlobe.Geometry.Polygon([new GeoGlobe.Geometry.LinearRing([new GeoGlobe.Geometry.Point(a[0][0], a[0][1]), new GeoGlobe.Geometry.Point(a[1][0], a[0][1]), new GeoGlobe.Geometry.Point(a[1][0], a[1][1]), new GeoGlobe.Geometry.Point(a[0][0], a[1][1]), new GeoGlobe.Geometry.Point(a[0][0], a[0][1])])])
  10896. }
  10897. },
  10898. write: function(a, b) {
  10899. var c = {
  10900. type: null
  10901. };
  10902. if (GeoGlobe.Util.isArray(a)) {
  10903. c.type = "FeatureCollection";
  10904. var d = a.length;
  10905. c.features = Array(d);
  10906. for (var e = 0; e < d; ++e) {
  10907. var f = a[e];
  10908. if (!f instanceof GeoGlobe.Feature) throw "FeatureCollection only supports collections of features: " +
  10909. f;
  10910. c.features[e] = this.extract.feature.apply(this, [f])
  10911. }
  10912. } else if (a.CLASS_NAME.indexOf("GeoGlobe.Geometry") == 0) c = this.extract.geometry.apply(this, [a]);
  10913. else if (a instanceof GeoGlobe.Feature && (c = this.extract.feature.apply(this, [a]), a.layer && a.layer.projection)) c.crs = this.createCRSObject(a);
  10914. return GeoGlobe.Format.JSON.prototype.write.apply(this, [c, b])
  10915. },
  10916. createCRSObject: function(a) {
  10917. var a = a.layer.projection.toString(),
  10918. b = {};
  10919. a.match(/epsg:/i) && (a = parseInt(a.substring(a.indexOf(":") + 1)), b = a == 4326 ? {
  10920. type: "name",
  10921. properties: {
  10922. name: "urn:ogc:def:crs:OGC:1.3:CRS84"
  10923. }
  10924. } : {
  10925. type: "name",
  10926. properties: {
  10927. name: "EPSG:" + a
  10928. }
  10929. });
  10930. return b
  10931. },
  10932. extract: {
  10933. feature: function(a) {
  10934. var b = this.extract.geometry.apply(this, [a.geometry]),
  10935. b = {
  10936. type: "Feature",
  10937. properties: a.attributes,
  10938. geometry: b
  10939. };
  10940. if (a.fid != null) b.id = a.fid;
  10941. return b
  10942. },
  10943. geometry: function(a) {
  10944. if (a == null) return null;
  10945. this.internalProjection && this.externalProjection && (a = a.clone(), a.transform(this.internalProjection, this.externalProjection));
  10946. var b = a.CLASS_NAME.split(".")[2],
  10947. a = this.extract[b.toLowerCase()].apply(this, [a]);
  10948. return b == "Collection" ? {
  10949. type: "GeometryCollection",
  10950. geometries: a
  10951. } : {
  10952. type: b,
  10953. coordinates: a
  10954. }
  10955. },
  10956. point: function(a) {
  10957. return [a.x, a.y]
  10958. },
  10959. multipoint: function(a) {
  10960. for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push(this.extract.point.apply(this, [a.components[c]]));
  10961. return b
  10962. },
  10963. linestring: function(a) {
  10964. for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push(this.extract.point.apply(this, [a.components[c]]));
  10965. return b
  10966. },
  10967. multilinestring: function(a) {
  10968. for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push(this.extract.linestring.apply(this, [a.components[c]]));
  10969. return b
  10970. },
  10971. polygon: function(a) {
  10972. for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push(this.extract.linestring.apply(this, [a.components[c]]));
  10973. return b
  10974. },
  10975. multipolygon: function(a) {
  10976. for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push(this.extract.polygon.apply(this, [a.components[c]]));
  10977. return b
  10978. },
  10979. collection: function(a) {
  10980. for (var b = a.components.length, c = Array(b), d = 0; d < b; ++d) c[d] = this.extract.geometry.apply(this, [a.components[d]]);
  10981. return c
  10982. }
  10983. },
  10984. CLASS_NAME: "GeoGlobe.Format.GeoJSON"
  10985. });
  10986. GeoGlobe.Format.VTS = GeoGlobe.Class4OL({
  10987. initialize: function(a) {
  10988. GeoGlobe.Util.extend(this, a)
  10989. },
  10990. getVTSCapabilities: function(a) {
  10991. this.url = a;
  10992. var b = null;
  10993. this.getCapabilities(a, function(a) {
  10994. var d = a.responseXML;
  10995. if (!d || !d.documentElement) d = a.responseText;
  10996. b = (new GeoGlobe.Format.VTSCapabilities.v1_0_0).read(d)
  10997. }, function() {
  10998. alert("VTS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" +
  10999. a + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  11000. });
  11001. return b
  11002. },
  11003. getCapabilities: function(a, b, c) {
  11004. typeof c != "function" && (c = function() {
  11005. alert("VTS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + a + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  11006. });
  11007. GeoGlobe.Request.GET({
  11008. url: a,
  11009. params: {
  11010. REQUEST: "GetCapabilities",
  11011. SERVICE: "WMTS"
  11012. },
  11013. scope: this,
  11014. async: !1,
  11015. success: function(a) {
  11016. typeof b ==
  11017. "function" && b(a)
  11018. },
  11019. failure: c
  11020. })
  11021. },
  11022. createLayerOption: function(a, b, c) {
  11023. if (!("layer" in c)) throw Error("Missing property 'layer' in configuration.");
  11024. for (var d = b.contents, e, f = 0, g = d.layers.length; f < g; ++f)
  11025. if (d.layers[f].identifier === c.layer) {
  11026. e = d.layers[f];
  11027. break
  11028. }
  11029. if (!e) throw Error("Layer not found");
  11030. f = c.format;
  11031. !f && e.formats && e.formats.length && (f = e.formats[0]);
  11032. var h;
  11033. if (c.matrixSet) h = d.tileMatrixSets[c.matrixSet];
  11034. else if (c.projection)
  11035. for (var f = 0, j = e.tileMatrixSetLinks.length; f < j; f++) {
  11036. if (d.tileMatrixSets[e.tileMatrixSetLinks[f].tileMatrixSet].supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,
  11037. "$1:$3") === c.projection) {
  11038. h = d.tileMatrixSets[e.tileMatrixSetLinks[f].tileMatrixSet];
  11039. break
  11040. }
  11041. } else e.tileMatrixSetLinks.length >= 1 && (h = d.tileMatrixSets[e.tileMatrixSetLinks[0].tileMatrixSet]);
  11042. if (!h) throw Error("matrixSet not found");
  11043. var l = [];
  11044. c.styleName && c.styleName != "" ? l[0] = c.styleName : this.GetStyleName(function(a) {
  11045. l = a.filter(function(a) {
  11046. if (a.indexOf(e.styles[0].identifier) != -1) return a
  11047. })
  11048. });
  11049. (f = c.requestEncoding) || (f = "KVP");
  11050. f = [];
  11051. g = c.params || {};
  11052. delete c.params;
  11053. for (var j = 0, m = e.dimensions.length; j < m; j++) {
  11054. var n =
  11055. e.dimensions[j];
  11056. f.push(n.identifier);
  11057. g.hasOwnProperty(n.identifier) || (g[n.identifier] = n["default"])
  11058. }
  11059. for (var p = c.projection || h.supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, "$1:$3"), q = c.units || (p === "EPSG:4326" ? "degrees" : "m"), o = [], s, r, c = [], m = e.tileMatrixSetLinks, g = function(a) {
  11060. o.push(a * 2.8E-4 / GeoGlobe.METERS_PER_INCH / GeoGlobe.INCHES_PER_UNIT[q]);
  11061. if (!s || s > a) s = a;
  11062. if (!r || r < a) r = a
  11063. }, n = 0, j = m.length; n < j; n++)
  11064. if (f = m[n], f.tileMatrixSet === h.identifier) {
  11065. if (f.tileMatrixSetLimits) {
  11066. for (var j = {}, n = 0, t = h.matrixIds.length; n <
  11067. t; n++) j[h.matrixIds[n].identifier] = h.matrixIds[n];
  11068. n = 0;
  11069. for (t = f.tileMatrixSetLimits.length; n < t; n++) m = j[f.tileMatrixSetLimits[n].tileMatrix], c.push(m), g(m.scaleDenominator)
  11070. } else {
  11071. n = 0;
  11072. for (t = h.matrixIds.length; n < t; n++) g(h.matrixIds[n].scaleDenominator)
  11073. }
  11074. break
  11075. }
  11076. o.sort(function(a, b) {
  11077. return b - a
  11078. });
  11079. var u = "",
  11080. v = {
  11081. layers: [],
  11082. source: {},
  11083. source_id: "",
  11084. url: "",
  11085. url_tmpl: "",
  11086. layerType: "VTS"
  11087. },
  11088. b = GeoGlobe.Util.getParameterString({
  11089. SERVICE: "WMTS",
  11090. REQUEST: "GetTile",
  11091. VERSION: b.version,
  11092. LAYER: e.identifier,
  11093. STYLE: l[0],
  11094. TILEMATRIXSET: h.identifier,
  11095. FORMAT: "protobuf",
  11096. TILEMATRIX: "{z}",
  11097. TILEROW: "{y}",
  11098. TILECOL: "{x}"
  11099. });
  11100. v.url = a;
  11101. u = a.endsWith("?") || a.endsWith("&") ? GeoGlobe.ProxyHost + a + b : GeoGlobe.ProxyHost + a + "?" + b;
  11102. v.url_tmpl = u;
  11103. GeoGlobe.Util.randomStr(10);
  11104. if (e.bounds) var y = [e.bounds._sw.lng, e.bounds._sw.lat, e.bounds._ne.lng, e.bounds._ne.lat];
  11105. else e.BoundingBox && (y = e.BoundingBox[0].bounds.toBBOX());
  11106. var z = d.tileMatrixSets[e.tileMatrixSetLinks[0].tileMatrixSet].matrixIds[0].identifier;
  11107. this.GetStyle(l[0], function(a) {
  11108. if (a.sprite) {
  11109. var b = GeoGlobe.ProxyHost + a.sprite;
  11110. v.sprite = b
  11111. } else b = "";
  11112. if (a.glyphs) {
  11113. var c = GeoGlobe.ProxyHost + a.glyphs;
  11114. v.glyphs = c
  11115. } else c = "";
  11116. b = {
  11117. name: e.identifier,
  11118. sprite: b,
  11119. glyphs: c,
  11120. styleName: a.styleName,
  11121. srs: p,
  11122. bbox: y,
  11123. format: e.formats,
  11124. zoomoffset: z
  11125. };
  11126. c = "source_vts_" + GeoGlobe.Util.randomStr(6);
  11127. v.source_id = c;
  11128. v.source = {
  11129. type: "vector",
  11130. tiles: [u]
  11131. };
  11132. if (a.styleData)
  11133. for (var d = 0; d < a.styleData.layers.length; d++) a.styleData.layers[d].metadata = b, a.styleData.layers[d].source = c, v.layers[d] = a.styleData.layers[d];
  11134. else
  11135. for (d = 0; d < a.layers.length; d++) a.layers[d].metadata = b,
  11136. a.layers[d].source = c, v.layers[d] = a.layers[d]
  11137. }, function() {
  11138. alert("WMTS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + a + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  11139. });
  11140. return v
  11141. },
  11142. createLayer: function(a, b) {
  11143. var c = this.getVTSCapabilities(a),
  11144. b = b ? b : {};
  11145. b.layer = b.layer ? b.layer : c.contents.layers[0].identifier;
  11146. b.styleName = b.styleName ? b.styleName : "";
  11147. return this.createLayerOption(a,
  11148. c, b)
  11149. },
  11150. createLayers: function(a) {
  11151. for (var b = this.getVTSCapabilities(a), c = b.contents.layers, d = [], e = 0; e < c.length; e++) {
  11152. var f = this.createLayerOption(a, b, {
  11153. layer: c[e].identifier
  11154. });
  11155. d.push(f)
  11156. }
  11157. return d
  11158. },
  11159. GetStyleName: function(a, b) {
  11160. var c = this.url,
  11161. d = {
  11162. REQUEST: "GetStyle",
  11163. SERVICE: "WMTS",
  11164. VERSION: "1.0.0"
  11165. };
  11166. b || (b = function() {
  11167. this.failFn(d.REQUEST)
  11168. });
  11169. GeoGlobe.Request.GET({
  11170. url: c,
  11171. params: d,
  11172. scope: this,
  11173. async: !1,
  11174. success: function(c) {
  11175. c = c.responseText;
  11176. if (!c) return b(), !1;
  11177. var c = (new GeoGlobe.Format.JSON).read(c),
  11178. d = [];
  11179. if (c.style)
  11180. for (var g =
  11181. 0; g < c.style.length; g++) d.push(c.style[g].styleName);
  11182. else if (c.styleName)
  11183. for (g = 0; g < c.styleName.length; g++) d.push(c.styleName[g]);
  11184. a(d)
  11185. },
  11186. failure: b
  11187. })
  11188. },
  11189. GetStyle: function(a, b, c) {
  11190. var d = this.url;
  11191. if (a == "" || a == void 0) alert("\u8bf7\u67e5\u770b\u6837\u5f0f\u540d\u79f0\u662f\u5426\u5b58\u5728");
  11192. else {
  11193. var e = {
  11194. REQUEST: "GetStyle",
  11195. SERVICE: "WMTS",
  11196. VERSION: "1.0.0",
  11197. STYLENAME: a
  11198. };
  11199. c || (c = function() {
  11200. this.failFn(e.REQUEST)
  11201. });
  11202. GeoGlobe.Request.GET({
  11203. url: d,
  11204. params: e,
  11205. scope: this,
  11206. async: !1,
  11207. success: function(a) {
  11208. a = a.responseText;
  11209. if (!a) return c(), !1;
  11210. a = (new GeoGlobe.Format.JSON).read(a);
  11211. b(a)
  11212. },
  11213. failure: c
  11214. })
  11215. }
  11216. },
  11217. CLASS_NAME: "GeoGlobe.Format.VTS"
  11218. });
  11219. GeoGlobe.Format.WMTS = GeoGlobe.Class4OL({
  11220. initialize: function(a) {
  11221. GeoGlobe.Util.extend(this, a)
  11222. },
  11223. getWMTSCapabilities: function(a) {
  11224. var b = null;
  11225. this.getCapabilities(a, function(a) {
  11226. var d = a.responseXML;
  11227. if (!d || !d.documentElement) d = a.responseText;
  11228. b = (new GeoGlobe.Format.WMTSCapabilities.v1_0_0).read(d)
  11229. }, function() {
  11230. alert("WMTS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + a +
  11231. "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  11232. });
  11233. return b
  11234. },
  11235. getCapabilities: function(a, b, c) {
  11236. typeof c != "function" && (c = function() {
  11237. alert("WMTS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + a + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  11238. });
  11239. GeoGlobe.Request.GET({
  11240. url: a,
  11241. params: {
  11242. REQUEST: "GetCapabilities",
  11243. SERVICE: "WMTS"
  11244. },
  11245. scope: this,
  11246. async: !1,
  11247. success: function(a) {
  11248. typeof b ==
  11249. "function" && b(a)
  11250. },
  11251. failure: c
  11252. })
  11253. },
  11254. createLayerOption: function(a, b, c) {
  11255. if (!("layer" in c)) throw Error("Missing property 'layer' in configuration.");
  11256. for (var d = b.contents, e, f = 0, g = d.layers.length; f < g; ++f)
  11257. if (d.layers[f].identifier === c.layer) {
  11258. e = d.layers[f];
  11259. break
  11260. }
  11261. if (!e) throw Error("Layer not found");
  11262. var h = c.format;
  11263. !h && e.formats && e.formats.length && (h = e.formats[0]);
  11264. var j;
  11265. if (c.matrixSet) j = d.tileMatrixSets[c.matrixSet];
  11266. else if (c.projection)
  11267. for (var f = 0, l = e.tileMatrixSetLinks.length; f < l; f++) {
  11268. if (d.tileMatrixSets[e.tileMatrixSetLinks[f].tileMatrixSet].supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,
  11269. "$1:$3") === c.projection) {
  11270. j = d.tileMatrixSets[e.tileMatrixSetLinks[f].tileMatrixSet];
  11271. break
  11272. }
  11273. } else e.tileMatrixSetLinks.length >= 1 && (j = d.tileMatrixSets[e.tileMatrixSetLinks[0].tileMatrixSet]);
  11274. if (!j) throw Error("matrixSet not found");
  11275. for (var m, f = 0, g = e.styles.length; f < g; ++f)
  11276. if (m = e.styles[f], m.isDefault) break;
  11277. (f = c.requestEncoding) || (f = "KVP");
  11278. f = [];
  11279. g = c.params || {};
  11280. delete c.params;
  11281. for (var n = 0, l = e.dimensions.length; n < l; n++) {
  11282. var p = e.dimensions[n];
  11283. f.push(p.identifier);
  11284. g.hasOwnProperty(p.identifier) || (g[p.identifier] =
  11285. p["default"])
  11286. }
  11287. for (var f = c.projection || j.supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, "$1:$3"), q = c.units || (f === "EPSG:4326" ? "degrees" : "m"), o = [], s, r, c = [], p = e.tileMatrixSetLinks, n = function(a) {
  11288. o.push(a * 2.8E-4 / GeoGlobe.METERS_PER_INCH / GeoGlobe.INCHES_PER_UNIT[q]);
  11289. if (!s || s > a) s = a;
  11290. if (!r || r < a) r = a
  11291. }, t = 0, l = p.length; t < l; t++)
  11292. if (g = p[t], g.tileMatrixSet === j.identifier) {
  11293. if (g.tileMatrixSetLimits) {
  11294. for (var l = {}, t = 0, u = j.matrixIds.length; t < u; t++) l[j.matrixIds[t].identifier] = j.matrixIds[t];
  11295. t = 0;
  11296. for (u = g.tileMatrixSetLimits.length; t <
  11297. u; t++) p = l[g.tileMatrixSetLimits[t].tileMatrix], c.push(p), n(p.scaleDenominator)
  11298. } else {
  11299. t = 0;
  11300. for (u = j.matrixIds.length; t < u; t++) n(j.matrixIds[t].scaleDenominator)
  11301. }
  11302. break
  11303. }
  11304. o.sort(function(a, b) {
  11305. return b - a
  11306. });
  11307. c = "";
  11308. b = GeoGlobe.Util.getParameterString({
  11309. SERVICE: "WMTS",
  11310. REQUEST: "GetTile",
  11311. VERSION: b.version,
  11312. LAYER: e.identifier,
  11313. STYLE: m.identifier,
  11314. TILEMATRIXSET: j.identifier,
  11315. FORMAT: h,
  11316. TILEMATRIX: "{z}",
  11317. TILEROW: "{y}",
  11318. TILECOL: "{x}"
  11319. });
  11320. c = a.endsWith("?") || a.endsWith("&") ? GeoGlobe.ProxyHost + a + b : GeoGlobe.ProxyHost + a + "?" + b;
  11321. a = GeoGlobe.Util.randomStr(10);
  11322. if (e.bounds) var v = [e.bounds._sw.lng, e.bounds._sw.lat, e.bounds._ne.lng, e.bounds._ne.lat];
  11323. else e.BoundingBox && (v = e.BoundingBox[0].bounds.toBBOX());
  11324. return {
  11325. id: "layer_" + e.identifier + "_" + a,
  11326. type: "raster",
  11327. source: {
  11328. type: "raster",
  11329. tiles: [c],
  11330. tileSize: 256,
  11331. noFadingParent: !0
  11332. },
  11333. metadata: {
  11334. name: e.identifier,
  11335. srs: f,
  11336. bbox: v,
  11337. format: e.formats,
  11338. zoomoffset: d.tileMatrixSets[e.tileMatrixSetLinks[0].tileMatrixSet].matrixIds[0].identifier
  11339. },
  11340. paint: {
  11341. "raster-opacity": 1
  11342. }
  11343. }
  11344. },
  11345. createLayer: function(a, b) {
  11346. var c = this.getWMTSCapabilities(a);
  11347. return this.createLayerOption(a,
  11348. c, b ? {
  11349. layer: b.layer
  11350. } : {
  11351. layer: c.contents.layers[0].identifier
  11352. })
  11353. },
  11354. createLayers: function(a) {
  11355. for (var b = this.getWMTSCapabilities(a), c = b.contents.layers, d = [], e = 0; e < c.length; e++) {
  11356. var f = this.createLayerOption(a, b, {
  11357. layer: c[e].identifier
  11358. });
  11359. d.push(f)
  11360. }
  11361. return d
  11362. },
  11363. calculationTopTileExtentAndZoomOffset: function(a) {
  11364. var b = {},
  11365. c = null,
  11366. d = 0.0254,
  11367. e = 111E3,
  11368. f = 96,
  11369. g = [],
  11370. h = [];
  11371. a.units = a.units ? a.units : "degrees";
  11372. if (a.hasOwnProperty("inchConvertMeterRatio")) d = a.inchConvertMeterRatio;
  11373. if (a.hasOwnProperty("degreeConvertMeterRatio")) e = a.degreeConvertMeterRatio;
  11374. if (a.hasOwnProperty("dpi")) f = a.dpi;
  11375. var j = Math.ceil(Math.log(Math.max(Number(a.matrixWidth), Number(a.matrixHeight))) / Math.LN2),
  11376. l = Math.pow(2, j);
  11377. if (a.hasOwnProperty("resolution"))
  11378. if (a.resolution !== "") c = a.resolution;
  11379. else {
  11380. alert("\u8bf7\u8f93\u5165resolution\u503c\uff0c\u6216\u8005\u5c06\u8be5\u5c5e\u6027\u6ce8\u91ca");
  11381. return
  11382. }
  11383. else if (a.units == "m" && (c = a.scaleDenominator * d / f), a.units == "degrees" && (c = a.scaleDenominator * d / (f * e)), a.units !== "m" && a.units !== "degrees") {
  11384. alert("\u8bf7\u786e\u5b9a\u5355\u4f4d\u662fm\u8fd8\u662fdegrees");
  11385. return
  11386. }
  11387. g[0] = a.topLeftCorner[0];
  11388. g[3] = a.topLeftCorner[1];
  11389. g[1] = g[3] - a.tileSize * c * l;
  11390. g[2] = g[0] + a.tileSize * c * l;
  11391. d = j - Number(a.identifier);
  11392. h[0] = (g[0] + g[2]) / 2;
  11393. h[1] = (g[1] + g[3]) / 2;
  11394. e = d - 1;
  11395. if ((g[2] - g[0] < 360 || g[3] - g[1] < 360) && a.units == "degrees") e = Math.ceil(Math.log(360 / (a.tileSize * c * l)) / Math.LN2), f = Math.pow(2, e), g[1] = g[3] - a.tileSize * c * l * f, g[2] = g[0] + a.tileSize * c * l * f, h[0] = (g[0] + g[2]) / 2, h[1] = (g[1] + g[3]) / 2, d += e, e = d - 1;
  11396. b.topTileExtent = g;
  11397. b.zoomOffset = d;
  11398. b.centerPoint = h;
  11399. b.proposalZoom = e;
  11400. return b
  11401. },
  11402. CLASS_NAME: "GeoGlobe.Format.WMTS"
  11403. });
  11404. GeoGlobe.Format.WMS = GeoGlobe.Class4OL({
  11405. initialize: function(a) {
  11406. GeoGlobe.Util.extend(this, a)
  11407. },
  11408. getWMSCapabilities: function(a) {
  11409. var b = null;
  11410. this.getCapabilities(a, function(a) {
  11411. var d = a.responseXML;
  11412. if (!d || !d.documentElement) d = a.responseText;
  11413. b = (new GeoGlobe.Format.WMSCapabilities.v1_1_1).read(d)
  11414. }, function() {
  11415. alert("WMS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" +
  11416. a + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  11417. });
  11418. return b
  11419. },
  11420. getCapabilities: function(a, b, c) {
  11421. typeof c != "function" && (c = function() {
  11422. alert("WMS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + a + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  11423. });
  11424. GeoGlobe.Request.GET({
  11425. url: a,
  11426. params: {
  11427. REQUEST: "GetCapabilities",
  11428. SERVICE: "WMS",
  11429. VERSION: "1.1.1"
  11430. },
  11431. scope: this,
  11432. async: !1,
  11433. success: function(a) {
  11434. typeof b == "function" && b(a)
  11435. },
  11436. failure: c
  11437. })
  11438. },
  11439. createLayerOption: function(a, b, c) {
  11440. if (!("layer" in c)) throw Error("Missing property 'layer' in configuration.");
  11441. for (var b = b.capability, d, e = 0, f = b.layers.length; e < f; ++e)
  11442. if (b.layers[e].name === c.layer) {
  11443. d = b.layers[e];
  11444. break
  11445. }
  11446. if (!d) throw Error("Layer not found");
  11447. b = c.format;
  11448. if (!b && d.formats && d.formats.length) {
  11449. for (e = 0; e < d.formats.length; e++) d.formats[e] == "image/png" && (b = d.formats[e]);
  11450. b != "image/png" && (b = d.formats[0])
  11451. }
  11452. e = c.styles;
  11453. if (!e && d.styles &&
  11454. d.styles.length) e = d.styles[0].name;
  11455. var f = eval(d.srs),
  11456. g, h;
  11457. for (h in f) g = h;
  11458. h = "";
  11459. h = c.transparent;
  11460. c.isTile ? (c = GeoGlobe.Util.getParameterString({
  11461. SERVICE: "WMS",
  11462. REQUEST: "GetMap",
  11463. VERSION: "1.1.1",
  11464. LAYERS: d.name,
  11465. styles: e,
  11466. FORMAT: b,
  11467. TRANSPARENT: h,
  11468. BBOX: "{bbox-epsg-3857}",
  11469. WIDTH: "256",
  11470. HEIGHT: "256",
  11471. SRS: g
  11472. }), h = a.endsWith("?") || a.endsWith("&") ? a + c : a + "?" + c, h = GeoGlobe.appendToProxy(h), a = GeoGlobe.Util.randomStr(10), d = {
  11473. id: "layer_" + d.name + "_" + a,
  11474. type: "raster",
  11475. source: {
  11476. type: "raster",
  11477. tiles: [h],
  11478. tileSize: 256
  11479. },
  11480. metadata: {
  11481. name: d.name,
  11482. srs: g,
  11483. bbox: d.bbox,
  11484. format: b
  11485. },
  11486. paint: {
  11487. "raster-opacity": 1
  11488. }
  11489. }) : d = new GeoGlobe.Layer.WMS({
  11490. url: a,
  11491. layer: d.name,
  11492. format: b,
  11493. version: "1.1.1",
  11494. SRS: g,
  11495. styles: e,
  11496. bbox: d.bbox,
  11497. isTile: !1
  11498. });
  11499. return d
  11500. },
  11501. createLayer: function(a, b, c) {
  11502. this.url = a;
  11503. var b = b ? b : {},
  11504. c = c === void 0 || c ? !0 : !1,
  11505. d = b && b.transparent === void 0 || b.transparent ? !0 : !1,
  11506. e = this.getWMSCapabilities(a);
  11507. return this.createLayerOption(a, e, {
  11508. layer: b && b.layer ? b.layer : e.capability.layers[0].name,
  11509. transparent: d,
  11510. isTile: c
  11511. })
  11512. },
  11513. createLayers: function(a, b, c) {
  11514. for (var b = b ? b : {}, c = c === void 0 ||
  11515. c ? !0 : !1, b = b && b.transparent === void 0 || b.transparent ? !0 : !1, d = this.getWMSCapabilities(a), e = d.capability.layers, f = [], g = 0; g < e.length; g++) {
  11516. var h = this.createLayerOption(a, d, {
  11517. layer: e[g].name,
  11518. transparent: b,
  11519. isTile: c
  11520. });
  11521. f.push(h)
  11522. }
  11523. return f
  11524. },
  11525. CLASS_NAME: "GeoGlobe.Format.WMS"
  11526. });
  11527. GeoGlobe.Format.WMSCapabilities = GeoGlobe.Class4OL(GeoGlobe.Format.XML.VersionedOGC, {
  11528. defaultVersion: "1.1.1",
  11529. profile: null,
  11530. CLASS_NAME: "GeoGlobe.Format.WMSCapabilities"
  11531. });
  11532. GeoGlobe.Format.WMSCapabilities.v1 = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  11533. namespaces: {
  11534. wms: "http://www.opengis.net/wms",
  11535. xlink: "http://www.w3.org/1999/xlink",
  11536. xsi: "http://www.w3.org/2001/XMLSchema-instance"
  11537. },
  11538. defaultPrefix: "wms",
  11539. read: function(a) {
  11540. typeof a == "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  11541. var b = a;
  11542. if (a && a.nodeType == 9) a = a.documentElement;
  11543. var c = {};
  11544. this.readNode(a, c);
  11545. if (c.service === void 0) a = new GeoGlobe.Format.OGCExceptionReport, c.error = a.read(b);
  11546. return c
  11547. },
  11548. readers: {
  11549. wms: {
  11550. Service: function(a,
  11551. b) {
  11552. b.service = {};
  11553. this.readChildNodes(a, b.service)
  11554. },
  11555. Name: function(a, b) {
  11556. b.name = this.getChildValue(a)
  11557. },
  11558. Title: function(a, b) {
  11559. b.title = this.getChildValue(a)
  11560. },
  11561. Abstract: function(a, b) {
  11562. b["abstract"] = this.getChildValue(a)
  11563. },
  11564. BoundingBox: function(a) {
  11565. var b = {};
  11566. b.bbox = [parseFloat(a.getAttribute("minx")), parseFloat(a.getAttribute("miny")), parseFloat(a.getAttribute("maxx")), parseFloat(a.getAttribute("maxy"))];
  11567. a = {
  11568. x: parseFloat(a.getAttribute("resx")),
  11569. y: parseFloat(a.getAttribute("resy"))
  11570. };
  11571. if (!isNaN(a.x) || !isNaN(a.y)) b.res =
  11572. a;
  11573. return b
  11574. },
  11575. OnlineResource: function(a, b) {
  11576. b.href = this.getAttributeNS(a, this.namespaces.xlink, "href")
  11577. },
  11578. ContactInformation: function(a, b) {
  11579. b.contactInformation = {};
  11580. this.readChildNodes(a, b.contactInformation)
  11581. },
  11582. ContactPersonPrimary: function(a, b) {
  11583. b.personPrimary = {};
  11584. this.readChildNodes(a, b.personPrimary)
  11585. },
  11586. ContactPerson: function(a, b) {
  11587. b.person = this.getChildValue(a)
  11588. },
  11589. ContactOrganization: function(a, b) {
  11590. b.organization = this.getChildValue(a)
  11591. },
  11592. ContactPosition: function(a, b) {
  11593. b.position = this.getChildValue(a)
  11594. },
  11595. ContactAddress: function(a,
  11596. b) {
  11597. b.contactAddress = {};
  11598. this.readChildNodes(a, b.contactAddress)
  11599. },
  11600. AddressType: function(a, b) {
  11601. b.type = this.getChildValue(a)
  11602. },
  11603. Address: function(a, b) {
  11604. b.address = this.getChildValue(a)
  11605. },
  11606. City: function(a, b) {
  11607. b.city = this.getChildValue(a)
  11608. },
  11609. StateOrProvince: function(a, b) {
  11610. b.stateOrProvince = this.getChildValue(a)
  11611. },
  11612. PostCode: function(a, b) {
  11613. b.postcode = this.getChildValue(a)
  11614. },
  11615. Country: function(a, b) {
  11616. b.country = this.getChildValue(a)
  11617. },
  11618. ContactVoiceTelephone: function(a, b) {
  11619. b.phone = this.getChildValue(a)
  11620. },
  11621. ContactFacsimileTelephone: function(a,
  11622. b) {
  11623. b.fax = this.getChildValue(a)
  11624. },
  11625. ContactElectronicMailAddress: function(a, b) {
  11626. b.email = this.getChildValue(a)
  11627. },
  11628. Fees: function(a, b) {
  11629. var c = this.getChildValue(a);
  11630. if (c && c.toLowerCase() != "none") b.fees = c
  11631. },
  11632. AccessConstraints: function(a, b) {
  11633. var c = this.getChildValue(a);
  11634. if (c && c.toLowerCase() != "none") b.accessConstraints = c
  11635. },
  11636. Capability: function(a, b) {
  11637. b.capability = {
  11638. nestedLayers: [],
  11639. layers: []
  11640. };
  11641. this.readChildNodes(a, b.capability)
  11642. },
  11643. Request: function(a, b) {
  11644. b.request = {};
  11645. this.readChildNodes(a, b.request)
  11646. },
  11647. GetCapabilities: function(a,
  11648. b) {
  11649. b.getcapabilities = {
  11650. formats: []
  11651. };
  11652. this.readChildNodes(a, b.getcapabilities)
  11653. },
  11654. Format: function(a, b) {
  11655. GeoGlobe.Util.isArray(b.formats) ? b.formats.push(this.getChildValue(a)) : b.format = this.getChildValue(a)
  11656. },
  11657. DCPType: function(a, b) {
  11658. this.readChildNodes(a, b)
  11659. },
  11660. HTTP: function(a, b) {
  11661. this.readChildNodes(a, b)
  11662. },
  11663. Get: function(a, b) {
  11664. b.get = {};
  11665. this.readChildNodes(a, b.get);
  11666. if (!b.href) b.href = b.get.href
  11667. },
  11668. Post: function(a, b) {
  11669. b.post = {};
  11670. this.readChildNodes(a, b.post);
  11671. if (!b.href) b.href = b.get.href
  11672. },
  11673. GetMap: function(a, b) {
  11674. b.getmap = {
  11675. formats: []
  11676. };
  11677. this.readChildNodes(a, b.getmap)
  11678. },
  11679. GetFeatureInfo: function(a, b) {
  11680. b.getfeatureinfo = {
  11681. formats: []
  11682. };
  11683. this.readChildNodes(a, b.getfeatureinfo)
  11684. },
  11685. Exception: function(a, b) {
  11686. b.exception = {
  11687. formats: []
  11688. };
  11689. this.readChildNodes(a, b.exception)
  11690. },
  11691. Layer: function(a, b) {
  11692. var c, d;
  11693. b.capability ? (d = b.capability, c = b) : d = b;
  11694. var e = a.getAttributeNode("queryable"),
  11695. f = e && e.specified ? a.getAttribute("queryable") : null,
  11696. g = (e = a.getAttributeNode("cascaded")) && e.specified ? a.getAttribute("cascaded") : null,
  11697. e = (e = a.getAttributeNode("opaque")) && e.specified ?
  11698. a.getAttribute("opaque") : null,
  11699. h = a.getAttribute("noSubsets"),
  11700. j = a.getAttribute("fixedWidth"),
  11701. l = a.getAttribute("fixedHeight"),
  11702. m = c || {},
  11703. n = GeoGlobe.Util.extend;
  11704. c = {
  11705. nestedLayers: [],
  11706. styles: c ? [].concat(c.styles) : [],
  11707. srs: c ? n({}, m.srs) : {},
  11708. metadataURLs: [],
  11709. bbox: c ? n({}, m.bbox) : {},
  11710. llbbox: m.llbbox,
  11711. dimensions: c ? n({}, m.dimensions) : {},
  11712. authorityURLs: c ? n({}, m.authorityURLs) : {},
  11713. identifiers: {},
  11714. keywords: [],
  11715. queryable: f && f !== "" ? f === "1" || f === "true" : m.queryable || !1,
  11716. cascaded: g !== null ? parseInt(g) : m.cascaded || 0,
  11717. opaque: e ? e === "1" ||
  11718. e === "true" : m.opaque || !1,
  11719. noSubsets: h !== null ? h === "1" || h === "true" : m.noSubsets || !1,
  11720. fixedWidth: j != null ? parseInt(j) : m.fixedWidth || 0,
  11721. fixedHeight: l != null ? parseInt(l) : m.fixedHeight || 0,
  11722. minScale: m.minScale,
  11723. maxScale: m.maxScale,
  11724. attribution: m.attribution
  11725. };
  11726. b.nestedLayers.push(c);
  11727. c.capability = d;
  11728. this.readChildNodes(a, c);
  11729. delete c.capability;
  11730. if (c.name) {
  11731. f = c.name.split(":");
  11732. g = d.request;
  11733. e = g.getfeatureinfo;
  11734. if (f.length > 0) c.prefix = f[0];
  11735. d.layers.push(c);
  11736. if (c.formats === void 0) c.formats = g.getmap.formats;
  11737. if (c.infoFormats === void 0 &&
  11738. e) c.infoFormats = e.formats
  11739. }
  11740. },
  11741. Attribution: function(a, b) {
  11742. b.attribution = {};
  11743. this.readChildNodes(a, b.attribution)
  11744. },
  11745. LogoURL: function(a, b) {
  11746. b.logo = {
  11747. width: a.getAttribute("width"),
  11748. height: a.getAttribute("height")
  11749. };
  11750. this.readChildNodes(a, b.logo)
  11751. },
  11752. Style: function(a, b) {
  11753. var c = {};
  11754. b.styles.push(c);
  11755. this.readChildNodes(a, c)
  11756. },
  11757. LegendURL: function(a, b) {
  11758. var c = {
  11759. width: a.getAttribute("width"),
  11760. height: a.getAttribute("height")
  11761. };
  11762. b.legend = c;
  11763. this.readChildNodes(a, c)
  11764. },
  11765. MetadataURL: function(a, b) {
  11766. var c = {
  11767. type: a.getAttribute("type")
  11768. };
  11769. b.metadataURLs.push(c);
  11770. this.readChildNodes(a, c)
  11771. },
  11772. DataURL: function(a, b) {
  11773. b.dataURL = {};
  11774. this.readChildNodes(a, b.dataURL)
  11775. },
  11776. FeatureListURL: function(a, b) {
  11777. b.featureListURL = {};
  11778. this.readChildNodes(a, b.featureListURL)
  11779. },
  11780. AuthorityURL: function(a, b) {
  11781. var c = a.getAttribute("name"),
  11782. d = {};
  11783. this.readChildNodes(a, d);
  11784. b.authorityURLs[c] = d.href
  11785. },
  11786. Identifier: function(a, b) {
  11787. var c = a.getAttribute("authority");
  11788. b.identifiers[c] = this.getChildValue(a)
  11789. },
  11790. KeywordList: function(a, b) {
  11791. this.readChildNodes(a, b)
  11792. },
  11793. SRS: function(a, b) {
  11794. b.srs[this.getChildValue(a)] = !0
  11795. }
  11796. }
  11797. },
  11798. CLASS_NAME: "GeoGlobe.Format.WMSCapabilities.v1"
  11799. });
  11800. GeoGlobe.Format.WMSCapabilities.v1_1 = GeoGlobe.Class4OL(GeoGlobe.Format.WMSCapabilities.v1, {
  11801. readers: {
  11802. wms: GeoGlobe.Util.applyDefaults({
  11803. WMT_MS_Capabilities: function(a, b) {
  11804. this.readChildNodes(a, b)
  11805. },
  11806. Keyword: function(a, b) {
  11807. b.keywords && b.keywords.push(this.getChildValue(a))
  11808. },
  11809. DescribeLayer: function(a, b) {
  11810. b.describelayer = {
  11811. formats: []
  11812. };
  11813. this.readChildNodes(a, b.describelayer)
  11814. },
  11815. GetLegendGraphic: function(a, b) {
  11816. b.getlegendgraphic = {
  11817. formats: []
  11818. };
  11819. this.readChildNodes(a, b.getlegendgraphic)
  11820. },
  11821. GetStyles: function(a, b) {
  11822. b.getstyles = {
  11823. formats: []
  11824. };
  11825. this.readChildNodes(a, b.getstyles)
  11826. },
  11827. PutStyles: function(a, b) {
  11828. b.putstyles = {
  11829. formats: []
  11830. };
  11831. this.readChildNodes(a, b.putstyles)
  11832. },
  11833. UserDefinedSymbolization: function(a, b) {
  11834. var c = {
  11835. supportSLD: parseInt(a.getAttribute("SupportSLD")) == 1,
  11836. userLayer: parseInt(a.getAttribute("UserLayer")) == 1,
  11837. userStyle: parseInt(a.getAttribute("UserStyle")) == 1,
  11838. remoteWFS: parseInt(a.getAttribute("RemoteWFS")) == 1
  11839. };
  11840. b.userSymbols = c
  11841. },
  11842. LatLonBoundingBox: function(a, b) {
  11843. b.llbbox = [parseFloat(a.getAttribute("minx")), parseFloat(a.getAttribute("miny")),
  11844. parseFloat(a.getAttribute("maxx")), parseFloat(a.getAttribute("maxy"))
  11845. ]
  11846. },
  11847. BoundingBox: function(a, b) {
  11848. var c = GeoGlobe.Format.WMSCapabilities.v1.prototype.readers.wms.BoundingBox.apply(this, [a, b]);
  11849. c.srs = a.getAttribute("SRS");
  11850. b.bbox[c.srs] = c
  11851. },
  11852. ScaleHint: function(a, b) {
  11853. var c = a.getAttribute("min"),
  11854. d = a.getAttribute("max"),
  11855. e = Math.pow(2, 0.5),
  11856. f = GeoGlobe.INCHES_PER_UNIT.m;
  11857. if (c != 0) b.maxScale = parseFloat((c / e * f * GeoGlobe.DOTS_PER_INCH).toPrecision(13));
  11858. if (d != Number.POSITIVE_INFINITY) b.minScale = parseFloat((d / e * f * GeoGlobe.DOTS_PER_INCH).toPrecision(13))
  11859. },
  11860. Dimension: function(a, b) {
  11861. var c = {
  11862. name: a.getAttribute("name").toLowerCase(),
  11863. units: a.getAttribute("units"),
  11864. unitsymbol: a.getAttribute("unitSymbol")
  11865. };
  11866. b.dimensions[c.name] = c
  11867. },
  11868. Extent: function(a, b) {
  11869. var c = a.getAttribute("name").toLowerCase();
  11870. if (c in b.dimensions) {
  11871. c = b.dimensions[c];
  11872. c.nearestVal = a.getAttribute("nearestValue") === "1";
  11873. c.multipleVal = a.getAttribute("multipleValues") === "1";
  11874. c.current = a.getAttribute("current") === "1";
  11875. c["default"] = a.getAttribute("default") || "";
  11876. var d = this.getChildValue(a);
  11877. c.values = d.split(",")
  11878. }
  11879. }
  11880. },
  11881. GeoGlobe.Format.WMSCapabilities.v1.prototype.readers.wms)
  11882. },
  11883. CLASS_NAME: "GeoGlobe.Format.WMSCapabilities.v1_1"
  11884. });
  11885. GeoGlobe.Format.WMSCapabilities.v1_1_0 = GeoGlobe.Class4OL(GeoGlobe.Format.WMSCapabilities.v1_1, {
  11886. version: "1.1.0",
  11887. readers: {
  11888. wms: GeoGlobe.Util.applyDefaults({
  11889. SRS: function(a, b) {
  11890. for (var c = this.getChildValue(a).split(/ +/), d = 0, e = c.length; d < e; d++) b.srs[c[d]] = !0
  11891. }
  11892. }, GeoGlobe.Format.WMSCapabilities.v1_1.prototype.readers.wms)
  11893. },
  11894. CLASS_NAME: "GeoGlobe.Format.WMSCapabilities.v1_1_0"
  11895. });
  11896. GeoGlobe.Format.WMSCapabilities.v1_1_1 = GeoGlobe.Class4OL(GeoGlobe.Format.WMSCapabilities.v1_1, {
  11897. version: "1.1.1",
  11898. readers: {
  11899. wms: GeoGlobe.Util.applyDefaults({
  11900. SRS: function(a, b) {
  11901. b.srs[this.getChildValue(a)] = !0
  11902. }
  11903. }, GeoGlobe.Format.WMSCapabilities.v1_1.prototype.readers.wms)
  11904. },
  11905. CLASS_NAME: "GeoGlobe.Format.WMSCapabilities.v1_1_1"
  11906. });
  11907. GeoGlobe.Format.WMSCapabilities.v1_1_1_WMSC = GeoGlobe.Class4OL(GeoGlobe.Format.WMSCapabilities.v1_1_1, {
  11908. version: "1.1.1",
  11909. profile: "WMSC",
  11910. readers: {
  11911. wms: GeoGlobe.Util.applyDefaults({
  11912. VendorSpecificCapabilities: function(a, b) {
  11913. b.vendorSpecific = {
  11914. tileSets: []
  11915. };
  11916. this.readChildNodes(a, b.vendorSpecific)
  11917. },
  11918. TileSet: function(a, b) {
  11919. var c = {
  11920. srs: {},
  11921. bbox: {},
  11922. resolutions: []
  11923. };
  11924. this.readChildNodes(a, c);
  11925. b.tileSets.push(c)
  11926. },
  11927. Resolutions: function(a, b) {
  11928. for (var c = this.getChildValue(a).split(" "), d = 0, e = c.length; d < e; d++) c[d] != "" && b.resolutions.push(parseFloat(c[d]))
  11929. },
  11930. Width: function(a, b) {
  11931. b.width = parseInt(this.getChildValue(a))
  11932. },
  11933. Height: function(a, b) {
  11934. b.height = parseInt(this.getChildValue(a))
  11935. },
  11936. Layers: function(a, b) {
  11937. b.layers = this.getChildValue(a)
  11938. },
  11939. Styles: function(a, b) {
  11940. b.styles = this.getChildValue(a)
  11941. }
  11942. }, GeoGlobe.Format.WMSCapabilities.v1_1_1.prototype.readers.wms)
  11943. },
  11944. CLASS_NAME: "GeoGlobe.Format.WMSCapabilities.v1_1_1_WMSC"
  11945. });
  11946. GeoGlobe.Format.WMSCapabilities.v1_3 = GeoGlobe.Class4OL(GeoGlobe.Format.WMSCapabilities.v1, {
  11947. readers: {
  11948. wms: GeoGlobe.Util.applyDefaults({
  11949. WMS_Capabilities: function(a, b) {
  11950. this.readChildNodes(a, b)
  11951. },
  11952. LayerLimit: function(a, b) {
  11953. b.layerLimit = parseInt(this.getChildValue(a))
  11954. },
  11955. MaxWidth: function(a, b) {
  11956. b.maxWidth = parseInt(this.getChildValue(a))
  11957. },
  11958. MaxHeight: function(a, b) {
  11959. b.maxHeight = parseInt(this.getChildValue(a))
  11960. },
  11961. BoundingBox: function(a, b) {
  11962. var c = GeoGlobe.Format.WMSCapabilities.v1.prototype.readers.wms.BoundingBox.apply(this, [a, b]);
  11963. c.srs = a.getAttribute("CRS");
  11964. b.bbox[c.srs] = c
  11965. },
  11966. CRS: function(a, b) {
  11967. this.readers.wms.SRS.apply(this, [a, b])
  11968. },
  11969. EX_GeographicBoundingBox: function(a, b) {
  11970. b.llbbox = [];
  11971. this.readChildNodes(a, b.llbbox)
  11972. },
  11973. westBoundLongitude: function(a, b) {
  11974. b[0] = this.getChildValue(a)
  11975. },
  11976. eastBoundLongitude: function(a, b) {
  11977. b[2] = this.getChildValue(a)
  11978. },
  11979. southBoundLatitude: function(a, b) {
  11980. b[1] = this.getChildValue(a)
  11981. },
  11982. northBoundLatitude: function(a, b) {
  11983. b[3] = this.getChildValue(a)
  11984. },
  11985. MinScaleDenominator: function(a, b) {
  11986. b.maxScale = parseFloat(this.getChildValue(a)).toPrecision(16)
  11987. },
  11988. MaxScaleDenominator: function(a, b) {
  11989. b.minScale = parseFloat(this.getChildValue(a)).toPrecision(16)
  11990. },
  11991. Dimension: function(a, b) {
  11992. var c = {
  11993. name: a.getAttribute("name").toLowerCase(),
  11994. units: a.getAttribute("units"),
  11995. unitsymbol: a.getAttribute("unitSymbol"),
  11996. nearestVal: a.getAttribute("nearestValue") === "1",
  11997. multipleVal: a.getAttribute("multipleValues") === "1",
  11998. "default": a.getAttribute("default") || "",
  11999. current: a.getAttribute("current") === "1",
  12000. values: this.getChildValue(a).split(",")
  12001. };
  12002. b.dimensions[c.name] = c
  12003. },
  12004. Keyword: function(a,
  12005. b) {
  12006. var c = {
  12007. value: this.getChildValue(a),
  12008. vocabulary: a.getAttribute("vocabulary")
  12009. };
  12010. b.keywords && b.keywords.push(c)
  12011. }
  12012. }, GeoGlobe.Format.WMSCapabilities.v1.prototype.readers.wms),
  12013. sld: {
  12014. UserDefinedSymbolization: function(a, b) {
  12015. this.readers.wms.UserDefinedSymbolization.apply(this, [a, b]);
  12016. b.userSymbols.inlineFeature = parseInt(a.getAttribute("InlineFeature")) == 1;
  12017. b.userSymbols.remoteWCS = parseInt(a.getAttribute("RemoteWCS")) == 1
  12018. },
  12019. DescribeLayer: function(a, b) {
  12020. this.readers.wms.DescribeLayer.apply(this, [a, b])
  12021. },
  12022. GetLegendGraphic: function(a,
  12023. b) {
  12024. this.readers.wms.GetLegendGraphic.apply(this, [a, b])
  12025. }
  12026. }
  12027. },
  12028. CLASS_NAME: "GeoGlobe.Format.WMSCapabilities.v1_3"
  12029. });
  12030. GeoGlobe.Format.WMSCapabilities.v1_3_0 = GeoGlobe.Class4OL(GeoGlobe.Format.WMSCapabilities.v1_3, {
  12031. version: "1.3.0",
  12032. CLASS_NAME: "GeoGlobe.Format.WMSCapabilities.v1_3_0"
  12033. });
  12034. GeoGlobe.Format.WMSUtil = GeoGlobe.Class4OL({
  12035. initialize: function(a) {
  12036. GeoGlobe.Util.extend(this, a)
  12037. },
  12038. getWMSCapabilities: function(a, b) {
  12039. var c = !0,
  12040. d = null;
  12041. this.getCapabilities(a, b, GeoGlobe.Function.bind(function(b) {
  12042. var f = b.responseXML;
  12043. if (!f || !f.documentElement) f = b.responseText;
  12044. f == null || f == "" ? (this.failFn(a), c = !1) : d = (new GeoGlobe.Format.WMSCapabilities).read(f)
  12045. }, this), function() {
  12046. alert("WMS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" +
  12047. a + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  12048. });
  12049. if (c) return d
  12050. },
  12051. createLayer: function(a, b) {
  12052. var c = !0,
  12053. d = null;
  12054. this.getCapabilities(a, b, GeoGlobe.Function.bind(function(e) {
  12055. var f = e.responseXML;
  12056. if (!f || !f.documentElement) f = e.responseText;
  12057. f == null || f == "" ? (this.failFn(a), c = !1) : (e = (new GeoGlobe.Format.WMSCapabilities).read(f), d = this._createLayer(a, e, b, "2D"))
  12058. }, this), function() {
  12059. alert("WMS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" +
  12060. a + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  12061. });
  12062. if (c) return d
  12063. },
  12064. failFn: function(a) {
  12065. alert("WMS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + a + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  12066. },
  12067. getCapabilities: function(a, b, c, d) {
  12068. var e = {
  12069. REQUEST: "GetCapabilities",
  12070. SERVICE: "WMS",
  12071. VERSION: b && b.version ? b.version : "1.1.1"
  12072. };
  12073. typeof d != "function" && (d =
  12074. function() {
  12075. alert("WMS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + a + "\n\u7248\u672c\u53f7\uff1a" + e[VERSION] + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  12076. });
  12077. GeoGlobe.Request.GET({
  12078. url: a,
  12079. params: e,
  12080. scope: this,
  12081. async: !1,
  12082. success: function(a) {
  12083. typeof c == "function" && c(a)
  12084. },
  12085. failure: d
  12086. })
  12087. },
  12088. _createLayer: function(a, b, c) {
  12089. c || (c = {});
  12090. var d = b.capability,
  12091. e;
  12092. e = d.layers[0];
  12093. for (var f = 0, g = d.layers.length; f < g; ++f)
  12094. if (d.layers[f].name === c.layer) {
  12095. e = d.layers[f];
  12096. break
  12097. }
  12098. if (!e) throw Error("Layer not found");
  12099. d = c.format;
  12100. !d && e.formats && e.formats.length > 0 && (d = e.formats[0]);
  12101. f = c.transparent;
  12102. if (!f || f == "") f = !0;
  12103. var h;
  12104. if (e.name) h = e.name;
  12105. g = c.version;
  12106. if (!g && b.version) g = b.version;
  12107. b = c.srs;
  12108. if (!b && e.srs)
  12109. for (var j in e.srs) b = j;
  12110. b == "EPSG:-9999" && (b = "EPSG:4326");
  12111. e = GeoGlobe.LngLatBounds.fromArray(e.llbbox);
  12112. j = "SERVICE=WMS&REQUEST=GetMap&VERSION=" + g + "&LAYERS=" + h + "&styles=default&CRS=EPSG:3857&BBOX={bbox-epsg-3857}&WIDTH=256&HEIGHT=256&SRS=" +
  12113. b + "&FORMAT=" + d + "&TRANSPARENT=" + f;
  12114. wmts_url = a.endsWith("?") || a.endsWith("&") ? a + j : a + "?" + j;
  12115. return {
  12116. url: wmts_url,
  12117. version: g,
  12118. name: h,
  12119. projection: b,
  12120. format: d,
  12121. bounds: e,
  12122. transparent: f
  12123. }
  12124. },
  12125. CLASS_NAME: "GeoGlobe.Format.WMSUtil"
  12126. });
  12127. GeoGlobe.Format.VTSCapabilities = GeoGlobe.Class4OL(GeoGlobe.Format.XML.VersionedOGC, {
  12128. defaultVersion: "1.0.0",
  12129. yx: {
  12130. "urn:ogc:def:crs:EPSG::4326": !0
  12131. },
  12132. createLayer: function(a, b) {
  12133. if (!("layer" in b)) throw Error("Missing property 'layer' in configuration.");
  12134. for (var c = a.contents, d, e = 0, f = c.layers.length; e < f; ++e)
  12135. if (c.layers[e].identifier === b.layer) {
  12136. d = c.layers[e];
  12137. break
  12138. }
  12139. if (!d) throw Error("Layer not found");
  12140. var g = b.format;
  12141. !g && d.formats && d.formats.length && (g = d.formats[0]);
  12142. var h;
  12143. if (b.matrixSet) h = c.tileMatrixSets[b.matrixSet];
  12144. else if (b.projection)
  12145. for (var e = 0, j = d.tileMatrixSetLinks.length; e < j; e++) {
  12146. if (c.tileMatrixSets[d.tileMatrixSetLinks[e].tileMatrixSet].supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, "$1:$3") === b.projection) {
  12147. h = c.tileMatrixSets[d.tileMatrixSetLinks[e].tileMatrixSet];
  12148. break
  12149. }
  12150. } else d.tileMatrixSetLinks.length >= 1 && (h = c.tileMatrixSets[d.tileMatrixSetLinks[0].tileMatrixSet]);
  12151. if (!h) throw Error("matrixSet not found");
  12152. for (var l, e = 0, f = d.styles.length; e < f; ++e)
  12153. if (l = d.styles[e], l.isDefault) break;
  12154. (c = b.requestEncoding) ||
  12155. (c = "KVP");
  12156. var m = [],
  12157. e = b.params || {};
  12158. delete b.params;
  12159. f = 0;
  12160. for (j = d.dimensions.length; f < j; f++) {
  12161. var n = d.dimensions[f];
  12162. m.push(n.identifier);
  12163. e.hasOwnProperty(n.identifier) || (e[n.identifier] = n["default"])
  12164. }
  12165. for (var m = b.projection || h.supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, "$1:$3"), p = b.units || (m === "EPSG:4326" ? "degrees" : "m"), q = [], o, s, m = [], n = d.tileMatrixSetLinks, f = function(a) {
  12166. q.push(a * 2.8E-4 / GeoGlobe.METERS_PER_INCH / GeoGlobe.INCHES_PER_UNIT[p]);
  12167. if (!o || o > a) o = a;
  12168. if (!s || s < a) s = a
  12169. }, r = 0, j = n.length; r < j; r++)
  12170. if (e =
  12171. n[r], e.tileMatrixSet === h.identifier) {
  12172. if (e.tileMatrixSetLimits) {
  12173. for (var j = {}, r = 0, t = h.matrixIds.length; r < t; r++) j[h.matrixIds[r].identifier] = h.matrixIds[r];
  12174. r = 0;
  12175. for (t = e.tileMatrixSetLimits.length; r < t; r++) n = j[e.tileMatrixSetLimits[r].tileMatrix], m.push(n), f(n.scaleDenominator)
  12176. } else {
  12177. r = 0;
  12178. for (t = h.matrixIds.length; r < t; r++) f(h.matrixIds[r].scaleDenominator)
  12179. }
  12180. break
  12181. }
  12182. if (c === "REST" && d.resourceUrls) {
  12183. m = [];
  12184. e = 0;
  12185. for (f = d.resourceUrls.length; e < f; ++e) c = d.resourceUrls[e], c.format === g && c.resourceType === "tile" && m.push(c.template)
  12186. } else {
  12187. j =
  12188. a.operationsMetadata.GetTile.dcp.http.get;
  12189. m = [];
  12190. e = 0;
  12191. for (f = j.length; e < f; e++) n = j[e].constraints, (!n || n && n.GetEncoding.allowedValues[c]) && m.push(j[e].url)
  12192. }
  12193. q.sort(function(a, b) {
  12194. return b - a
  12195. });
  12196. c = "";
  12197. g = "SERVICE=WMTS&REQUEST=GetTile&VERSION=" + a.version + "&LAYER=" + d.identifier + "&STYLE=" + l.identifier + "&TILEMATRIXSET=" + h.identifier + "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&FORMAT=" + g;
  12198. c = m[0].endsWith("?") ? m[0] + g : m[0] + "?" + g;
  12199. g = GeoGlobe.Util.applyDefaults(b, {
  12200. id: d.identifier,
  12201. url: [c]
  12202. });
  12203. g = new GeoGlobe.Layer.VTS(g);
  12204. g.matrixSet =
  12205. h;
  12206. g.identifier = d.identifier;
  12207. g.bounds = d.bounds;
  12208. return g
  12209. },
  12210. CLASS_NAME: "GeoGlobe.Format.VTSCapabilities"
  12211. });
  12212. GeoGlobe.Format.VTSCapabilities.v1_0_0 = GeoGlobe.Class4OL(GeoGlobe.Format.OWSCommon.v1_1_0, {
  12213. version: "1.0.0",
  12214. namespaces: {
  12215. ows: "http://www.opengis.net/ows/1.1",
  12216. wmts: "http://www.opengis.net/wmts/1.0",
  12217. xlink: "http://www.w3.org/1999/xlink"
  12218. },
  12219. yx: null,
  12220. defaultPrefix: "wmts",
  12221. initialize: function(a) {
  12222. GeoGlobe.Format.XML.prototype.initialize.apply(this, [a]);
  12223. this.options = a;
  12224. a = GeoGlobe.Util.extend({}, GeoGlobe.Format.VTSCapabilities.prototype.yx);
  12225. this.yx = GeoGlobe.Util.extend(a, this.yx)
  12226. },
  12227. read: function(a) {
  12228. typeof a == "string" &&
  12229. (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  12230. if (a && a.nodeType == 9) a = a.documentElement;
  12231. var b = {};
  12232. this.readNode(a, b);
  12233. b.version = this.version;
  12234. return b
  12235. },
  12236. readers: {
  12237. wmts: {
  12238. Capabilities: function(a, b) {
  12239. this.readChildNodes(a, b)
  12240. },
  12241. Contents: function(a, b) {
  12242. b.contents = {};
  12243. b.contents.layers = [];
  12244. b.contents.tileMatrixSets = {};
  12245. this.readChildNodes(a, b.contents)
  12246. },
  12247. Layer: function(a, b) {
  12248. var c = {
  12249. styles: [],
  12250. formats: [],
  12251. dimensions: [],
  12252. tileMatrixSetLinks: []
  12253. };
  12254. this.readChildNodes(a, c);
  12255. b.layers.push(c)
  12256. },
  12257. Style: function(a, b) {
  12258. var c = {};
  12259. c.isDefault = a.getAttribute("isDefault") === "true";
  12260. this.readChildNodes(a, c);
  12261. b.styles.push(c)
  12262. },
  12263. Format: function(a, b) {
  12264. b.formats.push(this.getChildValue(a))
  12265. },
  12266. TileMatrixSetLink: function(a, b) {
  12267. var c = {};
  12268. this.readChildNodes(a, c);
  12269. b.tileMatrixSetLinks.push(c)
  12270. },
  12271. TileMatrixSet: function(a, b) {
  12272. if (b.layers) {
  12273. var c = {
  12274. matrixIds: []
  12275. };
  12276. this.readChildNodes(a, c);
  12277. b.tileMatrixSets[c.identifier] = c
  12278. } else b.tileMatrixSet = this.getChildValue(a)
  12279. },
  12280. TileMatrixSetLimits: function(a, b) {
  12281. b.tileMatrixSetLimits = [];
  12282. this.readChildNodes(a, b)
  12283. },
  12284. TileMatrixLimits: function(a,
  12285. b) {
  12286. var c = {};
  12287. this.readChildNodes(a, c);
  12288. b.tileMatrixSetLimits.push(c)
  12289. },
  12290. MinTileRow: function(a, b) {
  12291. b.minTileRow = parseInt(this.getChildValue(a))
  12292. },
  12293. MaxTileRow: function(a, b) {
  12294. b.maxTileRow = parseInt(this.getChildValue(a))
  12295. },
  12296. MinTileCol: function(a, b) {
  12297. b.minTileCol = parseInt(this.getChildValue(a))
  12298. },
  12299. MaxTileCol: function(a, b) {
  12300. b.maxTileCol = parseInt(this.getChildValue(a))
  12301. },
  12302. TileMatrix: function(a, b) {
  12303. if (b.identifier) {
  12304. var c = {
  12305. supportedCRS: b.supportedCRS
  12306. };
  12307. this.readChildNodes(a, c);
  12308. b.matrixIds.push(c)
  12309. } else b.tileMatrix = this.getChildValue(a)
  12310. },
  12311. ScaleDenominator: function(a, b) {
  12312. b.scaleDenominator = parseFloat(this.getChildValue(a))
  12313. },
  12314. TopLeftCorner: function(a, b) {
  12315. var c = this.getChildValue(a).split(" "),
  12316. d;
  12317. b.supportedCRS && (d = !!this.yx[b.supportedCRS.replace(/urn:ogc:def:crs:(\w+):.+:(\w+)$/, "urn:ogc:def:crs:$1::$2")]);
  12318. b.topLeftCorner = d ? new GeoGlobe.LngLat(c[1], c[0]) : new GeoGlobe.LngLat(c[0], c[1])
  12319. },
  12320. TileWidth: function(a, b) {
  12321. b.tileWidth = parseInt(this.getChildValue(a))
  12322. },
  12323. TileHeight: function(a, b) {
  12324. b.tileHeight = parseInt(this.getChildValue(a))
  12325. },
  12326. MatrixWidth: function(a,
  12327. b) {
  12328. b.matrixWidth = parseInt(this.getChildValue(a))
  12329. },
  12330. MatrixHeight: function(a, b) {
  12331. b.matrixHeight = parseInt(this.getChildValue(a))
  12332. },
  12333. ResourceURL: function(a, b) {
  12334. b.resourceUrl = b.resourceUrl || {};
  12335. var c = a.getAttribute("resourceType");
  12336. if (!b.resourceUrls) b.resourceUrls = [];
  12337. c = b.resourceUrl[c] = {
  12338. format: a.getAttribute("format"),
  12339. template: a.getAttribute("template"),
  12340. resourceType: c
  12341. };
  12342. b.resourceUrls.push(c)
  12343. },
  12344. LegendURL: function(a, b) {
  12345. b.legends = b.legends || [];
  12346. var c = {
  12347. format: a.getAttribute("format"),
  12348. href: a.getAttribute("xlink:href")
  12349. },
  12350. d = a.getAttribute("width"),
  12351. e = a.getAttribute("height"),
  12352. f = a.getAttribute("minScaleDenominator"),
  12353. g = a.getAttribute("maxScaleDenominator");
  12354. if (d !== null) c.width = parseInt(d);
  12355. if (e !== null) c.height = parseInt(e);
  12356. if (f !== null) c.minScaleDenominator = parseInt(f);
  12357. if (g !== null) c.maxScaleDenominator = parseInt(g);
  12358. b.legends.push(c)
  12359. },
  12360. InfoFormat: function(a, b) {
  12361. b.infoFormats = b.infoFormats || [];
  12362. b.infoFormats.push(this.getChildValue(a))
  12363. },
  12364. WSDL: function(a, b) {
  12365. b.wsdl = {};
  12366. b.wsdl.href = a.getAttribute("xlink:href")
  12367. },
  12368. ServiceMetadataURL: function(a,
  12369. b) {
  12370. b.serviceMetadataUrl = {};
  12371. b.serviceMetadataUrl.href = a.getAttribute("xlink:href")
  12372. },
  12373. Dimension: function(a, b) {
  12374. var c = {
  12375. values: []
  12376. };
  12377. this.readChildNodes(a, c);
  12378. b.dimensions.push(c)
  12379. },
  12380. Default: function(a, b) {
  12381. b["default"] = this.getChildValue(a)
  12382. },
  12383. Value: function(a, b) {
  12384. b.values.push(this.getChildValue(a))
  12385. }
  12386. },
  12387. ows: GeoGlobe.Format.OWSCommon.v1_1_0.prototype.readers.ows
  12388. },
  12389. CLASS_NAME: "GeoGlobe.Format.VTSCapabilities.v1_0_0"
  12390. });
  12391. GeoGlobe.Format.WMTSCapabilities = GeoGlobe.Class4OL(GeoGlobe.Format.XML.VersionedOGC, {
  12392. defaultVersion: "1.0.0",
  12393. yx: {
  12394. "urn:ogc:def:crs:EPSG::4326": !0
  12395. },
  12396. createLayer: function(a, b) {
  12397. if (!("layer" in b)) throw Error("Missing property 'layer' in configuration.");
  12398. for (var c = a.contents, d, e = 0, f = c.layers.length; e < f; ++e)
  12399. if (c.layers[e].identifier === b.layer) {
  12400. d = c.layers[e];
  12401. break
  12402. }
  12403. if (!d) throw Error("Layer not found");
  12404. var g = b.format;
  12405. !g && d.formats && d.formats.length && (g = d.formats[0]);
  12406. var h;
  12407. if (b.matrixSet) h = c.tileMatrixSets[b.matrixSet];
  12408. else if (b.projection)
  12409. for (var e = 0, j = d.tileMatrixSetLinks.length; e < j; e++) {
  12410. if (c.tileMatrixSets[d.tileMatrixSetLinks[e].tileMatrixSet].supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, "$1:$3") === b.projection) {
  12411. h = c.tileMatrixSets[d.tileMatrixSetLinks[e].tileMatrixSet];
  12412. break
  12413. }
  12414. } else d.tileMatrixSetLinks.length >= 1 && (h = c.tileMatrixSets[d.tileMatrixSetLinks[0].tileMatrixSet]);
  12415. if (!h) throw Error("matrixSet not found");
  12416. for (var l, e = 0, f = d.styles.length; e < f; ++e)
  12417. if (l = d.styles[e], l.isDefault) break;
  12418. (c = b.requestEncoding) ||
  12419. (c = "KVP");
  12420. var m = [],
  12421. e = b.params || {};
  12422. delete b.params;
  12423. f = 0;
  12424. for (j = d.dimensions.length; f < j; f++) {
  12425. var n = d.dimensions[f];
  12426. m.push(n.identifier);
  12427. e.hasOwnProperty(n.identifier) || (e[n.identifier] = n["default"])
  12428. }
  12429. for (var m = b.projection || h.supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, "$1:$3"), p = b.units || (m === "EPSG:4326" ? "degrees" : "m"), q = [], o, s, m = [], n = d.tileMatrixSetLinks, f = function(a) {
  12430. q.push(a * 2.8E-4 / GeoGlobe.METERS_PER_INCH / GeoGlobe.INCHES_PER_UNIT[p]);
  12431. if (!o || o > a) o = a;
  12432. if (!s || s < a) s = a
  12433. }, r = 0, j = n.length; r < j; r++)
  12434. if (e =
  12435. n[r], e.tileMatrixSet === h.identifier) {
  12436. if (e.tileMatrixSetLimits) {
  12437. for (var j = {}, r = 0, t = h.matrixIds.length; r < t; r++) j[h.matrixIds[r].identifier] = h.matrixIds[r];
  12438. r = 0;
  12439. for (t = e.tileMatrixSetLimits.length; r < t; r++) n = j[e.tileMatrixSetLimits[r].tileMatrix], m.push(n), f(n.scaleDenominator)
  12440. } else {
  12441. r = 0;
  12442. for (t = h.matrixIds.length; r < t; r++) f(h.matrixIds[r].scaleDenominator)
  12443. }
  12444. break
  12445. }
  12446. if (c === "REST" && d.resourceUrls) {
  12447. m = [];
  12448. e = 0;
  12449. for (f = d.resourceUrls.length; e < f; ++e) c = d.resourceUrls[e], c.format === g && c.resourceType === "tile" && m.push(c.template)
  12450. } else {
  12451. j =
  12452. a.operationsMetadata.GetTile.dcp.http.get;
  12453. m = [];
  12454. e = 0;
  12455. for (f = j.length; e < f; e++) n = j[e].constraints, (!n || n && n.GetEncoding.allowedValues[c]) && m.push(j[e].url)
  12456. }
  12457. q.sort(function(a, b) {
  12458. return b - a
  12459. });
  12460. c = "";
  12461. g = "SERVICE=WMTS&REQUEST=GetTile&VERSION=" + a.version + "&LAYER=" + d.identifier + "&STYLE=" + l.identifier + "&TILEMATRIXSET=" + h.identifier + "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&FORMAT=" + g;
  12462. c = m[0].endsWith("?") ? m[0] + g : m[0] + "?" + g;
  12463. g = GeoGlobe.Util.applyDefaults(b, {
  12464. id: d.identifier,
  12465. url: [c]
  12466. });
  12467. g = {
  12468. id: g.id,
  12469. layer: {
  12470. id: g.id,
  12471. type: "raster",
  12472. source: g.id
  12473. },
  12474. source: {
  12475. type: "raster",
  12476. tiles: g.url,
  12477. tileSize: 256
  12478. }
  12479. };
  12480. g.matrixSet = h;
  12481. g.identifier = d.identifier;
  12482. g.bounds = d.bounds;
  12483. return g
  12484. },
  12485. CLASS_NAME: "GeoGlobe.Format.WMTSCapabilities"
  12486. });
  12487. GeoGlobe.Format.WMTSCapabilities.v1_0_0 = GeoGlobe.Class4OL(GeoGlobe.Format.OWSCommon.v1_1_0, {
  12488. version: "1.0.0",
  12489. namespaces: {
  12490. ows: "http://www.opengis.net/ows/1.1",
  12491. wmts: "http://www.opengis.net/wmts/1.0",
  12492. xlink: "http://www.w3.org/1999/xlink"
  12493. },
  12494. yx: null,
  12495. defaultPrefix: "wmts",
  12496. initialize: function(a) {
  12497. GeoGlobe.Format.XML.prototype.initialize.apply(this, [a]);
  12498. this.options = a;
  12499. a = GeoGlobe.Util.extend({}, GeoGlobe.Format.WMTSCapabilities.prototype.yx);
  12500. this.yx = GeoGlobe.Util.extend(a, this.yx)
  12501. },
  12502. read: function(a) {
  12503. typeof a == "string" &&
  12504. (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  12505. if (a && a.nodeType == 9) a = a.documentElement;
  12506. var b = {};
  12507. this.readNode(a, b);
  12508. b.version = this.version;
  12509. return b
  12510. },
  12511. readers: {
  12512. wmts: {
  12513. Capabilities: function(a, b) {
  12514. this.readChildNodes(a, b)
  12515. },
  12516. Contents: function(a, b) {
  12517. b.contents = {};
  12518. b.contents.layers = [];
  12519. b.contents.tileMatrixSets = {};
  12520. this.readChildNodes(a, b.contents)
  12521. },
  12522. Layer: function(a, b) {
  12523. var c = {
  12524. styles: [],
  12525. formats: [],
  12526. dimensions: [],
  12527. tileMatrixSetLinks: []
  12528. };
  12529. this.readChildNodes(a, c);
  12530. b.layers.push(c)
  12531. },
  12532. Style: function(a, b) {
  12533. var c = {};
  12534. c.isDefault = a.getAttribute("isDefault") === "true";
  12535. this.readChildNodes(a, c);
  12536. b.styles.push(c)
  12537. },
  12538. Format: function(a, b) {
  12539. b.formats.push(this.getChildValue(a))
  12540. },
  12541. TileMatrixSetLink: function(a, b) {
  12542. var c = {};
  12543. this.readChildNodes(a, c);
  12544. b.tileMatrixSetLinks.push(c)
  12545. },
  12546. TileMatrixSet: function(a, b) {
  12547. if (b.layers) {
  12548. var c = {
  12549. matrixIds: []
  12550. };
  12551. this.readChildNodes(a, c);
  12552. b.tileMatrixSets[c.identifier] = c
  12553. } else b.tileMatrixSet = this.getChildValue(a)
  12554. },
  12555. TileMatrixSetLimits: function(a, b) {
  12556. b.tileMatrixSetLimits = [];
  12557. this.readChildNodes(a, b)
  12558. },
  12559. TileMatrixLimits: function(a,
  12560. b) {
  12561. var c = {};
  12562. this.readChildNodes(a, c);
  12563. b.tileMatrixSetLimits.push(c)
  12564. },
  12565. MinTileRow: function(a, b) {
  12566. b.minTileRow = parseInt(this.getChildValue(a))
  12567. },
  12568. MaxTileRow: function(a, b) {
  12569. b.maxTileRow = parseInt(this.getChildValue(a))
  12570. },
  12571. MinTileCol: function(a, b) {
  12572. b.minTileCol = parseInt(this.getChildValue(a))
  12573. },
  12574. MaxTileCol: function(a, b) {
  12575. b.maxTileCol = parseInt(this.getChildValue(a))
  12576. },
  12577. TileMatrix: function(a, b) {
  12578. if (b.identifier) {
  12579. var c = {
  12580. supportedCRS: b.supportedCRS
  12581. };
  12582. this.readChildNodes(a, c);
  12583. b.matrixIds.push(c)
  12584. } else b.tileMatrix = this.getChildValue(a)
  12585. },
  12586. ScaleDenominator: function(a, b) {
  12587. b.scaleDenominator = parseFloat(this.getChildValue(a))
  12588. },
  12589. TopLeftCorner: function(a, b) {
  12590. var c = this.getChildValue(a).split(" "),
  12591. d;
  12592. b.supportedCRS && (d = !!this.yx[b.supportedCRS.replace(/urn:ogc:def:crs:(\w+):.+:(\w+)$/, "urn:ogc:def:crs:$1::$2")]);
  12593. b.topLeftCorner = d ? new GeoGlobe.LngLat(c[1], c[0]) : new GeoGlobe.LngLat(c[0], c[1])
  12594. },
  12595. TileWidth: function(a, b) {
  12596. b.tileWidth = parseInt(this.getChildValue(a))
  12597. },
  12598. TileHeight: function(a, b) {
  12599. b.tileHeight = parseInt(this.getChildValue(a))
  12600. },
  12601. MatrixWidth: function(a,
  12602. b) {
  12603. b.matrixWidth = parseInt(this.getChildValue(a))
  12604. },
  12605. MatrixHeight: function(a, b) {
  12606. b.matrixHeight = parseInt(this.getChildValue(a))
  12607. },
  12608. ResourceURL: function(a, b) {
  12609. b.resourceUrl = b.resourceUrl || {};
  12610. var c = a.getAttribute("resourceType");
  12611. if (!b.resourceUrls) b.resourceUrls = [];
  12612. c = b.resourceUrl[c] = {
  12613. format: a.getAttribute("format"),
  12614. template: a.getAttribute("template"),
  12615. resourceType: c
  12616. };
  12617. b.resourceUrls.push(c)
  12618. },
  12619. LegendURL: function(a, b) {
  12620. b.legends = b.legends || [];
  12621. var c = {
  12622. format: a.getAttribute("format"),
  12623. href: a.getAttribute("xlink:href")
  12624. },
  12625. d = a.getAttribute("width"),
  12626. e = a.getAttribute("height"),
  12627. f = a.getAttribute("minScaleDenominator"),
  12628. g = a.getAttribute("maxScaleDenominator");
  12629. if (d !== null) c.width = parseInt(d);
  12630. if (e !== null) c.height = parseInt(e);
  12631. if (f !== null) c.minScaleDenominator = parseInt(f);
  12632. if (g !== null) c.maxScaleDenominator = parseInt(g);
  12633. b.legends.push(c)
  12634. },
  12635. InfoFormat: function(a, b) {
  12636. b.infoFormats = b.infoFormats || [];
  12637. b.infoFormats.push(this.getChildValue(a))
  12638. },
  12639. WSDL: function(a, b) {
  12640. b.wsdl = {};
  12641. b.wsdl.href = a.getAttribute("xlink:href")
  12642. },
  12643. ServiceMetadataURL: function(a,
  12644. b) {
  12645. b.serviceMetadataUrl = {};
  12646. b.serviceMetadataUrl.href = a.getAttribute("xlink:href")
  12647. },
  12648. Dimension: function(a, b) {
  12649. var c = {
  12650. values: []
  12651. };
  12652. this.readChildNodes(a, c);
  12653. b.dimensions.push(c)
  12654. },
  12655. Default: function(a, b) {
  12656. b["default"] = this.getChildValue(a)
  12657. },
  12658. Value: function(a, b) {
  12659. b.values.push(this.getChildValue(a))
  12660. }
  12661. },
  12662. ows: GeoGlobe.Format.OWSCommon.v1_1_0.prototype.readers.ows
  12663. },
  12664. CLASS_NAME: "GeoGlobe.Format.WMTSCapabilities.v1_0_0"
  12665. });
  12666. GeoGlobe.Format.WMTSUtil = GeoGlobe.Class4OL({
  12667. initialize: function(a) {
  12668. GeoGlobe.Util.extend(this, a)
  12669. },
  12670. getWMTSCapabilities: function(a) {
  12671. var b = null;
  12672. this.getCapabilities(a, function(a) {
  12673. var d = a.responseXML;
  12674. if (!d || !d.documentElement) d = a.responseText;
  12675. b = (new GeoGlobe.Format.WMTSCapabilities.v1_0_0).read(d)
  12676. }, function() {
  12677. alert("WMTS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" +
  12678. a + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  12679. });
  12680. return b
  12681. },
  12682. getCapabilities: function(a, b, c) {
  12683. typeof c != "function" && (c = function() {
  12684. alert("WMTS\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + a + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  12685. });
  12686. GeoGlobe.Request.GET({
  12687. url: a,
  12688. params: {
  12689. REQUEST: "GetCapabilities",
  12690. SERVICE: "WMTS"
  12691. },
  12692. scope: this,
  12693. async: !1,
  12694. success: function(a) {
  12695. typeof b ==
  12696. "function" && b(a)
  12697. },
  12698. failure: c
  12699. })
  12700. },
  12701. createLayerOption: function(a, b, c) {
  12702. if (!("layer" in c)) throw Error("Missing property 'layer' in configuration.");
  12703. for (var d = b.contents, e, f = 0, g = d.layers.length; f < g; ++f)
  12704. if (d.layers[f].identifier === c.layer) {
  12705. e = d.layers[f];
  12706. break
  12707. }
  12708. if (!e) throw Error("Layer not found");
  12709. var h = c.format;
  12710. !h && e.formats && e.formats.length && (h = e.formats[0]);
  12711. var j;
  12712. if (c.matrixSet) j = d.tileMatrixSets[c.matrixSet];
  12713. else if (c.projection) {
  12714. f = 0;
  12715. for (g = e.tileMatrixSetLinks.length; f < g; f++)
  12716. if (d.tileMatrixSets[e.tileMatrixSetLinks[f].tileMatrixSet].supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,
  12717. "$1:$3") === c.projection) {
  12718. j = d.tileMatrixSets[e.tileMatrixSetLinks[f].tileMatrixSet];
  12719. break
  12720. }
  12721. } else e.tileMatrixSetLinks.length >= 1 && (j = d.tileMatrixSets[e.tileMatrixSetLinks[0].tileMatrixSet]);
  12722. if (!j) throw Error("matrixSet not found");
  12723. for (var l, f = 0, g = e.styles.length; f < g; ++f)
  12724. if (l = e.styles[f], l.isDefault) break;
  12725. (d = c.requestEncoding) || (d = "KVP");
  12726. d = [];
  12727. f = c.params || {};
  12728. delete c.params;
  12729. for (var g = 0, m = e.dimensions.length; g < m; g++) {
  12730. var n = e.dimensions[g];
  12731. d.push(n.identifier);
  12732. f.hasOwnProperty(n.identifier) || (f[n.identifier] =
  12733. n["default"])
  12734. }
  12735. for (var d = c.projection || j.supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, "$1:$3"), p = c.units || (d === "EPSG:4326" ? "degrees" : "m"), q = [], o, s, c = [], m = e.tileMatrixSetLinks, f = function(a) {
  12736. q.push(a * 2.8E-4 / GeoGlobe.METERS_PER_INCH / GeoGlobe.INCHES_PER_UNIT[p]);
  12737. if (!o || o > a) o = a;
  12738. if (!s || s < a) s = a
  12739. }, n = 0, g = m.length; n < g; n++)
  12740. if (d = m[n], d.tileMatrixSet === j.identifier) {
  12741. if (d.tileMatrixSetLimits) {
  12742. for (var g = {}, n = 0, r = j.matrixIds.length; n < r; n++) g[j.matrixIds[n].identifier] = j.matrixIds[n];
  12743. n = 0;
  12744. for (r = d.tileMatrixSetLimits.length; n <
  12745. r; n++) m = g[d.tileMatrixSetLimits[n].tileMatrix], c.push(m), f(m.scaleDenominator)
  12746. } else {
  12747. n = 0;
  12748. for (r = j.matrixIds.length; n < r; n++) f(j.matrixIds[n].scaleDenominator)
  12749. }
  12750. break
  12751. }
  12752. q.sort(function(a, b) {
  12753. return b - a
  12754. });
  12755. c = "";
  12756. b = GeoGlobe.Util.getParameterString({
  12757. SERVICE: "WMTS",
  12758. REQUEST: "GetTile",
  12759. VERSION: b.version,
  12760. LAYER: e.identifier,
  12761. STYLE: l.identifier,
  12762. TILEMATRIXSET: j.identifier,
  12763. FORMAT: h,
  12764. TILEMATRIX: "{z}",
  12765. TILEROW: "{y}",
  12766. TILECOL: "{x}"
  12767. });
  12768. c = a.endsWith("?") || a.endsWith("&") ? GeoGlobe.ProxyHost + a + b : GeoGlobe.ProxyHost + a + "?" + b;
  12769. a = GeoGlobe.Util.randomStr(10);
  12770. return {
  12771. id: "layer_" + e.identifier + "_" + a,
  12772. type: "raster",
  12773. source: {
  12774. type: "raster",
  12775. tiles: [c],
  12776. tileSize: 256
  12777. },
  12778. paint: {
  12779. "raster-opacity": 1
  12780. }
  12781. }
  12782. },
  12783. createLayer: function(a) {
  12784. var b = this.getWMTSCapabilities(a);
  12785. return this.createLayerOption(a, b, {
  12786. layer: b.contents.layers[0].identifier
  12787. })
  12788. },
  12789. createLayers: function(a) {
  12790. for (var b = this.getWMTSCapabilities(a), c = b.contents.layers, d = [], e = 0; e < c.length; e++) {
  12791. var f = this.createLayerOption(a, b, {
  12792. layer: c[e].identifier
  12793. });
  12794. d.push(f)
  12795. }
  12796. return d
  12797. },
  12798. calculationTopTileExtentAndZoomOffset: function(a) {
  12799. var b = {},
  12800. c = null,
  12801. d = 0.0254,
  12802. e = 111E3,
  12803. f = 96,
  12804. g = [],
  12805. h = [];
  12806. a.units = a.units ? a.units : "degrees";
  12807. if (a.hasOwnProperty("inchConvertMeterRatio")) d = a.inchConvertMeterRatio;
  12808. if (a.hasOwnProperty("degreeConvertMeterRatio")) e = a.degreeConvertMeterRatio;
  12809. if (a.hasOwnProperty("dpi")) f = a.dpi;
  12810. var j = Math.ceil(Math.log(Math.max(Number(a.matrixWidth), Number(a.matrixHeight))) / Math.LN2),
  12811. l = Math.pow(2, j);
  12812. if (a.hasOwnProperty("resolution"))
  12813. if (a.resolution !== "") c = a.resolution;
  12814. else {
  12815. alert("\u8bf7\u8f93\u5165resolution\u503c\uff0c\u6216\u8005\u5c06\u8be5\u5c5e\u6027\u6ce8\u91ca");
  12816. return
  12817. }
  12818. else if (a.units == "m" && (c = a.scaleDenominator * d / f), a.units == "degrees" && (c = a.scaleDenominator * d / (f * e)), a.units !== "m" && a.units !== "degrees") {
  12819. alert("\u8bf7\u786e\u5b9a\u5355\u4f4d\u662fm\u8fd8\u662fdegrees");
  12820. return
  12821. }
  12822. g[0] = a.topLeftCorner[0];
  12823. g[3] = a.topLeftCorner[1];
  12824. g[1] = g[3] - a.tileSize * c * l;
  12825. g[2] = g[0] + a.tileSize * c * l;
  12826. d = j - Number(a.identifier);
  12827. h[0] = (g[0] + g[2]) / 2;
  12828. h[1] = (g[1] + g[3]) / 2;
  12829. e = d - 1;
  12830. if ((g[2] - g[0] < 360 || g[3] - g[1] < 360) && a.units == "degrees") e = Math.ceil(Math.log(360 / (a.tileSize * c * l)) / Math.LN2), f = Math.pow(2,
  12831. e), g[1] = g[3] - a.tileSize * c * l * f, g[2] = g[0] + a.tileSize * c * l * f, h[0] = (g[0] + g[2]) / 2, h[1] = (g[1] + g[3]) / 2, d += e, e = d - 1;
  12832. b.topTileExtent = g;
  12833. b.zoomOffset = d;
  12834. b.centerPoint = h;
  12835. b.proposalZoom = e;
  12836. return b
  12837. },
  12838. CLASS_NAME: "GeoGlobe.Format.WMTSUtil"
  12839. });
  12840. GeoGlobe.Format.WPSCapabilities = GeoGlobe.Class4OL(GeoGlobe.Format.XML.VersionedOGC, {
  12841. defaultVersion: "1.0.0",
  12842. CLASS_NAME: "GeoGlobe.Format.WPSCapabilities"
  12843. });
  12844. GeoGlobe.Format.WPSCapabilities.v1_0_0 = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  12845. namespaces: {
  12846. ows: "http://www.opengis.net/ows/1.1",
  12847. wps: "http://www.opengis.net/wps/1.0.0",
  12848. xlink: "http://www.w3.org/1999/xlink"
  12849. },
  12850. regExes: {
  12851. trimSpace: /^\s*|\s*$/g,
  12852. removeSpace: /\s*/g,
  12853. splitSpace: /\s+/,
  12854. trimComma: /\s*,\s*/g
  12855. },
  12856. initialize: function(a) {
  12857. GeoGlobe.Format.XML.prototype.initialize.apply(this, [a])
  12858. },
  12859. read: function(a) {
  12860. typeof a == "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  12861. if (a && a.nodeType == 9) a = a.documentElement;
  12862. var b = {};
  12863. this.readNode(a, b);
  12864. return b
  12865. },
  12866. readers: {
  12867. wps: {
  12868. Capabilities: function(a, b) {
  12869. this.readChildNodes(a, b)
  12870. },
  12871. ProcessOfferings: function(a, b) {
  12872. b.processOfferings = {};
  12873. this.readChildNodes(a, b.processOfferings)
  12874. },
  12875. Process: function(a, b) {
  12876. var c = {
  12877. processVersion: this.getAttributeNS(a, this.namespaces.wps, "processVersion")
  12878. };
  12879. this.readChildNodes(a, c);
  12880. b[c.identifier] = c
  12881. },
  12882. Languages: function(a, b) {
  12883. b.languages = [];
  12884. this.readChildNodes(a, b.languages)
  12885. },
  12886. Default: function(a, b) {
  12887. var c = {
  12888. isDefault: !0
  12889. };
  12890. this.readChildNodes(a, c);
  12891. b.push(c)
  12892. },
  12893. Supported: function(a, b) {
  12894. var c = {};
  12895. this.readChildNodes(a, c);
  12896. b.push(c)
  12897. }
  12898. },
  12899. ows: GeoGlobe.Format.OWSCommon.v1_1_0.prototype.readers.ows
  12900. },
  12901. CLASS_NAME: "GeoGlobe.Format.WPSCapabilities.v1_0_0"
  12902. });
  12903. GeoGlobe.Format.WCSGetCoverage = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  12904. namespaces: {
  12905. ows: "http://www.opengis.net/ows/1.1",
  12906. wcs: "http://www.opengis.net/wcs/1.1",
  12907. xlink: "http://www.w3.org/1999/xlink",
  12908. xsi: "http://www.w3.org/2001/XMLSchema-instance"
  12909. },
  12910. regExes: {
  12911. trimSpace: /^\s*|\s*$/g,
  12912. removeSpace: /\s*/g,
  12913. splitSpace: /\s+/,
  12914. trimComma: /\s*,\s*/g
  12915. },
  12916. VERSION: "1.1.2",
  12917. schemaLocation: "http://www.opengis.net/wcs/1.1 http://schemas.opengis.net/wcs/1.1/wcsGetCoverage.xsd",
  12918. write: function(a) {
  12919. a = this.writeNode("wcs:GetCoverage",
  12920. a);
  12921. this.setAttributeNS(a, this.namespaces.xsi, "xsi:schemaLocation", this.schemaLocation);
  12922. return GeoGlobe.Format.XML.prototype.write.apply(this, [a])
  12923. },
  12924. writers: {
  12925. wcs: {
  12926. GetCoverage: function(a) {
  12927. var b = this.createElementNSPlus("wcs:GetCoverage", {
  12928. attributes: {
  12929. version: a.version || this.VERSION,
  12930. service: "WCS"
  12931. }
  12932. });
  12933. this.writeNode("ows:Identifier", a.identifier, b);
  12934. this.writeNode("wcs:DomainSubset", a.domainSubset, b);
  12935. this.writeNode("wcs:Output", a.output, b);
  12936. return b
  12937. },
  12938. DomainSubset: function(a) {
  12939. var b = this.createElementNSPlus("wcs:DomainSubset", {});
  12940. this.writeNode("ows:BoundingBox", a.boundingBox, b);
  12941. a.temporalSubset && this.writeNode("wcs:TemporalSubset", a.temporalSubset, b);
  12942. return b
  12943. },
  12944. TemporalSubset: function(a) {
  12945. for (var b = this.createElementNSPlus("wcs:TemporalSubset", {}), c = 0, d = a.timePeriods.length; c < d; ++c) this.writeNode("wcs:TimePeriod", a.timePeriods[c], b);
  12946. return b
  12947. },
  12948. TimePeriod: function(a) {
  12949. var b = this.createElementNSPlus("wcs:TimePeriod", {});
  12950. this.writeNode("wcs:BeginPosition", a.begin, b);
  12951. this.writeNode("wcs:EndPosition", a.end, b);
  12952. a.resolution && this.writeNode("wcs:TimeResolution",
  12953. a.resolution, b);
  12954. return b
  12955. },
  12956. BeginPosition: function(a) {
  12957. return this.createElementNSPlus("wcs:BeginPosition", {
  12958. value: a
  12959. })
  12960. },
  12961. EndPosition: function(a) {
  12962. return this.createElementNSPlus("wcs:EndPosition", {
  12963. value: a
  12964. })
  12965. },
  12966. TimeResolution: function(a) {
  12967. return this.createElementNSPlus("wcs:TimeResolution", {
  12968. value: a
  12969. })
  12970. },
  12971. Output: function(a) {
  12972. var b = this.createElementNSPlus("wcs:Output", {
  12973. attributes: {
  12974. format: a.format,
  12975. store: a.store
  12976. }
  12977. });
  12978. a.gridCRS && this.writeNode("wcs:GridCRS", a.gridCRS, b);
  12979. return b
  12980. },
  12981. GridCRS: function(a) {
  12982. var b = this.createElementNSPlus("wcs:GridCRS", {});
  12983. this.writeNode("wcs:GridBaseCRS", a.baseCRS, b);
  12984. a.type && this.writeNode("wcs:GridType", a.type, b);
  12985. a.origin && this.writeNode("wcs:GridOrigin", a.origin, b);
  12986. this.writeNode("wcs:GridOffsets", a.offsets, b);
  12987. a.CS && this.writeNode("wcs:GridCS", a.CS, b);
  12988. return b
  12989. },
  12990. GridBaseCRS: function(a) {
  12991. return this.createElementNSPlus("wcs:GridBaseCRS", {
  12992. value: a
  12993. })
  12994. },
  12995. GridOrigin: function(a) {
  12996. return this.createElementNSPlus("wcs:GridOrigin", {
  12997. value: a
  12998. })
  12999. },
  13000. GridType: function(a) {
  13001. return this.createElementNSPlus("wcs:GridType", {
  13002. value: a
  13003. })
  13004. },
  13005. GridOffsets: function(a) {
  13006. return this.createElementNSPlus("wcs:GridOffsets", {
  13007. value: a
  13008. })
  13009. },
  13010. GridCS: function(a) {
  13011. return this.createElementNSPlus("wcs:GridCS", {
  13012. value: a
  13013. })
  13014. }
  13015. },
  13016. ows: GeoGlobe.Format.OWSCommon.v1_1_0.prototype.writers.ows
  13017. },
  13018. CLASS_NAME: "GeoGlobe.Format.WCSGetCoverage"
  13019. });
  13020. GeoGlobe.Format.WPSExecute = GeoGlobe.Class4OL(GeoGlobe.Format.XML, GeoGlobe.Format.Filter.v1_1_0, {
  13021. namespaces: {
  13022. ows: "http://www.opengis.net/ows/1.1",
  13023. gml: "http://www.opengis.net/gml",
  13024. wps: "http://www.opengis.net/wps/1.0.0",
  13025. wfs: "http://www.opengis.net/wfs",
  13026. ogc: "http://www.opengis.net/ogc",
  13027. wcs: "http://www.opengis.net/wcs",
  13028. xlink: "http://www.w3.org/1999/xlink",
  13029. xsi: "http://www.w3.org/2001/XMLSchema-instance"
  13030. },
  13031. regExes: {
  13032. trimSpace: /^\s*|\s*$/g,
  13033. removeSpace: /\s*/g,
  13034. splitSpace: /\s+/,
  13035. trimComma: /\s*,\s*/g
  13036. },
  13037. VERSION: "1.0.0",
  13038. schemaLocation: "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd",
  13039. schemaLocationAttr: function() {},
  13040. write: function(a) {
  13041. var b;
  13042. GeoGlobe.Format.XML.supportActiveX ? this.xmldom = b = new ActiveXObject("Microsoft.XMLDOM") : b = document.implementation.createDocument("", "", null);
  13043. a = this.writeNode("wps:Execute", a, b);
  13044. this.setAttributeNS(a, this.namespaces.xsi, "xsi:schemaLocation", this.schemaLocation);
  13045. return GeoGlobe.Format.XML.prototype.write.apply(this, [a])
  13046. },
  13047. read: function(a) {
  13048. typeof a ==
  13049. "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  13050. if (a && a.nodeType == 9) a = a.documentElement;
  13051. var b = {};
  13052. this.readNode(a, b);
  13053. return b
  13054. },
  13055. writers: {
  13056. wps: {
  13057. Execute: function(a) {
  13058. var b = this.createElementNSPlus("wps:Execute", {
  13059. attributes: {
  13060. version: this.VERSION,
  13061. service: "WPS"
  13062. }
  13063. });
  13064. this.writeNode("ows:Identifier", a.identifier, b);
  13065. this.writeNode("wps:DataInputs", a.dataInputs, b);
  13066. this.writeNode("wps:ResponseForm", a.responseForm, b);
  13067. return b
  13068. },
  13069. ResponseForm: function(a) {
  13070. var b = this.createElementNSPlus("wps:ResponseForm", {});
  13071. a.rawDataOutput && this.writeNode("wps:RawDataOutput", a.rawDataOutput, b);
  13072. a.responseDocument && this.writeNode("wps:ResponseDocument", a.responseDocument, b);
  13073. return b
  13074. },
  13075. ResponseDocument: function(a) {
  13076. var b = this.createElementNSPlus("wps:ResponseDocument", {
  13077. attributes: {
  13078. storeExecuteResponse: a.storeExecuteResponse,
  13079. lineage: a.lineage,
  13080. status: a.status
  13081. }
  13082. });
  13083. if (a.outputs)
  13084. for (var c = 0, d = a.outputs.length; c < d; c++) this.writeNode("wps:Output", a.outputs[c], b);
  13085. return b
  13086. },
  13087. Output: function(a) {
  13088. var b = this.createElementNSPlus("wps:Output", {
  13089. attributes: {
  13090. asReference: a.asReference,
  13091. mimeType: a.mimeType,
  13092. encoding: a.encoding,
  13093. schema: a.schema
  13094. }
  13095. });
  13096. this.writeNode("ows:Identifier", a.identifier, b);
  13097. this.writeNode("ows:Title", a.title, b);
  13098. this.writeNode("ows:Abstract", a["abstract"], b);
  13099. return b
  13100. },
  13101. RawDataOutput: function(a) {
  13102. var b = this.createElementNSPlus("wps:RawDataOutput", {
  13103. attributes: {
  13104. mimeType: a.mimeType,
  13105. encoding: a.encoding,
  13106. schema: a.schema
  13107. }
  13108. });
  13109. this.writeNode("ows:Identifier", a.identifier, b);
  13110. return b
  13111. },
  13112. DataInputs: function(a) {
  13113. for (var b = this.createElementNSPlus("wps:DataInputs", {}), c = 0, d = a.length; c < d; ++c) this.writeNode("wps:Input", a[c], b);
  13114. return b
  13115. },
  13116. Input: function(a) {
  13117. var b = this.createElementNSPlus("wps:Input", {});
  13118. this.writeNode("ows:Identifier", a.identifier, b);
  13119. a.title && this.writeNode("ows:Title", a.title, b);
  13120. a.data && this.writeNode("wps:Data", a.data, b);
  13121. a.reference && this.writeNode("wps:Reference", a.reference, b);
  13122. a.boundingBoxData && this.writeNode("wps:BoundingBoxData", a.boundingBoxData, b);
  13123. return b
  13124. },
  13125. Data: function(a) {
  13126. var b = this.createElementNSPlus("wps:Data", {});
  13127. a.literalData ? this.writeNode("wps:LiteralData",
  13128. a.literalData, b) : a.complexData ? this.writeNode("wps:ComplexData", a.complexData, b) : a.boundingBoxData && this.writeNode("ows:BoundingBox", a.boundingBoxData, b);
  13129. return b
  13130. },
  13131. LiteralData: function(a) {
  13132. return this.createElementNSPlus("wps:LiteralData", {
  13133. attributes: {
  13134. uom: a.uom
  13135. },
  13136. value: a.value
  13137. })
  13138. },
  13139. ComplexData: function(a) {
  13140. var b = this.createElementNSPlus("wps:ComplexData", {
  13141. attributes: {
  13142. mimeType: a.mimeType,
  13143. encoding: a.encoding,
  13144. schema: a.schema
  13145. }
  13146. }),
  13147. c = a.value;
  13148. typeof c === "string" ? b.appendChild(this.getXMLDoc().createCDATASection(a.value)) :
  13149. b.appendChild(c);
  13150. return b
  13151. },
  13152. Reference: function(a) {
  13153. var b = this.createElementNSPlus("wps:Reference", {
  13154. attributes: {
  13155. mimeType: a.mimeType,
  13156. "xlink:href": a.href,
  13157. method: a.method,
  13158. encoding: a.encoding,
  13159. schema: a.schema
  13160. }
  13161. });
  13162. a.body && this.writeNode("wps:Body", a.body, b);
  13163. return b
  13164. },
  13165. BoundingBoxData: function(a, b) {
  13166. this.writers.ows.BoundingBox.apply(this, [a, b, "wps:BoundingBoxData"])
  13167. },
  13168. Body: function(a) {
  13169. var b = this.createElementNSPlus("wps:Body", {});
  13170. a.wcs ? this.writeNode("wcs:GetCoverage", a.wcs, b) : a.wfs ? (this.featureType = a.wfs.featureType,
  13171. this.version = a.wfs.version, this.writeNode("wfs:GetFeature", a.wfs, b)) : this.writeNode("wps:Execute", a, b);
  13172. return b
  13173. }
  13174. },
  13175. wcs: GeoGlobe.Format.WCSGetCoverage.prototype.writers.wcs,
  13176. wfs: GeoGlobe.Format.WFST.v1_1_0.prototype.writers.wfs,
  13177. ogc: GeoGlobe.Format.Filter.v1_1_0.prototype.writers.ogc,
  13178. ows: GeoGlobe.Format.OWSCommon.v1_1_0.prototype.writers.ows
  13179. },
  13180. readers: {
  13181. wps: {
  13182. ExecuteResponse: function(a, b) {
  13183. b.executeResponse = {
  13184. lang: a.getAttribute("lang"),
  13185. statusLocation: a.getAttribute("statusLocation"),
  13186. serviceInstance: a.getAttribute("serviceInstance"),
  13187. service: a.getAttribute("service")
  13188. };
  13189. this.readChildNodes(a, b.executeResponse)
  13190. },
  13191. Process: function(a, b) {
  13192. b.process = {};
  13193. this.readChildNodes(a, b.process)
  13194. },
  13195. Status: function(a, b) {
  13196. b.status = {
  13197. creationTime: a.getAttribute("creationTime")
  13198. };
  13199. this.readChildNodes(a, b.status)
  13200. },
  13201. ProcessSucceeded: function(a, b) {
  13202. b.processSucceeded = !0
  13203. },
  13204. ProcessOutputs: function(a, b) {
  13205. b.processOutputs = [];
  13206. this.readChildNodes(a, b.processOutputs)
  13207. },
  13208. Output: function(a, b) {
  13209. var c = {};
  13210. this.readChildNodes(a, c);
  13211. b.push(c)
  13212. },
  13213. Reference: function(a, b) {
  13214. b.reference = {
  13215. href: a.getAttribute("href"),
  13216. mimeType: a.getAttribute("mimeType"),
  13217. encoding: a.getAttribute("encoding"),
  13218. schema: a.getAttribute("schema")
  13219. }
  13220. },
  13221. Data: function(a, b) {
  13222. b.data = {};
  13223. this.readChildNodes(a, b)
  13224. },
  13225. LiteralData: function(a, b) {
  13226. b.literalData = {
  13227. dataType: a.getAttribute("dataType"),
  13228. uom: a.getAttribute("uom"),
  13229. value: this.getChildValue(a)
  13230. }
  13231. },
  13232. ComplexData: function(a, b) {
  13233. b.complexData = {
  13234. mimeType: a.getAttribute("mimeType"),
  13235. schema: a.getAttribute("schema"),
  13236. encoding: a.getAttribute("encoding"),
  13237. value: ""
  13238. };
  13239. if (this.isSimpleContent(a)) {
  13240. var c;
  13241. for (c = a.firstChild; c; c = c.nextSibling) switch (c.nodeType) {
  13242. case 3:
  13243. case 4:
  13244. b.complexData.value += c.nodeValue
  13245. }
  13246. } else
  13247. for (c = a.firstChild; c; c = c.nextSibling)
  13248. if (c.nodeType == 1) b.complexData.value = c
  13249. },
  13250. BoundingBox: function(a, b) {
  13251. b.boundingBoxData = {
  13252. dimensions: a.getAttribute("dimensions"),
  13253. crs: a.getAttribute("crs")
  13254. };
  13255. this.readChildNodes(a, b.boundingBoxData)
  13256. }
  13257. },
  13258. ows: GeoGlobe.Format.OWSCommon.v1_1_0.prototype.readers.ows
  13259. },
  13260. CLASS_NAME: "GeoGlobe.Format.WPSExecute"
  13261. });
  13262. GeoGlobe.Format.OGCExceptionReport = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  13263. namespaces: {
  13264. ogc: "http://www.opengis.net/ogc"
  13265. },
  13266. regExes: {
  13267. trimSpace: /^\s*|\s*$/g,
  13268. removeSpace: /\s*/g,
  13269. splitSpace: /\s+/,
  13270. trimComma: /\s*,\s*/g
  13271. },
  13272. defaultPrefix: "ogc",
  13273. read: function(a) {
  13274. typeof a == "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  13275. var b = {
  13276. exceptionReport: null
  13277. };
  13278. a.documentElement && (this.readChildNodes(a, b), b.exceptionReport === null && (b = (new GeoGlobe.Format.OWSCommon).read(a)));
  13279. return b
  13280. },
  13281. readers: {
  13282. ogc: {
  13283. ServiceExceptionReport: function(a,
  13284. b) {
  13285. b.exceptionReport = {
  13286. exceptions: []
  13287. };
  13288. this.readChildNodes(a, b.exceptionReport)
  13289. },
  13290. ServiceException: function(a, b) {
  13291. var c = {
  13292. code: a.getAttribute("code"),
  13293. locator: a.getAttribute("locator"),
  13294. text: this.getChildValue(a)
  13295. };
  13296. b.exceptions.push(c)
  13297. }
  13298. }
  13299. },
  13300. CLASS_NAME: "GeoGlobe.Format.OGCExceptionReport"
  13301. });
  13302. GeoGlobe.Format.QueryStringFilter = function() {
  13303. function a(a) {
  13304. a = a.replace(/%/g, "\\%");
  13305. a = a.replace(/\\\\\.(\*)?/g, function(a, b) {
  13306. return b ? a : "\\\\_"
  13307. });
  13308. a = a.replace(/\\\\\.\*/g, "\\\\%");
  13309. a = a.replace(/(\\)?\.(\*)?/g, function(a, b, c) {
  13310. return b || c ? a : "_"
  13311. });
  13312. a = a.replace(/(\\)?\.\*/g, function(a, b) {
  13313. return b ? a : "%"
  13314. });
  13315. a = a.replace(/\\\./g, ".");
  13316. return a = a.replace(/(\\)?\\\*/g, function(a, b) {
  13317. return b ? a : "*"
  13318. })
  13319. }
  13320. var b = {};
  13321. b[GeoGlobe.Filter.Comparison.EQUAL_TO] = "eq";
  13322. b[GeoGlobe.Filter.Comparison.NOT_EQUAL_TO] = "ne";
  13323. b[GeoGlobe.Filter.Comparison.LESS_THAN] =
  13324. "lt";
  13325. b[GeoGlobe.Filter.Comparison.LESS_THAN_OR_EQUAL_TO] = "lte";
  13326. b[GeoGlobe.Filter.Comparison.GREATER_THAN] = "gt";
  13327. b[GeoGlobe.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO] = "gte";
  13328. b[GeoGlobe.Filter.Comparison.LIKE] = "ilike";
  13329. return GeoGlobe.Class4OL(GeoGlobe.Format, {
  13330. wildcarded: !1,
  13331. srsInBBOX: !1,
  13332. write: function(c, d) {
  13333. var d = d || {},
  13334. e = c.CLASS_NAME,
  13335. e = e.substring(e.lastIndexOf(".") + 1);
  13336. switch (e) {
  13337. case "Spatial":
  13338. switch (c.type) {
  13339. case GeoGlobe.Filter.Spatial.BBOX:
  13340. d.bbox = c.value.toArray();
  13341. this.srsInBBOX && c.projection && d.bbox.push(c.projection.getCode());
  13342. break;
  13343. case GeoGlobe.Filter.Spatial.DWITHIN:
  13344. d.tolerance = c.distance;
  13345. case GeoGlobe.Filter.Spatial.WITHIN:
  13346. d.lon = c.value.x;
  13347. d.lat = c.value.y;
  13348. break;
  13349. default:
  13350. GeoGlobe.Console.warn("Unknown spatial filter type " + c.type)
  13351. }
  13352. break;
  13353. case "Comparison":
  13354. e = b[c.type];
  13355. if (e !== void 0) {
  13356. var f = c.value;
  13357. c.type == GeoGlobe.Filter.Comparison.LIKE && (f = a(f), this.wildcarded && (f = "%" + f + "%"));
  13358. d[c.property + "__" + e] = f;
  13359. d.queryable = d.queryable || [];
  13360. d.queryable.push(c.property)
  13361. } else GeoGlobe.Console.warn("Unknown comparison filter type " + c.type);
  13362. break;
  13363. case "Logical":
  13364. if (c.type === GeoGlobe.Filter.Logical.AND) {
  13365. e = 0;
  13366. for (f = c.filters.length; e < f; e++) d = this.write(c.filters[e], d)
  13367. } else GeoGlobe.Console.warn("Unsupported logical filter type " + c.type);
  13368. break;
  13369. default:
  13370. GeoGlobe.Console.warn("Unknown filter type " + e)
  13371. }
  13372. return d
  13373. },
  13374. CLASS_NAME: "GeoGolobe.Format.QueryStringFilter"
  13375. })
  13376. }();
  13377. GeoGlobe.Format.BusCapabilities = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  13378. tagName: "NETWORK_Capabilities",
  13379. read: function(a) {
  13380. typeof a == "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  13381. var a = a.nodeName != this.tagName ? a.getElementsByTagName(this.tagName) : [a],
  13382. b = {};
  13383. a.length > 0 && this.runChildNodes(b, a[0]);
  13384. return b
  13385. },
  13386. runChildNodes: function(a, b, c) {
  13387. for (var b = b.childNodes, d, e, f = 0; f < b.length; ++f) d = b[f], d.nodeType == 1 && (e = c ? this["read_" + c + "_" + d.nodeName] : this["read_" + d.nodeName]) && e.apply(this, [a, d])
  13388. },
  13389. read_Service: function(a, b) {
  13390. var c = {};
  13391. this.runChildNodes(c, b, "Service");
  13392. a.service = c
  13393. },
  13394. read_Service_Name: function(a, b) {
  13395. var c = this.getChildValue(b);
  13396. if (c) a.name = c
  13397. },
  13398. read_Service_Title: function(a, b) {
  13399. var c = this.getChildValue(b);
  13400. if (c) a.title = c
  13401. },
  13402. read_Service_Abstract: function(a, b) {
  13403. var c = this.getChildValue(b);
  13404. if (c) a.serviceAbstract = c
  13405. },
  13406. read_Service_KeywordList: function() {},
  13407. read_Service_OnlineResource: function(a, b) {
  13408. var c = this.getChildValue(b);
  13409. if (a) a.onlineResource = c
  13410. },
  13411. read_Capability: function(a, b) {
  13412. var c = {};
  13413. this.runChildNodes(c,
  13414. b, "Capability");
  13415. a.capability = c
  13416. },
  13417. read_Capability_Request: function(a, b) {
  13418. var c = {};
  13419. this.runChildNodes(c, b, "Capability_Request");
  13420. a.request = c
  13421. },
  13422. read_Capability_Request_GetCapabilities: function(a, b) {
  13423. var c = b.getElementsByTagName("HTTP"),
  13424. d = {};
  13425. c[0] && this.runChildNodes(d, c[0], "Capability_Request_GetCapabilities_DCPType_HTTP");
  13426. a.getCapabilities = d
  13427. },
  13428. read_Capability_Request_GetCapabilities_DCPType_HTTP_Get: function(a, b) {
  13429. var c = b.getAttribute("onlineResource");
  13430. if (c) a.getUrl = c
  13431. },
  13432. read_Capability_Request_GetCapabilities_DCPType_HTTP_Post: function(a,
  13433. b) {
  13434. var c = b.getAttribute("onlineResource");
  13435. if (c) a.postUrl = c
  13436. },
  13437. read_Capability_Request_queryStation: function(a, b) {
  13438. var c = b.getElementsByTagName("HTTP"),
  13439. d = {};
  13440. c[0] && this.runChildNodes(d, c[0], "Capability_Request_queryStation_DCPType_HTTP");
  13441. a.queryStation = d
  13442. },
  13443. read_Capability_Request_queryStation_DCPType_HTTP_Get: function(a, b) {
  13444. var c = b.getAttribute("onlineResource");
  13445. if (c) a.getUrl = c
  13446. },
  13447. read_Capability_Request_queryStation_DCPType_HTTP_Post: function(a, b) {
  13448. var c = b.getAttribute("onlineResource");
  13449. if (c) a.postUrl = c
  13450. },
  13451. read_Capability_Request_queryLine: function(a, b) {
  13452. var c = b.getElementsByTagName("HTTP"),
  13453. d = {};
  13454. c[0] && this.runChildNodes(d, c[0], "Capability_Request_queryLine_DCPType_HTTP");
  13455. a.queryLine = d
  13456. },
  13457. read_Capability_Request_queryLine_DCPType_HTTP_Get: function(a, b) {
  13458. var c = b.getAttribute("onlineResource");
  13459. if (c) a.getUrl = c
  13460. },
  13461. read_Capability_Request_queryLine_DCPType_HTTP_Post: function(a, b) {
  13462. var c = b.getAttribute("onlineResource");
  13463. if (c) a.postUrl = c
  13464. },
  13465. read_Capability_Request_queryChange: function(a, b) {
  13466. var c = b.getElementsByTagName("HTTP"),
  13467. d = {};
  13468. c[0] && this.runChildNodes(d, c[0], "Capability_Request_queryChange_DCPType_HTTP")
  13469. },
  13470. read_Capability_Request_queryChange_DCPType_HTTP_Get: function(a, b) {
  13471. var c = b.getAttribute("onlineResource");
  13472. if (c) a.getUrl = c
  13473. },
  13474. read_Capability_Request_queryChange_DCPType_HTTP_Post: function(a, b) {
  13475. var c = b.getAttribute("onlineResource");
  13476. if (c) a.postUrl = c
  13477. },
  13478. read_Capability_Networks: function(a, b) {
  13479. for (var c = b.getElementsByTagName("Name"), d = [], e = 0; e < c.length; e++) {
  13480. var f = this.getChildValue(c[e]);
  13481. f && d.push(f)
  13482. }
  13483. a.networks = d
  13484. },
  13485. CLASS_NAME: "GeoGlobe.Format.BusCapabilities"
  13486. });
  13487. GeoGlobe.Format.XML2JSON = GeoGlobe.Class4OL({
  13488. initialize: function() {},
  13489. read: function(a, b, c) {
  13490. b || (b = "");
  13491. a = a.replace(/\s*\/>/g, "/>");
  13492. a = a.replace(/<\?[^>]*>/g, "").replace(/<\![^>]*>/g, "");
  13493. b.sort || (b = b.split(","));
  13494. for (var a = this.no_fast_endings(a), a = this.attris_to_tags(a), a = escape(a), a = a.split("%3C").join("<").split("%3E").join(">").split("%3D").join("=").split("%22").join('"'), d = 0; d < b.length; d++) a = a.replace(RegExp("<" + b[d] + ">", "g"), "*$**" + b[d] + "**$*"), a = a.replace(RegExp("</" + b[d] + ">", "g"), "*$***" + b[d] + "**$*");
  13495. this.xmlobject = {};
  13496. b = this.xml_to_object("<JSONTAGWRAPPER>" + a + "</JSONTAGWRAPPER>").JSONTAGWRAPPER;
  13497. c && (b = this.show_json_structure(b, c));
  13498. return b
  13499. },
  13500. xml_to_object: function(a) {
  13501. for (var b = a.replace(/<\//g, "?"), b = b.split("<"), a = [], c = 0, d = [], e = 1; e < b.length; e++) {
  13502. var f = b[e].split(">")[0];
  13503. d.push(f);
  13504. c++;
  13505. for (a.push(c + "<" + b[e].split("?")[0]); b[e].indexOf("?" + d[d.length - 1] + ">") >= 0;) c--, d.pop()
  13506. }
  13507. for (var g = -1, b = "this.xmlobject", e = 0; e < a.length; e++) {
  13508. var c = "",
  13509. d = a[e].split("<")[0],
  13510. h = a[e].split("<")[1].split(">")[0],
  13511. h = h.replace(/%3A/,
  13512. "_"),
  13513. f = a[e].split(">")[1];
  13514. if (d <= g)
  13515. for (var g = g - d + 1, j = 0; j < g; j++) b = b.substring(0, b.lastIndexOf("."));
  13516. b += "." + h;
  13517. g = b.substring(0, b.lastIndexOf("."));
  13518. eval("typeof " + g) != "object" && (c += g + "={value:" + g + "};\n");
  13519. j = b.substring(b.lastIndexOf(".") + 1);
  13520. h = !1;
  13521. for (k in eval(g)) k == j && (h = !0);
  13522. g = !0;
  13523. for (j = 0; j < f.length; j += 3) f.charAt(j) != "%" && (g = !1);
  13524. f != "" && !g ? f / 1 != f && (f = "'" + f.replace(/\'/g, "\\'") + "'", f = f.replace(/\*\$\*\*\*/g, "</"), f = f.replace(/\*\$\*\*/g, "<"), f = f.replace(/\*\*\$\*/g, ">")) : f = "{}";
  13525. f.charAt(0) == "'" && (f = "unescape(" +
  13526. f + ")");
  13527. h && !eval(b + ".sort") && (c += b + "=[" + b + "];\n");
  13528. g = "=";
  13529. after = "";
  13530. h && (g = ".push(", after = ")");
  13531. eval(c + b + g + f + after);
  13532. eval(b + ".sort") && (b += "[" + eval(b + ".length-1") + "]");
  13533. g = d
  13534. }
  13535. return this.xmlobject
  13536. },
  13537. show_json_structure: function(a, b, c) {
  13538. var d = "";
  13539. d += a.sort ? "[\n" : "{\n";
  13540. for (var e in a) a.sort || (d += e + ":"), d += typeof a[e] == "object" ? this.show_json_structure(a[e], !1, 1) : typeof a[e] == "function" ? a[e] + "" : typeof a[e] != "string" ? a[e] + ",\n" : "'" + a[e].replace(/\'/g, "\\'").replace(/\n/g, "\\n").replace(/\t/g, "\\t").replace(/\r/g, "\\r") +
  13541. "',\n";
  13542. d += a.sort ? "],\n" : "},\n";
  13543. if (!c) {
  13544. d = d.substring(0, d.lastIndexOf(","));
  13545. d = d.replace(RegExp(",\n}", "g"), "\n}");
  13546. d = d.replace(RegExp(",\n]", "g"), "\n]");
  13547. a = d.split("\n");
  13548. d = "";
  13549. for (e = c = 0; e < a.length; e++) {
  13550. (a[e].indexOf("}") >= 0 || a[e].indexOf("]") >= 0) && c--;
  13551. tabs = "";
  13552. for (var f = 0; f < c; f++) tabs += "\t";
  13553. d += tabs + a[e] + "\n";
  13554. (a[e].indexOf("{") >= 0 || a[e].indexOf("[") >= 0) && c++
  13555. }
  13556. b == "html" && (d = d.replace(/</g, "&lt;").replace(/>/g, "&gt;"), d = d.replace(/\n/g, "<BR>").replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;"));
  13557. b == "compact" && (d = d.replace(/\n/g,
  13558. "").replace(/\t/g, ""))
  13559. }
  13560. return d
  13561. },
  13562. no_fast_endings: function(a) {
  13563. for (var a = a.split("/>"), b = 1; b < a.length; b++) {
  13564. var c = a[b - 1].substring(a[b - 1].lastIndexOf("<") + 1).split(" ")[0];
  13565. a[b] = "></" + c + ">" + a[b]
  13566. }
  13567. return a = a.join("")
  13568. },
  13569. attris_to_tags: function(a) {
  13570. for (var b = " =\"'".split(""), a = a.split(">"), c = 0; c < a.length; c++) {
  13571. for (var d = a[c].split("<"), e = 0; e < 4; e++) d[0] = d[0].replace(RegExp(b[e], "g"), "_jsonconvtemp" + e + "_");
  13572. if (d[1]) {
  13573. d[1] = d[1].replace(/'/g, '"');
  13574. d[1] = d[1].split('"');
  13575. for (var f = 1; f < d[1].length; f += 2)
  13576. for (e = 0; e < 4; e++) d[1][f] =
  13577. d[1][f].replace(RegExp(b[e], "g"), "_jsonconvtemp" + e + "_");
  13578. d[1] = d[1].join('"')
  13579. }
  13580. a[c] = d.join("<")
  13581. }
  13582. a = a.join(">");
  13583. a = a.replace(/ ([^=]*)=([^ |>]*)/g, "><$1>$2</$1");
  13584. a = a.replace(/>"/g, ">").replace(/"</g, "<");
  13585. for (e = 0; e < 4; e++) a = a.replace(RegExp("_jsonconvtemp" + e + "_", "g"), b[e]);
  13586. return a
  13587. },
  13588. CLASS_NAME: "GeoGlobe.Format.XML2JSON"
  13589. });
  13590. GeoGlobe.Format.CSWGetRecords = function(a) {
  13591. var a = GeoGlobe.Util.applyDefaults(a, GeoGlobe.Format.CSWGetRecords.DEFAULTS),
  13592. b = GeoGlobe.Format.CSWGetRecords["v" + a.version.replace(/\./g, "_")];
  13593. if (!b) throw "Unsupported CSWGetRecords version: " + a.version;
  13594. return new b(a)
  13595. };
  13596. GeoGlobe.Format.CSWGetRecords.DEFAULTS = {
  13597. version: "2.0.2"
  13598. };
  13599. GeoGlobe.Format.CSWGetRecords.v2_0_2 = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  13600. namespaces: {
  13601. csw: "http://www.opengis.net/cat/csw/2.0.2",
  13602. dc: "http://purl.org/dc/elements/1.1/",
  13603. dct: "http://purl.org/dc/terms/",
  13604. gmd: "http://www.isotc211.org/2005/gmd",
  13605. geonet: "http://www.fao.org/geonetwork",
  13606. ogc: "http://www.opengis.net/ogc",
  13607. ows: "http://www.opengis.net/ows",
  13608. xlink: "http://www.w3.org/1999/xlink",
  13609. xsi: "http://www.w3.org/2001/XMLSchema-instance"
  13610. },
  13611. defaultPrefix: "csw",
  13612. version: "2.0.2",
  13613. schemaLocation: "http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd",
  13614. requestId: null,
  13615. resultType: null,
  13616. outputFormat: null,
  13617. outputSchema: null,
  13618. startPosition: null,
  13619. maxRecords: null,
  13620. DistributedSearch: null,
  13621. ResponseHandler: null,
  13622. Query: null,
  13623. regExes: {
  13624. trimSpace: /^\s*|\s*$/g,
  13625. removeSpace: /\s*/g,
  13626. splitSpace: /\s+/,
  13627. trimComma: /\s*,\s*/g
  13628. },
  13629. initialize: function(a) {
  13630. GeoGlobe.Format.XML.prototype.initialize.apply(this, [a])
  13631. },
  13632. read: function(a) {
  13633. typeof a == "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  13634. if (a && a.nodeType == 9) a = a.documentElement;
  13635. var b = {};
  13636. this.readNode(a, b);
  13637. return b
  13638. },
  13639. readers: {
  13640. csw: {
  13641. GetRecordsResponse: function(a,
  13642. b) {
  13643. b.records = [];
  13644. this.readChildNodes(a, b);
  13645. var c = this.getAttributeNS(a, "", "version");
  13646. if (c != "") b.version = c
  13647. },
  13648. RequestId: function(a, b) {
  13649. b.RequestId = this.getChildValue(a)
  13650. },
  13651. SearchStatus: function(a, b) {
  13652. b.SearchStatus = {};
  13653. var c = this.getAttributeNS(a, "", "timestamp");
  13654. if (c != "") b.SearchStatus.timestamp = c
  13655. },
  13656. SearchResults: function(a, b) {
  13657. this.readChildNodes(a, b);
  13658. for (var c = a.attributes, d = {}, e = 0, f = c.length; e < f; ++e) d[c[e].name] = c[e].name == "numberOfRecordsMatched" || c[e].name == "numberOfRecordsReturned" || c[e].name == "nextRecord" ?
  13659. parseInt(c[e].nodeValue) : c[e].nodeValue;
  13660. b.SearchResults = d
  13661. },
  13662. SummaryRecord: function(a, b) {
  13663. var c = {
  13664. type: "SummaryRecord"
  13665. };
  13666. this.readChildNodes(a, c);
  13667. b.records.push(c)
  13668. },
  13669. BriefRecord: function(a, b) {
  13670. var c = {
  13671. type: "BriefRecord"
  13672. };
  13673. this.readChildNodes(a, c);
  13674. b.records.push(c)
  13675. },
  13676. DCMIRecord: function(a, b) {
  13677. var c = {
  13678. type: "DCMIRecord"
  13679. };
  13680. this.readChildNodes(a, c);
  13681. b.records.push(c)
  13682. },
  13683. Record: function(a, b) {
  13684. var c = {
  13685. type: "Record"
  13686. };
  13687. this.readChildNodes(a, c);
  13688. b.records.push(c)
  13689. },
  13690. "*": function(a, b) {
  13691. var c = a.localName || a.nodeName.split(":").pop();
  13692. b[c] = this.getChildValue(a)
  13693. }
  13694. },
  13695. geonet: {
  13696. info: function(a, b) {
  13697. var c = {};
  13698. this.readChildNodes(a, c);
  13699. b.gninfo = c
  13700. }
  13701. },
  13702. dc: {
  13703. "*": function(a, b) {
  13704. var c = a.localName || a.nodeName.split(":").pop();
  13705. GeoGlobe.Util.isArray(b[c]) || (b[c] = []);
  13706. for (var d = {}, e = a.attributes, f = 0, g = e.length; f < g; ++f) d[e[f].name] = e[f].nodeValue;
  13707. d.value = this.getChildValue(a);
  13708. d.value != "" && b[c].push(d)
  13709. }
  13710. },
  13711. dct: {
  13712. "*": function(a, b) {
  13713. var c = a.localName || a.nodeName.split(":").pop();
  13714. GeoGlobe.Util.isArray(b[c]) || (b[c] = []);
  13715. b[c].push(this.getChildValue(a))
  13716. }
  13717. },
  13718. ows: GeoGlobe.Util.applyDefaults({
  13719. BoundingBox: function(a,
  13720. b) {
  13721. if (b.bounds) b.BoundingBox = [{
  13722. crs: b.projection,
  13723. value: [b.bounds._sw.lng, b.bounds._sw.lat, b.bounds._ne.lng, b.bounds._ne.lat]
  13724. }], delete b.projection, delete b.bounds;
  13725. GeoGlobe.Format.OWSCommon.v1_0_0.prototype.readers.ows.BoundingBox.apply(this, arguments)
  13726. }
  13727. }, GeoGlobe.Format.OWSCommon.v1_0_0.prototype.readers.ows)
  13728. },
  13729. write: function(a) {
  13730. a = this.writeNode("csw:GetRecords", a);
  13731. a.setAttribute("xmlns:gmd", this.namespaces.gmd);
  13732. return GeoGlobe.Format.XML.prototype.write.apply(this, [a])
  13733. },
  13734. writers: {
  13735. csw: {
  13736. GetRecords: function(a) {
  13737. a ||
  13738. (a = {});
  13739. var b = this.createElementNSPlus("csw:GetRecords", {
  13740. attributes: {
  13741. service: "CSW",
  13742. version: this.version,
  13743. requestId: a.requestId || this.requestId,
  13744. resultType: a.resultType || this.resultType,
  13745. outputFormat: a.outputFormat || this.outputFormat,
  13746. outputSchema: a.outputSchema || this.outputSchema,
  13747. startPosition: a.startPosition || this.startPosition,
  13748. maxRecords: a.maxRecords || this.maxRecords
  13749. }
  13750. });
  13751. if (a.DistributedSearch || this.DistributedSearch) this.writeNode("csw:DistributedSearch", a.DistributedSearch || this.DistributedSearch, b);
  13752. var c = a.ResponseHandler || this.ResponseHandler;
  13753. if (GeoGlobe.Util.isArray(c) && c.length > 0)
  13754. for (var d = 0, e = c.length; d < e; d++) this.writeNode("csw:ResponseHandler", c[d], b);
  13755. this.writeNode("Query", a.Query || this.Query, b);
  13756. return b
  13757. },
  13758. DistributedSearch: function(a) {
  13759. return this.createElementNSPlus("csw:DistributedSearch", {
  13760. attributes: {
  13761. hopCount: a.hopCount
  13762. }
  13763. })
  13764. },
  13765. ResponseHandler: function(a) {
  13766. return this.createElementNSPlus("csw:ResponseHandler", {
  13767. value: a.value
  13768. })
  13769. },
  13770. Query: function(a) {
  13771. a || (a = {});
  13772. var b = this.createElementNSPlus("csw:Query", {
  13773. attributes: {
  13774. typeNames: a.typeNames || "csw:Record"
  13775. }
  13776. }),
  13777. c = a.ElementName;
  13778. if (GeoGlobe.Util.isArray(c) && c.length > 0)
  13779. for (var d = 0, e = c.length; d < e; d++) this.writeNode("csw:ElementName", c[d], b);
  13780. else this.writeNode("csw:ElementSetName", a.ElementSetName || {
  13781. value: "summary"
  13782. }, b);
  13783. a.Constraint && this.writeNode("csw:Constraint", a.Constraint, b);
  13784. a.SortBy && this.writeNode("ogc:SortBy", a.SortBy, b);
  13785. return b
  13786. },
  13787. ElementName: function(a) {
  13788. return this.createElementNSPlus("csw:ElementName", {
  13789. value: a.value
  13790. })
  13791. },
  13792. ElementSetName: function(a) {
  13793. return this.createElementNSPlus("csw:ElementSetName", {
  13794. attributes: {
  13795. typeNames: a.typeNames
  13796. },
  13797. value: a.value
  13798. })
  13799. },
  13800. Constraint: function(a) {
  13801. var b = this.createElementNSPlus("csw:Constraint", {
  13802. attributes: {
  13803. version: a.version
  13804. }
  13805. });
  13806. if (a.Filter) {
  13807. var c = new GeoGlobe.Format.Filter({
  13808. version: a.version
  13809. });
  13810. b.appendChild(c.write(a.Filter))
  13811. } else a.CqlText && (a = this.createElementNSPlus("CqlText", {
  13812. value: a.CqlText.value
  13813. }), b.appendChild(a));
  13814. return b
  13815. }
  13816. },
  13817. ogc: GeoGlobe.Format.Filter.v1_1_0.prototype.writers.ogc
  13818. },
  13819. CLASS_NAME: "GeoGlobe.Format.CSWGetRecords.v2_0_2"
  13820. });
  13821. (function(a, b) {
  13822. a.GeoGlobe.Format.X2JS = b();
  13823. a.GeoGlobe.Format.X2JS.CLASS_NAME = "GeoGlobe.Format.X2JS"
  13824. })(window, function() {
  13825. return function(a) {
  13826. function b(a) {
  13827. var b = a.localName;
  13828. if (b == null) b = a.baseName;
  13829. if (b == null || b == "") b = a.nodeName;
  13830. return b
  13831. }
  13832. function c(a) {
  13833. return typeof a == "string" ? a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;") : a
  13834. }
  13835. function d(a, b, c, d) {
  13836. for (var e = 0; e < a.length; e++) {
  13837. var f = a[e];
  13838. if (typeof f === "string") {
  13839. if (f == d) break
  13840. } else if (f instanceof RegExp) {
  13841. if (f.test(d)) break
  13842. } else if (typeof f === "function" && f(b, c, d)) break
  13843. }
  13844. return e != a.length
  13845. }
  13846. function e(b, c, e) {
  13847. switch (a.arrayAccessForm) {
  13848. case "property":
  13849. b[c + "_asArray"] = b[c] instanceof Array ? b[c] : [b[c]]
  13850. }!(b[c] instanceof Array) && a.arrayAccessFormPaths.length > 0 && d(a.arrayAccessFormPaths, b, c, e) && (b[c] = [b[c]])
  13851. }
  13852. function f(a) {
  13853. var b = a.split(/[-T:+Z]/g),
  13854. c = new Date(b[0], b[1] - 1, b[2]),
  13855. d = b[5].split(".");
  13856. c.setHours(b[3], b[4], d[0]);
  13857. d.length > 1 && c.setMilliseconds(d[1]);
  13858. b[6] && b[7] ? (b = b[6] * 60 + Number(b[7]), b = 0 + ((/\d\d-\d\d:\d\d$/.test(a) ?
  13859. "-" : "+") == "-" ? -1 * b : b), c.setMinutes(c.getMinutes() - b - c.getTimezoneOffset())) : a.indexOf("Z", a.length - 1) !== -1 && (c = new Date(Date.UTC(c.getFullYear(), c.getMonth(), c.getDate(), c.getHours(), c.getMinutes(), c.getSeconds(), c.getMilliseconds())));
  13860. return c
  13861. }
  13862. function g(b, c, e) {
  13863. return a.datetimeAccessFormPaths.length > 0 ? (e = e.split(".#")[0], d(a.datetimeAccessFormPaths, b, c, e) ? f(b) : b) : b
  13864. }
  13865. function h(c, f) {
  13866. if (c.nodeType == s.DOCUMENT_NODE) {
  13867. for (var j = {}, l = c.childNodes, m = 0; m < l.length; m++) {
  13868. var n = l.item(m);
  13869. if (n.nodeType == s.ELEMENT_NODE) {
  13870. var o =
  13871. b(n);
  13872. j[o] = h(n, o)
  13873. }
  13874. }
  13875. return j
  13876. } else if (c.nodeType == s.ELEMENT_NODE) {
  13877. j = {};
  13878. j.__cnt = 0;
  13879. l = c.childNodes;
  13880. for (m = 0; m < l.length; m++)
  13881. if (n = l.item(m), o = b(n), n.nodeType != s.COMMENT_NODE) {
  13882. var p = f + "." + o;
  13883. if (n.nodeType == s.ELEMENT_NODE && a.xmlElementsFilter.length > 0 ? d(a.xmlElementsFilter, j, o, p) : 1) j.__cnt++, j[o] == null ? (j[o] = h(n, p), e(j, o, p)) : (j[o] != null && !(j[o] instanceof Array) && (j[o] = [j[o]], e(j, o, p)), j[o][j[o].length] = h(n, p))
  13884. }
  13885. for (l = 0; l < c.attributes.length; l++) m = c.attributes.item(l), j.__cnt++, j[a.attributePrefix + m.name] = m.value;
  13886. l = c.prefix;
  13887. if (l != null && l != "") j.__cnt++, j.__prefix = l;
  13888. if (j["#text"] != null) {
  13889. j.__text = j["#text"];
  13890. if (j.__text instanceof Array) j.__text = j.__text.join("\n");
  13891. if (a.stripWhitespaces) j.__text = j.__text.trim();
  13892. delete j["#text"];
  13893. a.arrayAccessForm == "property" && delete j["#text_asArray"];
  13894. j.__text = g(j.__text, o, f + "." + o)
  13895. }
  13896. if (j["#cdata-section"] != null) j.__cdata = j["#cdata-section"], delete j["#cdata-section"], a.arrayAccessForm == "property" && delete j["#cdata-section_asArray"];
  13897. j.__cnt == 0 && a.emptyNodeForm == "text" ? j = "" : j.__cnt ==
  13898. 1 && j.__text != null ? j = j.__text : j.__cnt == 1 && j.__cdata != null && !a.keepCData ? j = j.__cdata : j.__cnt > 1 && j.__text != null && a.skipEmptyTextNodesForObj && (a.stripWhitespaces && j.__text == "" || j.__text.trim() == "") && delete j.__text;
  13899. delete j.__cnt;
  13900. if (a.enableToStringFunc && (j.__text != null || j.__cdata != null)) j.toString = function() {
  13901. return (this.__text != null ? this.__text : "") + (this.__cdata != null ? this.__cdata : "")
  13902. };
  13903. return j
  13904. } else if (c.nodeType == s.TEXT_NODE || c.nodeType == s.CDATA_SECTION_NODE) return c.nodeValue
  13905. }
  13906. function j(b, d, e, f) {
  13907. d =
  13908. "<" + (b != null && b.__prefix != null ? b.__prefix + ":" : "") + d;
  13909. if (e != null)
  13910. for (var g = 0; g < e.length; g++) {
  13911. var h = e[g],
  13912. j = b[h];
  13913. a.escapeMode && (j = c(j));
  13914. d += " " + h.substr(a.attributePrefix.length) + "=";
  13915. d += a.useDoubleQuotes ? '"' + j + '"' : "'" + j + "'"
  13916. }
  13917. d += f ? "/>" : ">";
  13918. return d
  13919. }
  13920. function l(a, b) {
  13921. return "</" + (a.__prefix != null ? a.__prefix + ":" : "") + b + ">"
  13922. }
  13923. function m(b, c) {
  13924. return a.arrayAccessForm == "property" && c.toString().indexOf("_asArray", c.toString().length - 8) !== -1 || c.toString().indexOf(a.attributePrefix) == 0 || c.toString().indexOf("__") == 0 ||
  13925. b[c] instanceof Function ? !0 : !1
  13926. }
  13927. function n(a) {
  13928. var b = 0;
  13929. if (a instanceof Object)
  13930. for (var c in a) m(a, c) || b++;
  13931. return b
  13932. }
  13933. function p(b) {
  13934. var c = [];
  13935. if (b instanceof Object)
  13936. for (var d in b) d.toString().indexOf("__") == -1 && d.toString().indexOf(a.attributePrefix) == 0 && c.push(d);
  13937. return c
  13938. }
  13939. function q(b) {
  13940. var d = "";
  13941. if (b instanceof Object) {
  13942. var e = "";
  13943. b.__cdata != null && (e += "<![CDATA[" + b.__cdata + "]]\>");
  13944. b.__text != null && (e += a.escapeMode ? c(b.__text) : b.__text);
  13945. d += e
  13946. } else b != null && (d += a.escapeMode ? c(b) : b);
  13947. return d
  13948. }
  13949. function o(b, c) {
  13950. var e =
  13951. "";
  13952. if (n(b) > 0)
  13953. for (var f in b) {
  13954. var g;
  13955. if (!(g = m(b, f)))
  13956. if (g = c != "") g = c === "" ? f : c + "." + f, g = !(a.jsonPropertiesFilter.length == 0 || g == "" || d(a.jsonPropertiesFilter, b, f, g));
  13957. if (!g) {
  13958. var h = b[f];
  13959. g = p(h);
  13960. if (h == null || h == void 0) e += j(h, f, g, !0);
  13961. else if (h instanceof Object)
  13962. if (h instanceof Array) {
  13963. var s = f,
  13964. x = c,
  13965. w = "";
  13966. if (h.length == 0) w += j(h, s, g, !0);
  13967. else
  13968. for (g = 0; g < h.length; g++) w += j(h[g], s, p(h[g]), !1), w += o(h[g], x === "" ? s : x + "." + s), w += l(h[g], s);
  13969. e += w
  13970. } else h instanceof Date ? (e += j(h, f, g, !1), e += h.toISOString(), e += l(h, f)) : n(h) > 0 || h.__text !=
  13971. null || h.__cdata != null ? (e += j(h, f, g, !1), e += o(h, c === "" ? f : c + "." + f), e += l(h, f)) : e += j(h, f, g, !0);
  13972. else e += j(h, f, g, !1), e += q(h), e += l(h, f)
  13973. }
  13974. }
  13975. e += q(b);
  13976. return e
  13977. }
  13978. a = a || {};
  13979. if (a.escapeMode === void 0) a.escapeMode = !0;
  13980. a.attributePrefix = a.attributePrefix || "_";
  13981. a.arrayAccessForm = a.arrayAccessForm || "none";
  13982. a.emptyNodeForm = a.emptyNodeForm || "text";
  13983. if (a.enableToStringFunc === void 0) a.enableToStringFunc = !0;
  13984. a.arrayAccessFormPaths = a.arrayAccessFormPaths || [];
  13985. if (a.skipEmptyTextNodesForObj === void 0) a.skipEmptyTextNodesForObj = !0;
  13986. if (a.stripWhitespaces ===
  13987. void 0) a.stripWhitespaces = !0;
  13988. a.datetimeAccessFormPaths = a.datetimeAccessFormPaths || [];
  13989. if (a.useDoubleQuotes === void 0) a.useDoubleQuotes = !1;
  13990. a.xmlElementsFilter = a.xmlElementsFilter || [];
  13991. a.jsonPropertiesFilter = a.jsonPropertiesFilter || [];
  13992. if (a.keepCData === void 0) a.keepCData = !1;
  13993. var s = {
  13994. ELEMENT_NODE: 1,
  13995. TEXT_NODE: 3,
  13996. CDATA_SECTION_NODE: 4,
  13997. COMMENT_NODE: 8,
  13998. DOCUMENT_NODE: 9
  13999. };
  14000. this.parseXmlString = function(a) {
  14001. var b = window.ActiveXObject || "ActiveXObject" in window;
  14002. if (a === void 0) return null;
  14003. var c;
  14004. if (window.DOMParser) {
  14005. var d = new window.DOMParser,
  14006. e = null;
  14007. if (!b) try {
  14008. e = d.parseFromString("INVALID", "text/xml").getElementsByTagName("parsererror")[0].namespaceURI
  14009. } catch (f) {
  14010. e = null
  14011. }
  14012. try {
  14013. c = d.parseFromString(a, "text/xml"), e != null && c.getElementsByTagNameNS(e, "parsererror").length > 0 && (c = null)
  14014. } catch (g) {
  14015. c = null
  14016. }
  14017. } else a.indexOf("<?") == 0 && (a = a.substr(a.indexOf("?>") + 2)), c = new ActiveXObject("Microsoft.XMLDOM"), c.async = "false", c.loadXML(a);
  14018. return c
  14019. };
  14020. this.asArray = function(a) {
  14021. return a === void 0 || a == null ? [] : a instanceof Array ? a : [a]
  14022. };
  14023. this.toXmlDateTime = function(a) {
  14024. return a instanceof
  14025. Date ? a.toISOString() : typeof a === "number" ? (new Date(a)).toISOString() : null
  14026. };
  14027. this.asDateTime = function(a) {
  14028. return typeof a == "string" ? f(a) : a
  14029. };
  14030. this.xml2json = function(a) {
  14031. return h(a)
  14032. };
  14033. this.xml_str2json = function(a) {
  14034. a = this.parseXmlString(a);
  14035. return a != null ? this.xml2json(a) : null
  14036. };
  14037. this.json2xml_str = function(a) {
  14038. return o(a, "")
  14039. };
  14040. this.json2xml = function(a) {
  14041. return this.parseXmlString(this.json2xml_str(a))
  14042. };
  14043. this.getVersion = function() {
  14044. return "1.2.0"
  14045. }
  14046. }
  14047. });
  14048. GeoGlobe.Format.GeoJSONUtil = GeoGlobe.Class4OL({
  14049. initialize: function() {},
  14050. read: function(a, b) {
  14051. var c = null;
  14052. if (this._isValidType(b)) c = this._manyToFeatures(a, b);
  14053. else throw "type \u7c7b\u578b\u9519\u8bef! Point|LineString|Polygon";
  14054. return c
  14055. },
  14056. _isValidType: function(a) {
  14057. var b = !1;
  14058. switch (a) {
  14059. case "Point":
  14060. b = !0;
  14061. break;
  14062. case "LineString":
  14063. b = !0;
  14064. break;
  14065. case "Polygon":
  14066. b = !0;
  14067. break;
  14068. default:
  14069. b = !1
  14070. }
  14071. return b
  14072. },
  14073. _manyToFeatures: function(a, b) {
  14074. var c = {
  14075. type: "geojson",
  14076. data: {
  14077. type: "FeatureCollection",
  14078. features: []
  14079. }
  14080. };
  14081. try {
  14082. for (var d = 0; d < a.length; d++) c.data.features.push({
  14083. type: "Feature",
  14084. properties: {},
  14085. geometry: {
  14086. type: b,
  14087. coordinates: a[d]
  14088. }
  14089. })
  14090. } catch (e) {
  14091. throw "arr \u6570\u636e\u9519\u8bef! [Point]|[[LineString]]|[[[Polygon]]]";
  14092. }
  14093. return c
  14094. },
  14095. _oneToFeatures: function(a, b) {
  14096. return {
  14097. type: "geojson",
  14098. data: {
  14099. type: "Feature",
  14100. properties: {},
  14101. geometry: {
  14102. type: b,
  14103. coordinates: a
  14104. }
  14105. }
  14106. }
  14107. },
  14108. point: function(a) {
  14109. return this._oneToFeatures(a, "Point")
  14110. },
  14111. line: function(a) {
  14112. return this._oneToFeatures(a, "LineString")
  14113. },
  14114. polygon: function(a) {
  14115. return this._oneToFeatures(a, "Polygon")
  14116. },
  14117. points: function(a) {
  14118. return this._manyToFeatures(a, "Point")
  14119. },
  14120. lines: function(a) {
  14121. return this._manyToFeatures(a, "LineString")
  14122. },
  14123. polygons: function(a) {
  14124. return this._manyToFeatures(a, "Polygon")
  14125. },
  14126. geoProperties: function(a) {
  14127. return a instanceof Array ? this._setFeatureCollection(a) : this._setFeature(a)
  14128. },
  14129. _setFeature: function(a) {
  14130. return {
  14131. type: "geojson",
  14132. data: {
  14133. type: "Feature",
  14134. properties: a.properties || {},
  14135. geometry: a.geometry
  14136. }
  14137. }
  14138. },
  14139. _setFeatureCollection: function(a) {
  14140. var b = {
  14141. type: "geojson",
  14142. data: {
  14143. type: "FeatureCollection",
  14144. features: []
  14145. }
  14146. };
  14147. try {
  14148. for (var c = 0; c < a.length; c++) b.data.features.push({
  14149. type: "Feature",
  14150. properties: a[c].properties || {},
  14151. geometry: a[c].geometry
  14152. })
  14153. } catch (d) {
  14154. throw "arr \u6570\u636e\u9519\u8bef! [Point]|[[LineString]]|[[[Polygon]]]";
  14155. }
  14156. return b
  14157. },
  14158. CLASS_NAME: "GeoGlobe.Format.GeoJSONUtil"
  14159. });
  14160. GeoGlobe.Analysis.BufferAnalysis = GeoGlobe.Class4OL({
  14161. url: null,
  14162. type: 1,
  14163. accuracy: 32,
  14164. initialize: function(a, b) {
  14165. this.url = a;
  14166. GeoGlobe.Util.extend(this, b)
  14167. },
  14168. _buildPostXML: function(a, b) {
  14169. return '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><wps:Execute service="WPS" version="1.0.0" xmlns:gml="http://www.opengis.net/gml" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 ../wpsExecute_request.xsd"><ows:Identifier>Buffer</ows:Identifier><wps:DataInputs><wps:Input><ows:Identifier>InputPolygon</ows:Identifier><wps:Data><wps:ComplexData schema="http://foo.bar/MyComplexValueSchema.xsd" mimeType="text/xml" encoding="UTF-8">' + (new GeoGlobe.Format.GML).write(a) +
  14170. "</wps:ComplexData></wps:Data></wps:Input><wps:Input><ows:Identifier>BufferDistance</ows:Identifier><wps:Data><wps:LiteralData>" + b + "</wps:LiteralData></wps:Data></wps:Input><wps:Input><ows:Identifier>BufferType</ows:Identifier><wps:Data><wps:LiteralData>" + this.type + "</wps:LiteralData></wps:Data></wps:Input><wps:Input><ows:Identifier>BufferAccuracy</ows:Identifier><wps:Data><wps:LiteralData>" + this.accuracy + "</wps:LiteralData></wps:Data></wps:Input></wps:DataInputs><wps:ResponseForm><wps:RawDataOutput><ows:Identifier>BufferedPolygon</ows:Identifier></wps:RawDataOutput></wps:ResponseForm></wps:Execute>"
  14171. },
  14172. _getFeaturesCenter: function(a) {
  14173. return this._getFeaturesExtent(a).getCenterLonLat()
  14174. },
  14175. _getFeaturesExtent: function(a) {
  14176. GeoGlobe.Util.isArray(a) || (a = [a]);
  14177. var b = null;
  14178. if (a && a.length > 0)
  14179. for (var b = new GeoGlobe.LngLatBounds, c = null, d = 0, e = a.length; d < e; d++)(c = a[d].geometry) && b.extend(c.getBounds());
  14180. return b
  14181. },
  14182. startAnalysis: function(a, b, c) {
  14183. var d = ["m", "km", "degree"],
  14184. a = (new GeoGlobe.Format.GeoJSON).read(a),
  14185. e = this._getFeaturesCenter(a);
  14186. if (!c || GeoGlobe.Util.indexOf(d, c) == -1) c = "m";
  14187. switch (c) {
  14188. case "km":
  14189. b *= 1E3;
  14190. case "m":
  14191. b =
  14192. this._meterToDegree(b, e)
  14193. }
  14194. b = this._buildPostXML(a, b);
  14195. new GeoGlobe.Request.POST({
  14196. url: this.url,
  14197. data: b,
  14198. scope: this,
  14199. success: function(a) {
  14200. "" == a.responseText || null == a.responseText ? this.failFn() : (a = this._parserResult(a), a = (new GeoGlobe.Format.GeoJSON).write(a), this.successFn((new GeoGlobe.Format.JSON).read(a)))
  14201. },
  14202. failure: this.failFn
  14203. })
  14204. },
  14205. _meterToDegree: function(a, b) {
  14206. return a * (8.99E-6 / Math.cos(GeoGlobe.Util.rad(b.lat)))
  14207. },
  14208. successFn: function() {},
  14209. failFn: function() {
  14210. alert("\u7f13\u51b2\u5206\u6790\u64cd\u4f5c\u5931\u8d25\uff0c\u8bf7\u68c0\u6d4b\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u3002")
  14211. },
  14212. _parserResult: function(a) {
  14213. var b = null,
  14214. b = new GeoGlobe.Format.XML;
  14215. if (!a.responseXML) a.responseXML = b.read(a.responseText);
  14216. return b = (new GeoGlobe.Format.GML).read(a.responseXML)
  14217. },
  14218. CLASS_NAME: "GeoGlobe.Analysis.BufferAnalysis"
  14219. });
  14220. GeoGlobe.Analysis.BufferAnalysis.CAP_ROUND = 1;
  14221. GeoGlobe.Analysis.BufferAnalysis.CAP_BUTT = 2;
  14222. GeoGlobe.Analysis.BufferAnalysis.CAP_SQUARE = 3;
  14223. GeoGlobe.Analysis.GetFeature = GeoGlobe.Class4OL({
  14224. url: null,
  14225. type: "intersection",
  14226. _reqStrTemplate: "{'GetFeature': {'service': 'OverlapService','version': '1.0.0','dataSource':'${sourceInputs}','Query': [{'typeName':'${dataInputs}'}],'maxFeatures': '','startPosition': '','outPutFormat': 'GeoJSON','resultType': ''}}",
  14227. initialize: function(a, b) {
  14228. this.url = a;
  14229. GeoGlobe.Util.extend(this, b)
  14230. },
  14231. _buildReqStr: function() {
  14232. return GeoGlobe.String.format(this._reqStrTemplate, {
  14233. type: this.type,
  14234. dataInputs: this.typeName,
  14235. sourceInputs: this.DataSource
  14236. })
  14237. },
  14238. startAnalysis: function() {
  14239. if (this._checkSet()) return !1;
  14240. var a = this._buildReqStr();
  14241. new GeoGlobe.Request.POST({
  14242. url: this.url,
  14243. data: a,
  14244. scope: this,
  14245. success: function(a) {
  14246. "" == a.responseText || null == a.responseText ? this.failFn() : this.successFn(a)
  14247. },
  14248. failure: this.failFn
  14249. })
  14250. },
  14251. _checkSet: function() {
  14252. if (!this.url) return !1
  14253. },
  14254. successFn: function() {},
  14255. failFn: function() {
  14256. alert("\u670d\u52a1\u8bf7\u6c42\u64cd\u4f5c\u5931\u8d25\uff0c\u8bf7\u68c0\u6d4b\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u3002")
  14257. },
  14258. CLASS_NAME: "GeoGlobe.Analysis.GetFeature"
  14259. });
  14260. GeoGlobe.Analysis.SpatialAnalysis = GeoGlobe.Class({
  14261. url: null,
  14262. type: "intersection",
  14263. _requestStrTemplate: "{'SpatialAnalysis': {'service': 'OverlapService','version': '1.0.0','origionLayerNames': ['${origionLayerNames}'],'targetLayerNames': ['${targetLayerNames}'],'outPutFormat': 'GeoJSON','operator': '${dataInputs}','isSynchronization': 'true','tolerance': '${tolerance}'}}",
  14264. initialize: function(a, b) {
  14265. this.url = a;
  14266. GeoGlobe.Util.extend(this, b)
  14267. },
  14268. _buildRequestStr: function() {
  14269. return GeoGlobe.String.format(this._requestStrTemplate, {
  14270. type: this.type,
  14271. dataInputs: this.operator,
  14272. origionLayerNames: this.origionLayerNames,
  14273. targetLayerNames: this.targetLayerNames,
  14274. tolerance: this.tolerance
  14275. })
  14276. },
  14277. startAnalysis: function(a) {
  14278. if (this._checkSet()) return !1;
  14279. var b = this._buildRequestStr();
  14280. new GeoGlobe.Request.POST({
  14281. url: this.url,
  14282. data: b,
  14283. scope: this,
  14284. success: function(b) {
  14285. "" == b.responseText || null == b.responseText ? this.failFn() : this.successFn(b, a)
  14286. },
  14287. failure: this.failFn
  14288. })
  14289. },
  14290. _checkSet: function() {
  14291. if (!this.url) return !1
  14292. },
  14293. successFn: function() {},
  14294. failFn: function() {
  14295. alert("\u53e0\u7f6e\u5206\u6790\u64cd\u4f5c\u5931\u8d25\uff0c\u8bf7\u68c0\u6d4b\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u3002")
  14296. },
  14297. CLASS_NAME: "GeoGlobe.Analysis.SpatialAnalysis"
  14298. });
  14299. GeoGlobe.Analysis.CoreBufferAnalysis = GeoGlobe.Class({
  14300. url: null,
  14301. type: "intersection",
  14302. _requestStrTemplate: "{'BufferAnalysis': {'service': 'OverlapService','version': '1.0.0','layerName': '${layerName}','bufferRadius': '${bufferRadius}','bufferStyle':'${bufferStyle}','outPutFormat': 'JSON','bufferType': '${bufferType}','isSynchronization': 'true'}}",
  14303. initialize: function(a, b) {
  14304. this.url = a;
  14305. GeoGlobe.Util.extend(this, b)
  14306. },
  14307. _buildRequestStr: function() {
  14308. return GeoGlobe.String.format(this._requestStrTemplate, {
  14309. type: this.type,
  14310. layerName: this.layerName,
  14311. bufferRadius: this.bufferRadius,
  14312. bufferStyle: this.bufferStyle,
  14313. bufferType: this.bufferType
  14314. })
  14315. },
  14316. startAnalysis: function(a) {
  14317. if (this._checkSet()) return !1;
  14318. var b = this._buildRequestStr();
  14319. new GeoGlobe.Request.POST({
  14320. url: this.url,
  14321. data: b,
  14322. scope: this,
  14323. success: function(b) {
  14324. "" == b.responseText || null == b.responseText ? this.failFn() : this.successFn(b, a)
  14325. },
  14326. failure: this.failFn
  14327. })
  14328. },
  14329. _checkSet: function() {
  14330. if (!this.url) return !1
  14331. },
  14332. successFn: function() {},
  14333. failFn: function() {
  14334. alert("\u7f13\u51b2\u5206\u6790\u64cd\u4f5c\u5931\u8d25\uff0c\u8bf7\u68c0\u6d4b\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c")
  14335. },
  14336. CLASS_NAME: "GeoGlobe.Analysis.CoreBufferAnalysis"
  14337. });
  14338. GeoGlobe.Query.Service = GeoGlobe.Class4OL({
  14339. name: null,
  14340. url: null,
  14341. version: null,
  14342. userid: "test@liferay.com",
  14343. initialize: function(a, b, c) {
  14344. this.name = a;
  14345. this.url = b;
  14346. GeoGlobe.Util.extend(this, c)
  14347. },
  14348. getCapabilities: function() {},
  14349. isExist: function() {},
  14350. failFn: function(a) {
  14351. alert("\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + this.url + "\n\u64cd\u4f5c\u7c7b\u578b\uff1a" +
  14352. a)
  14353. },
  14354. _parseToXML: function(a) {
  14355. var b = a.responseXML;
  14356. if (!b || !b.documentElement) b = a.responseText;
  14357. return (new GeoGlobe.Format.XML).read(b)
  14358. },
  14359. _checkIsError: function(a) {
  14360. if ((new GeoGlobe.Format.XML).read(a).selectNodes("ServiceExceptionReport").length > 0) return this._parseToJSON(a);
  14361. return null
  14362. },
  14363. _isException: function(a) {
  14364. if (a && a.ServiceExceptionReport) return !0;
  14365. return !1
  14366. },
  14367. _parseToJSON: function(a) {
  14368. return (new GeoGlobe.Util.Format.XML2JSON).read(a)
  14369. },
  14370. CLASS_NAME: "GeoGlobe.Query.Service"
  14371. });
  14372. GeoGlobe.Query.RouteQuery = GeoGlobe.Class4OL(GeoGlobe.Query.Service, {
  14373. _format: null,
  14374. initialize: function(a, b, c) {
  14375. this.name = a;
  14376. this.url = b;
  14377. this._format = new GeoGlobe.Format.RouteQuery;
  14378. GeoGlobe.Util.extend(this, c)
  14379. },
  14380. getCapabilities: function(a, b) {
  14381. GeoGlobe.loadURL(this.url, {
  14382. REQUEST: "GetCapabilities"
  14383. }, this, a, b)
  14384. },
  14385. findRoute: function(a, b, c) {
  14386. var d = {
  14387. data: !0,
  14388. orig: !0,
  14389. dest: !0
  14390. },
  14391. e;
  14392. for (e in d)
  14393. if (!(e in a)) throw Error("Missing property '" + e + "'");
  14394. a = GeoGlobe.Util.pick(a, ["data", "orig", "dest", "service ", "version ", "radius ",
  14395. "queryType", "midpos ", "avoidPos", "filterRoute", "resultCount"
  14396. ], !0);
  14397. GeoGlobe.Util.applyDefaults(a, {
  14398. REQUEST: "FindRoute",
  14399. SERVICE: "ROUTE",
  14400. VERSION: "1.0.0"
  14401. });
  14402. GeoGlobe.Request.GET({
  14403. url: this.url,
  14404. params: a,
  14405. async: !1,
  14406. scope: this,
  14407. success: function(a) {
  14408. a = this._format.read(a.responseText);
  14409. if (typeof a.exceptionInfo !== "string") {
  14410. var a = new GeoGlobe.Query.RoutesResult(a),
  14411. c = a.routes,
  14412. c = (new GeoGlobe.Format.GeoJSON).write(c);
  14413. geojsonRoute = (new GeoGlobe.Format.JSON).read(c);
  14414. a.geojsonRoute = geojsonRoute
  14415. }
  14416. b(a)
  14417. },
  14418. failure: c
  14419. })
  14420. },
  14421. getRouteInfo: function(a,
  14422. b, c) {
  14423. var d = {
  14424. REQUEST: "GetRouteInfo",
  14425. SERVICE: "ROUTE",
  14426. VERSION: "1.0.0"
  14427. };
  14428. if (!a.data || !a.id) throw "Error!Not data and id for bus query.";
  14429. d.DATA = a.data;
  14430. d.ID = a.id;
  14431. GeoGlobe.Request.GET({
  14432. url: this.url,
  14433. params: d,
  14434. scope: this,
  14435. success: function(a) {
  14436. a = this._format.read(a.responseText);
  14437. typeof a.exceptionInfo !== "string" && (a = new GeoGlobe.Query.RouteInfoResult(a));
  14438. b(a)
  14439. },
  14440. failure: c
  14441. })
  14442. },
  14443. CLASS_NAME: "GeoGlobe.Query.RouteQuery"
  14444. });
  14445. GeoGlobe.Format.RouteQuery = new GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  14446. initialize: function(a) {
  14447. GeoGlobe.Format.XML.prototype.initialize.apply(this, [a])
  14448. },
  14449. read: function(a) {
  14450. var b = {},
  14451. c = [];
  14452. typeof a == "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  14453. if (a && a.nodeType == 9) {
  14454. var c = [],
  14455. d = GeoGlobe.Format.XML.prototype.getChildEl.apply(this, [a]).nodeName;
  14456. if ("ServiceExceptionReport" === d) return c = GeoGlobe.Format.XML.prototype.getElementsByTagNameNS(a, "*", "ServiceException")[0], b = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [c]), c = c.getAttribute("code"), {
  14457. exceptionInfo: b,
  14458. exceptionCode: c
  14459. };
  14460. for (var a = a.getElementsByTagName(d)[0].childNodes, e = 0; e < a.length; e++) {
  14461. var f = a[e],
  14462. g = f.nodeName;
  14463. this._resultPaser[d][g] && this._resultPaser[d][g].apply(this, [f, c])
  14464. }
  14465. }
  14466. d = d.toLowerCase();
  14467. "routeinfo" === d ? b.items = c : b[d] = c;
  14468. return b
  14469. },
  14470. _resultPaser: {
  14471. RouteInfo: {
  14472. Item: function(a, b) {
  14473. var c = a.childNodes,
  14474. d = a.getAttribute("id"),
  14475. e = {};
  14476. d && (e = {
  14477. id: d
  14478. });
  14479. for (d = 0; d < c.length; d++) {
  14480. var a = c[d],
  14481. f = a.nodeName;
  14482. this._resultPaser.RouteInfo[f] && this._resultPaser.RouteInfo[f].apply(this, [a, e])
  14483. }
  14484. b.push(e)
  14485. },
  14486. Name: function(a, b) {
  14487. var c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]);
  14488. if (c) b.name = c
  14489. },
  14490. Toll: function(a, b) {
  14491. var c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]);
  14492. b.toll = c
  14493. },
  14494. Level: function(a, b) {
  14495. var c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]);
  14496. b.level = c
  14497. },
  14498. Length: function(a, b) {
  14499. var c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]);
  14500. b.length = c
  14501. },
  14502. Geometry: function(a, b) {
  14503. var c = GeoGlobe.Format.XML.prototype.getElementsByTagNameNS(a, "*", "LineString")[0];
  14504. if (c && (c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [c]), typeof c === "string" && c.length > 0)) {
  14505. for (var c = c.split(" "), d = [], e = 0, f = c.length; e < f; e++) {
  14506. var g = c[e].split(",");
  14507. d.push(new GeoGlobe.Geometry.Point(new Number(g[0]), new Number(g[1])))
  14508. }
  14509. c = new GeoGlobe.Geometry.LineString(d);
  14510. b.geometry = c
  14511. }
  14512. },
  14513. Directions: function(a, b) {
  14514. b.directions = [];
  14515. for (var c = a.childNodes, d = 0; d < c.length; d++) {
  14516. var a = c[d],
  14517. e = a.nodeName;
  14518. if (this._resultPaser.RouteInfo[e]) this._resultPaser.RouteInfo[e](a, b.directions)
  14519. }
  14520. },
  14521. Direction: function(a,
  14522. b) {
  14523. var c = {},
  14524. d = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]);
  14525. c.direction = d;
  14526. c.nextID = a.getAttribute("nextID");
  14527. c.nextItem = a.getAttribute("nextItem");
  14528. b.push(c)
  14529. }
  14530. },
  14531. Routes: {
  14532. Route: function(a, b) {
  14533. for (var c = a.childNodes, d = {}, e = 0; e < c.length; e++) {
  14534. var a = c[e],
  14535. f = a.nodeName;
  14536. this._resultPaser.Routes[f] && this._resultPaser.Routes[f].apply(this, [a, d])
  14537. }
  14538. b.push(d)
  14539. },
  14540. Item: function(a, b) {
  14541. if (!GeoGlobe.Util.isArray(b.items)) b.items = [];
  14542. var c = a.childNodes,
  14543. d = a.getAttribute("id"),
  14544. e = {};
  14545. d && (e = {
  14546. id: d
  14547. });
  14548. for (d = 0; d < c.length; d++) {
  14549. var a =
  14550. c[d],
  14551. f = a.nodeName;
  14552. this._resultPaser.Routes[f] && this._resultPaser.Routes[f].apply(this, [a, e])
  14553. }
  14554. b.items.push(e)
  14555. },
  14556. Distance: function(a, b) {
  14557. var c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]);
  14558. b.distance = c
  14559. },
  14560. Name: function(a, b) {
  14561. var c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]);
  14562. if (c) b.name = c
  14563. },
  14564. Length: function(a, b) {
  14565. var c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]);
  14566. b.length = c
  14567. },
  14568. Direction: function(a, b) {
  14569. var c = {},
  14570. d = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]);
  14571. c.direction = d;
  14572. c.nextID = a.getAttribute("nextID");
  14573. c.nextItem = a.getAttribute("nextItem");
  14574. b.direction = c
  14575. },
  14576. Geometry: function(a, b) {
  14577. var c = GeoGlobe.Format.XML.prototype.getElementsByTagNameNS(a, "*", "LineString")[0];
  14578. if (c && (c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [c]), typeof c === "string" && c.length > 0)) {
  14579. for (var c = c.split(" "), d = [], e = 0, f = c.length; e < f; e++) {
  14580. var g = c[e].split(",");
  14581. d.push(new GeoGlobe.Geometry.Point(new Number(g[0]), new Number(g[1])))
  14582. }
  14583. c = new GeoGlobe.Geometry.LineString(d);
  14584. b.geometry =
  14585. c
  14586. }
  14587. },
  14588. Duration: function(a, b) {
  14589. var c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]);
  14590. b.duration = c
  14591. },
  14592. BoundingBox: function(a, b) {
  14593. for (var c = a.childNodes, d = 0; d < c.length; d++) {
  14594. var a = c[d],
  14595. e = a.nodeName;
  14596. this._resultPaser.Routes[e] && this._resultPaser.Routes[e].apply(this, [a, b])
  14597. }
  14598. },
  14599. LowerCorner: function(a, b) {
  14600. if (a.parentNode.tagName === "ows:BoundingBox") {
  14601. var c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]).replace(/^\s*|\s*$/g, ""),
  14602. c = c.replace(/\s*,\s*/g, ","),
  14603. c = c.split(",");
  14604. b.left = c[0];
  14605. b.bottom =
  14606. c[1]
  14607. }
  14608. },
  14609. UpperCorner: function(a, b) {
  14610. if (a.parentNode.tagName === "ows:BoundingBox") {
  14611. var c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]).replace(/^\s*|\s*$/g, ""),
  14612. c = c.replace(/\s*,\s*/g, ","),
  14613. c = c.split(",");
  14614. b.right = c[0];
  14615. b.top = c[1];
  14616. b.bounds = new GeoGlobe.LngLatBounds(new GeoGlobe.LngLat(b.left, b.bottom), new GeoGlobe.LngLat(b.right, b.top));
  14617. delete b.left;
  14618. delete b.bottom;
  14619. delete b.right;
  14620. delete b.top
  14621. }
  14622. },
  14623. Count: function(a, b) {
  14624. var c = GeoGlobe.Format.XML.prototype.getChildValue.apply(this, [a]);
  14625. b.count = c
  14626. }
  14627. }
  14628. }
  14629. });
  14630. GeoGlobe.Query.RoutesResult = GeoGlobe.Class4OL({
  14631. data: null,
  14632. routes: null,
  14633. initialize: function(a) {
  14634. this.routes = [];
  14635. var b = null;
  14636. if (a && a.routes) this.data = a, b = a.routes;
  14637. if (GeoGlobe.Util.isArray(b))
  14638. for (var a = 0, c = b.length; a < c; a++) {
  14639. var d = new GeoGlobe.Query.RouteResult,
  14640. e;
  14641. for (e in b[a]) d[e] = b[a][e];
  14642. this.routes.push(d)
  14643. }
  14644. },
  14645. CLASS_NAME: "GeoGlobe.Query.RoutesResult"
  14646. });
  14647. GeoGlobe.Query.RouteResult = GeoGlobe.Class4OL({
  14648. bounds: null,
  14649. count: null,
  14650. distance: null,
  14651. duration: null,
  14652. geometry: null,
  14653. items: null,
  14654. initialize: function() {},
  14655. CLASS_NAME: "GeoGlobe.Query.RouteResult"
  14656. });
  14657. GeoGlobe.Query.RouteInfoResult = GeoGlobe.Class4OL({
  14658. data: null,
  14659. items: null,
  14660. initialize: function(a) {
  14661. this.items = [];
  14662. if (a && a.items) {
  14663. this.data = a;
  14664. var b = a.items
  14665. }
  14666. if (GeoGlobe.Util.isArray(b))
  14667. for (var a = 0, c = b.length; a < c; a++) {
  14668. var d = new GeoGlobe.Query.RouteInfoItem,
  14669. e;
  14670. for (e in b[a]) d[e] = b[a][e];
  14671. this.items.push(d)
  14672. }
  14673. },
  14674. CLASS_NAME: "GeoGlobe.Query.RouteInfoResult"
  14675. });
  14676. GeoGlobe.Query.RouteInfoItem = GeoGlobe.Class4OL({
  14677. id: null,
  14678. name: null,
  14679. toll: null,
  14680. length: null,
  14681. geometry: null,
  14682. level: null,
  14683. directions: null,
  14684. initialize: function() {},
  14685. CLASS_NAME: "GeoGlobe.Query.RouteInfoItem"
  14686. });
  14687. GeoGlobe.Query.BusQuery = GeoGlobe.Class4OL(GeoGlobe.Query.Service, {
  14688. networkName: null,
  14689. transferScheme: null,
  14690. initialize: function(a, b, c) {
  14691. this.name = a;
  14692. this.url = b;
  14693. GeoGlobe.Util.extend(this, c)
  14694. },
  14695. getCapabilities: function(a, b) {
  14696. typeof b != "function" && (b = function() {
  14697. alert("\u516c\u4ea4\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + this.url + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  14698. });
  14699. GeoGlobe.Request.GET({
  14700. url: this.url,
  14701. params: {
  14702. REQUEST: "GetCapabilities"
  14703. },
  14704. scope: this,
  14705. async: !1,
  14706. success: function(b) {
  14707. typeof a == "function" && a(b)
  14708. },
  14709. failure: b
  14710. })
  14711. },
  14712. isExist: function() {
  14713. var a = !1;
  14714. GeoGlobe.Request.GET({
  14715. url: this.url,
  14716. scope: this,
  14717. async: !1,
  14718. success: function() {
  14719. a = !0
  14720. }
  14721. });
  14722. return a
  14723. },
  14724. queryStation: function(a, b, c) {
  14725. var d = {
  14726. REQUEST: "QueryStation"
  14727. };
  14728. if (!a.networkName) throw "Error!Not network name for bus query.";
  14729. d.NETWORKNAME = a.networkName;
  14730. if (a.stationId !== null && a.stationId !== void 0) d.STATIONID = a.stationId;
  14731. if (a.stationName !==
  14732. null && a.stationName !== void 0) d.STATIONNAME = a.stationName;
  14733. if (a.lineId !== null && a.lineId !== void 0) d.LINEID = a.lineId;
  14734. if (a.lineName !== null && a.lineName !== void 0) d.LINENAME = a.lineName;
  14735. if (a.coordinate !== null && a.coordinate !== void 0) d.COORDINATE = a.coordinate;
  14736. if (a.bbox !== null && a.bbox !== void 0) d.BOX = a.bbox;
  14737. GeoGlobe.Request.GET({
  14738. url: this.url,
  14739. params: d,
  14740. scope: this,
  14741. success: function(a) {
  14742. a = this._parserFeatures(a.responseText);
  14743. b(a)
  14744. },
  14745. failure: c
  14746. })
  14747. },
  14748. queryLine: function(a, b, c) {
  14749. var d = {
  14750. REQUEST: "QueryLine"
  14751. };
  14752. if (!a.networkName) throw "Error!Not network name for bus query.";
  14753. d.NETWORKNAME = a.networkName;
  14754. if (a.lineName !== null && a.lineName !== void 0) d.LINENAME = a.lineName;
  14755. if (a.lineId !== null && a.lineId !== void 0) d.LINEID = a.lineId;
  14756. if (a.stationName !== null && a.stationName !== void 0) d.STATIONNAME = a.stationName;
  14757. if (a.stationId !== null && a.stationId !== void 0) d.STATIONID = a.stationId;
  14758. if (a.coordinate !== null && a.coordinate !== void 0) d.COORDINATE = a.coordinate;
  14759. if (a.bbox !== null && a.bbox !== void 0) d.BOX = a.bbox;
  14760. GeoGlobe.Request.GET({
  14761. url: this.url,
  14762. params: d,
  14763. scope: this,
  14764. success: function(a) {
  14765. a = this._parserFeatures(a.responseText);
  14766. b(a)
  14767. },
  14768. failure: c
  14769. })
  14770. },
  14771. queryChange: function(a, b, c) {
  14772. var d = {
  14773. REQUEST: "QueryChange"
  14774. };
  14775. if (!a.networkName) throw "Error!Not network name for bus query.";
  14776. d.NETWORKNAME = a.networkName;
  14777. if (a.startStationId !== null && a.startStationId !== void 0) d.STARTSTATIONID = a.startStationId;
  14778. if (a.endStationId !== null && a.endStationId !== void 0) d.ENDSTATIONID = a.endStationId;
  14779. if (a.orderType !== null && a.orderType !== void 0) d.ORDERTYPE = a.orderType;
  14780. if (a.startCoordinate !== null && a.startCoordinate !== void 0) d.STARTCOORDINATE = a.startCoordinate;
  14781. if (a.endCoordinate !==
  14782. null && a.endCoordinate !== void 0) d.ENDCOORDINATE = a.endCoordinate;
  14783. if (a.maxDepth !== null && a.maxDepth !== void 0) d.MAXDEPTH = a.maxDepth;
  14784. if (a.maxCost !== null && a.maxCost !== void 0) d.MAXCOST = a.maxCost;
  14785. if (a.maxSolutions !== null && a.maxSolutions !== void 0) d.MAXSOLUTIONS = a.maxSolutions;
  14786. if (a.ChangeCount !== null && a.ChangeCount !== void 0) d.CHANGECOUNT = a.ChangeCount;
  14787. GeoGlobe.Request.GET({
  14788. url: this.url,
  14789. params: d,
  14790. scope: this,
  14791. success: function(a) {
  14792. for (var c = [], a = (a.responseXML.documentElement ? a.responseXML : format.read(a.responseText)).selectNodes("/Features/FeatureCollection"),
  14793. d = new GeoGlobe.Format.XML, h = 0; h < a.length; h++) {
  14794. var j = a[h],
  14795. l = this._getAttibutionOfNode(j, ["cost", "price", "walkingDistance", "transferTimes"]),
  14796. m = this._parserFeatures(d.write(a[h]));
  14797. m.attributes = l;
  14798. j = j.selectNodes("featureMember");
  14799. for (l = 0; l < j.length; l++) {
  14800. var n = j[l].selectNodes("Road");
  14801. m[l].isOnFoot = n[0].getAttribute("isOnFoot")
  14802. }
  14803. c.push(m)
  14804. }
  14805. b(c)
  14806. },
  14807. failure: c
  14808. })
  14809. },
  14810. _getAttibutionOfNode: function(a, b) {
  14811. var c = {};
  14812. if (a.tagName)
  14813. for (var d = 0; d < b.length; d++) c[b[d]] = a.getAttribute(b[d]);
  14814. return c
  14815. },
  14816. _getGeometryType: function() {
  14817. return "polygon"
  14818. },
  14819. _pagingToString: function(a, b) {
  14820. b = b || this.maxPerPage;
  14821. return "<numPerPage>" + b + "</numPerPage><curPage>" + (a || 1) + "</curPage>"
  14822. },
  14823. _orderByToString: function(a) {
  14824. return a ? "<orderBy><PropertyName>" + a + "</PropertyName></orderBy>" : ""
  14825. },
  14826. _geometryToString: function() {
  14827. return '<geometry><Polygon><outerBoundaryIs><LinearRing><coordinates decimal="." cs="," ts=" ">20,30 21,41 52,42 53,33 20,30</coordinates></LinearRing></outerBoundaryIs></Polygon></geometry>'
  14828. },
  14829. _stringToGeometry: function() {
  14830. return GeoGlobe.Geometry.Polygon.createRegularPolygon(new GeoGlobe.Geometry.Point(Math.random() *
  14831. 360 - 160, Math.random() * 90 - 70), Math.round(Math.random() * 20), Math.round(Math.random() * 10))
  14832. },
  14833. _parserFeatures: function(a) {
  14834. var b = new GeoGlobe.Format.GML;
  14835. b.gmlns = "*";
  14836. return b.read(a)
  14837. },
  14838. _parserResponseText: function(a, b) {
  14839. if (b) var c = RegExp("</" + b + ">", ["g"]),
  14840. a = a.replace(RegExp("<" + b + ">", ["g"]), "<featureMember><" + b + ">"),
  14841. a = a.replace(c, "</" + b + "></featureMember>");
  14842. a = a.replace(/<gml:LineString>/g, "<gml:LineString><gml:coordinates>");
  14843. a = a.replace(/<\/gml:LineString>/g, "</gml:coordinates></gml:LineString>");
  14844. a = a.replace(/<gml:Point>/g,
  14845. "<gml:Point><gml:coordinates>");
  14846. return a = a.replace(/<\/gml:Point>/g, "</gml:coordinates></gml:Point>")
  14847. },
  14848. _parserFeaturesNew: function(a, b) {
  14849. var c = new GeoGlobe.Format.GML;
  14850. c.gmlns = "*";
  14851. if (b) c.featureName = b;
  14852. return c.read(a)
  14853. },
  14854. _parserSuccessResult: function(a) {
  14855. return (new GeoGlobe.Util.Format.XML2JSON).read(a)
  14856. },
  14857. _parseToXML: function(a) {
  14858. var b = a.responseXML;
  14859. if (!b || !b.documentElement) b = a.responseText;
  14860. return (new GeoGlobe.Format.XML).read(b)
  14861. },
  14862. _parseToJSON: function(a) {
  14863. return (new GeoGlobe.Format.XML2JSON).read(a)
  14864. },
  14865. queryTransferScheme: function(a,
  14866. b, c) {
  14867. var d = {
  14868. request: "QueryTransferScheme",
  14869. SERVICE: "BUS",
  14870. VERSION: "1.0.0"
  14871. },
  14872. e = {
  14873. networkName: !0,
  14874. transferMode: !0,
  14875. startInput: !0,
  14876. endInput: !0
  14877. },
  14878. f;
  14879. for (f in e)
  14880. if (!(f in a)) throw Error("\u7f3a\u5c11\u5fc5\u9009\u5c5e\u6027\uff1a'" + f + "'\u3002");
  14881. d.networkName = a.networkName;
  14882. if (a.service !== null && a.service !== void 0) d.SERVICE = a.service;
  14883. if (a.version !== null && a.version !== void 0) d.VERSION = a.version;
  14884. if (a.transferMode !== null && a.transferMode !== void 0) d.TRANSFERMODE = a.transferMode;
  14885. if (a.startInput !== null && a.startInput !== void 0) d.STARTINPUT =
  14886. a.startInput;
  14887. if (a.endInput !== null && a.endInput !== void 0) d.ENDINPUT = a.endInput;
  14888. if (a.inputMode !== null && a.inputMode !== void 0) d.INPUTMODEL = a.inputMode;
  14889. if (a.ExistGoTime !== null && a.ExistGoTime !== void 0) d.EXISTGOTIME = a.ExistGoTime;
  14890. if (a.StartTime !== null && a.StartTime !== void 0) d.STARTTIME = a.StartTime;
  14891. if (a.MaxSearchDistance !== null && a.MaxSearchDistance !== void 0) d.MAXSEARCHDISTANCE = a.MaxSearchDistance;
  14892. if (a.PrioritySubset !== null && a.PrioritySubset !== void 0) d.PRIORITYSUBSET = a.PrioritySubset;
  14893. if (a.ExistAbsolutePriority !==
  14894. null && a.ExistAbsolutePriority !== void 0) d.EXISTABSOLUTEPRIORITY = a.ExistAbsolutePriority;
  14895. if (a.LagSubset !== null && a.LagSubset !== void 0) d.LAGSUBSET = a.LagSubset;
  14896. if (a.OutputPage !== null && a.OutputPage !== void 0) d.OUTPUTPAGE = a.OutputPage;
  14897. if (a.PageSize !== null && a.PageSize !== void 0) d.PAGESIZE = a.PageSize;
  14898. if (a.ChangeCount !== null && a.ChangeCount !== void 0) d.CHANGECOUNT = a.ChangeCount;
  14899. GeoGlobe.Request.GET({
  14900. url: this.url,
  14901. params: d,
  14902. async: !1,
  14903. scope: this,
  14904. success: GeoGlobe.Function.bind(function(a) {
  14905. var c = a.responseXML,
  14906. d = {
  14907. startPoint: [],
  14908. transferScheme: [],
  14909. endPoint: []
  14910. };
  14911. if (!c) return b(d), d;
  14912. var a = new GeoGlobe.Format.XML,
  14913. e = c.selectNodes("/ServiceExceptionReport/ServiceExceptionMessage");
  14914. if (e && e.length > 0) return b(d), d;
  14915. c = c.selectNodes("/QueryTransferSchemeResponse");
  14916. a = this._parseToJSON(a.write(c[0]));
  14917. d = a.QueryTransferSchemeResponse.StartPoint;
  14918. GeoGlobe.Util.isArray(d) || (d = [d]);
  14919. c = a.QueryTransferSchemeResponse.EndPoint;
  14920. GeoGlobe.Util.isArray(c) || (c = [c]);
  14921. a = a.QueryTransferSchemeResponse.TransferScheme;
  14922. d = this._getPointGeometryByGMLPointStr(d[0].Geometry.gml_Point);
  14923. d = new GeoGlobe.Feature(d);
  14924. c = this._getPointGeometryByGMLPointStr(c[0].Geometry.gml_Point);
  14925. c = new GeoGlobe.Feature(c);
  14926. a = this._parserTransferScheme(a);
  14927. d = {
  14928. startPoint: d,
  14929. transferScheme: a,
  14930. endPoint: c
  14931. };
  14932. b(d)
  14933. }, this),
  14934. failure: c
  14935. })
  14936. },
  14937. _parserTransferScheme: function(a) {
  14938. GeoGlobe.Util.isArray(a) || (a = [a]);
  14939. for (var b = [], c = 0; c < a.length; c++) {
  14940. var d = a[c],
  14941. e = this._parserSectionInfo(d.SectionInfo),
  14942. d = this._parserSectionRouting(d.SectionRouting);
  14943. b.push({
  14944. Cost: a[c].Cost,
  14945. SectionInfo: e,
  14946. SectionRouting: d,
  14947. TotalDistance: a[c].TotalDistance,
  14948. TransferCount: a[c].TransferCount
  14949. })
  14950. }
  14951. return b
  14952. },
  14953. _parserSectionInfo: function(a) {
  14954. GeoGlobe.Util.isArray(a) || (a = [a]);
  14955. for (var b = [], c = 0; c < a.length; c++) {
  14956. var d = this._getPointFeatureByObj(a[c].FromStation);
  14957. if (a[c].FromStation.PassagewayRouting) {
  14958. var e = this._getPointFeatureByObj(a[c].FromStation.PassagewayRouting);
  14959. if (e.SectionRouting) e.attributes.SectionRouting = e.data.SectionRouting = this._parserSectionRouting(e.SectionRouting);
  14960. d.attributes.PassagewayRouting = d.data.PassagewayRouting = e
  14961. }
  14962. var f = this._getPointFeatureByObj(a[c].ToStation);
  14963. if (a[c].ToStation.PassagewayRouting) {
  14964. e = this._getPointFeatureByObj(a[c].ToStation.PassagewayRouting);
  14965. if (e.SectionRouting) e.attributes.SectionRouting = e.data.SectionRouting = this._parserSectionRouting(e.SectionRouting);
  14966. f.attributes.PassagewayRouting = f.data.PassagewayRouting = e
  14967. }
  14968. var e = this._parserSectionLines(a[c].SectionLines.SectionLine),
  14969. g = this._parserSectionRouting(a[c].SectionRouting);
  14970. b.push({
  14971. FromStation: d,
  14972. SectionLine: e,
  14973. ToStation: f,
  14974. SectionRouting: g
  14975. })
  14976. }
  14977. return b
  14978. },
  14979. _parserSectionLines: function(a) {
  14980. GeoGlobe.Util.isArray(a) ||
  14981. (a = [a]);
  14982. for (var b = [], c = 0; c < a.length; c++) {
  14983. var d = new GeoGlobe.Feature(null, a[c]);
  14984. b.push(d)
  14985. }
  14986. return b
  14987. },
  14988. _parserSectionRouting: function(a) {
  14989. GeoGlobe.Util.isArray(a) || (a = [a]);
  14990. for (var b = [], c = 0; c < a.length; c++) b.push(a[c]);
  14991. return b
  14992. },
  14993. _getPointGeometryByGMLPointStr: function(a) {
  14994. a = a.split(",");
  14995. return new GeoGlobe.Geometry.Point(parseFloat(a[0]), parseFloat(a[1]))
  14996. },
  14997. _getPointFeatureByObj: function(a) {
  14998. var b = null;
  14999. a.Geometry && a.Geometry.gml_Point && (b = this._getPointGeometryByGMLPointStr(a.Geometry.gml_Point));
  15000. return new GeoGlobe.Feature(b,
  15001. a)
  15002. },
  15003. _getLineGeometryByGMLLineStr: function(a) {
  15004. if (!a) return null;
  15005. for (var a = a.split(" "), b = [], c = 0, d = a.length; c < d; c++) {
  15006. var e = this._getPointGeometryByGMLPointStr(a[c]);
  15007. b.push(e)
  15008. }
  15009. return new GeoGlobe.Geometry.LineString(b)
  15010. },
  15011. queryTransferGeometry: function(a, b, c) {
  15012. var d = {
  15013. request: "QueryTransferGeometry",
  15014. SERVICE: "BUS",
  15015. VERSION: "1.0.0"
  15016. };
  15017. if (!a.networkName) throw "Error!Not network name for bus query.";
  15018. if (a.parameterInfo === null || a.parameterInfo === void 0 || a.parameterInfo === "") throw "Error!Not parameterInfo for bus query.";
  15019. d.networkName = a.networkName;
  15020. d.PARAMETERINFO = "";
  15021. for (var e = 0; e < a.parameterInfo.length; e++) d.PARAMETERINFO += a.parameterInfo[e].toString(), e != a.parameterInfo.length - 1 && (d.PARAMETERINFO += "_");
  15022. if (a.service !== null && a.service !== void 0) d.SERVICE = a.service;
  15023. if (a.version !== null && a.version !== void 0) d.VERSION = a.version;
  15024. GeoGlobe.Request.GET({
  15025. url: this.url,
  15026. params: d,
  15027. scope: this,
  15028. async: !1,
  15029. success: GeoGlobe.Function.bind(function(a) {
  15030. a = this._parseQueryTransferGeometryResult(a);
  15031. b(a)
  15032. }, this),
  15033. failure: c
  15034. })
  15035. },
  15036. _parseQueryTransferGeometryResult: function(a) {
  15037. resXML =
  15038. a.responseXML;
  15039. a = [];
  15040. if (!resXML) return a;
  15041. var b = new GeoGlobe.Format.XML,
  15042. c = resXML.selectNodes("/QueryTransferGeometryResponse");
  15043. if (c && c.length <= 0) return a;
  15044. if (b = this._parseToJSON(b.write(c[0])).QueryTransferGeometryResponse.SectionGeometry) {
  15045. GeoGlobe.Util.isArray(b) || (b = [b]);
  15046. for (c = 0; c < b.length; c++) {
  15047. var d = this._getLineGeometryByGMLLineStr(b[c].Geometry.gml_LineString),
  15048. d = new GeoGlobe.Feature(d, {
  15049. ID: b[c].ID
  15050. });
  15051. a.push(d)
  15052. }
  15053. }
  15054. return a
  15055. },
  15056. queryKeyWord: function(a, b, c) {
  15057. var d = {
  15058. REQUEST: "QueryKeyWord",
  15059. SERVICE: "BUS",
  15060. VERSION: "1.0.0",
  15061. SEARCHTYPE: 2
  15062. };
  15063. if (!a.networkName) throw "Error!Not network name for bus query.";
  15064. if (a.keyWord === null || a.keyWord === void 0 || a.keyWord === "") throw "Error!Not keyWord for bus query.";
  15065. d.NETWORKNAME = a.networkName;
  15066. d.KEYWORD = a.keyWord;
  15067. if (a.service !== null && a.service !== void 0) d.SERVICE = a.service;
  15068. if (a.version !== null && a.version !== void 0) d.VERSION = a.version;
  15069. if (a.searchType !== null && a.searchType !== void 0) d.SEARCHTYPE = a.searchType;
  15070. if (a.keyWordType !== null && a.keyWordType !== void 0) d.KEYWORDTYPE = a.keyWordType;
  15071. GeoGlobe.Request.GET({
  15072. url: this.url,
  15073. params: d,
  15074. async: !1,
  15075. scope: this,
  15076. success: GeoGlobe.Function.bind(function(c) {
  15077. c = this._parserQueryKeyWordResult(c, a.keyWordType);
  15078. b(c)
  15079. }, this),
  15080. failure: c
  15081. })
  15082. },
  15083. _parserQueryKeyWordResult: function(a, b) {
  15084. var c = a.responseXML,
  15085. d = [];
  15086. if (!c) return d;
  15087. var e = new GeoGlobe.Format.XML,
  15088. f = c.selectNodes("/ServiceExceptionReport/ServiceExceptionMessage");
  15089. if (f && f.length > 0) return d;
  15090. c = c.selectNodes("/QueryKeyWordResponse");
  15091. e = this._parseToJSON(e.write(c[0]));
  15092. if (b === 1) {
  15093. (f = e.QueryKeyWordResponse.Stations.Station) && !GeoGlobe.Util.isArray(f) &&
  15094. (f = [f]);
  15095. for (e = 0; e < f.length; e++) c = this._getPointFeatureByObj(f[e]), d.push(c)
  15096. } else if (b === 2) {
  15097. (f = e.QueryKeyWordResponse.Passageways.Passageway) && !GeoGlobe.Util.isArray(f) && (f = [f]);
  15098. for (e = 0; e < f.length; e++) c = this._getPointFeatureByObj(f[e]), d.push(c)
  15099. } else {
  15100. (c = e.QueryKeyWordResponse.Lines.Line) && !GeoGlobe.Util.isArray(c) && (c = [c]);
  15101. for (e = 0; e < c.length; e++) f = new GeoGlobe.Feature(null, c[e]), d.push(f)
  15102. }
  15103. return d
  15104. },
  15105. queryStationInfo: function(a, b, c) {
  15106. var d = {
  15107. REQUEST: "QueryStationInfo",
  15108. SERVICE: "BUS",
  15109. VERSION: "1.0.0"
  15110. };
  15111. if (!a.networkName) throw "Error!Not network name for bus query.";
  15112. if (a.stationId === null || a.stationId === void 0 || a.stationId === "") throw "Error!Not stationId for bus query.";
  15113. d.NETWORKNAME = a.networkName;
  15114. if (a.service !== null && a.service !== void 0) d.SERVICE = a.service;
  15115. if (a.version !== null && a.version !== void 0) d.VERSION = a.version;
  15116. if (a.stationId !== null && a.stationId !== void 0) d.STATIONID = a.stationId;
  15117. GeoGlobe.Request.GET({
  15118. url: this.url,
  15119. params: d,
  15120. scope: this,
  15121. success: function(a) {
  15122. if (resXML = a.responseXML) {
  15123. for (var c = new GeoGlobe.Format.XML, a = this._parserQueryStationInfoNode("Lines", c, resXML),
  15124. c = this._parserQueryStationInfoNode("Passageways", c, resXML), d = [], h = 0; h < c.length; h++) {
  15125. var j = this._getPointFeatureByObj(c[h]);
  15126. d.push(j)
  15127. }
  15128. a = {
  15129. lines: a,
  15130. passageways: d
  15131. }
  15132. } else a = {
  15133. lines: [],
  15134. passageways: []
  15135. };
  15136. b(a)
  15137. },
  15138. failure: c
  15139. })
  15140. },
  15141. _parserQueryStationInfoNode: function(a, b, c) {
  15142. switch (a) {
  15143. case "Lines":
  15144. c = c.selectNodes("/QueryStationInfoResponse/StationInfo/Lines");
  15145. a = [];
  15146. if (c.length > 0) b = b.write(c[0]), b = this._parseToJSON(b), a = b.Lines.Line, GeoGlobe.Util.isArray(a) || (a = [a]);
  15147. return a;
  15148. case "Passageways":
  15149. c = c.selectNodes("/QueryStationInfoResponse");
  15150. a = [];
  15151. if (c.length > 0 && (b = b.write(c[0]), b = this._parseToJSON(b), b = b.QueryStationInfoResponse.StationInfo.Passageways)) a = b.Passageway, GeoGlobe.Util.isArray(a) || (a = [a]);
  15152. return a;
  15153. default:
  15154. return []
  15155. }
  15156. },
  15157. queryLineInfo: function(a, b, c) {
  15158. var d = {
  15159. REQUEST: "QueryLineInfo",
  15160. SERVICE: "BUS",
  15161. VERSION: "1.0.0"
  15162. };
  15163. if (!a.networkName) throw "Error!Not network name for bus query.";
  15164. if (a.lineId === null || a.lineId === void 0 || a.lineId === "") throw "Error!Not lineId for bus query.";
  15165. d.NETWORKNAME = a.networkName;
  15166. if (a.service !== null && a.service !== void 0) d.SERVICE =
  15167. a.service;
  15168. if (a.version !== null && a.version !== void 0) d.VERSION = a.version;
  15169. if (a.lineId !== null && a.lineId !== void 0) d.LINEID = a.lineId;
  15170. if (a.startNodeNumber !== null && a.startNodeNumber !== void 0) d.STARTNODENUMBER = a.startNodeNumber;
  15171. if (a.endNodeNumber !== null && a.endNodeNumber !== void 0) d.ENDNODENUMBER = a.endNodeNumber;
  15172. GeoGlobe.Request.GET({
  15173. url: this.url,
  15174. params: d,
  15175. scope: this,
  15176. success: function(a) {
  15177. var c = [],
  15178. d = null;
  15179. if (a.responseXML) {
  15180. d = a.responseXML;
  15181. if ((a = d.selectNodes("/ServiceExceptionReport/ServiceExceptionMessage")) && a.length >
  15182. 0) {
  15183. b(c);
  15184. return
  15185. }
  15186. c = this._parserQueryLineInfoNode("Line", new GeoGlobe.Format.XML, d);
  15187. d = [];
  15188. for (a = 0; a < c.length; a++) {
  15189. for (var h = [], j = 0; j < c[a].VIAStations.Station.length; j++) {
  15190. var l = this._getPointFeatureByObj(c[a].VIAStations.Station[j]);
  15191. h.push(l)
  15192. }
  15193. c[a].Stations = h;
  15194. h = this._getLineGeometryByGMLLineStr(c[a].Geometry.gml_LineString);
  15195. h = new GeoGlobe.Feature(h, c[a]);
  15196. d.push(h)
  15197. }
  15198. c = d
  15199. }
  15200. b(c)
  15201. },
  15202. failure: c
  15203. })
  15204. },
  15205. _parserQueryLineInfoNode: function(a, b, c) {
  15206. switch (a) {
  15207. case "Line":
  15208. return a = c.selectNodes("/QueryLineInfoResponse"), b = this._parseToJSON(b.write(a[0])).QueryLineInfoResponse.Line,
  15209. a = [], a = b && !GeoGlobe.Util.isArray(b) ? [b] : b;
  15210. default:
  15211. return []
  15212. }
  15213. },
  15214. queryPassagewayInfo: function(a, b) {
  15215. var c = {
  15216. REQUEST: "QueryPassagewayInfo",
  15217. SERVICE: "BUS",
  15218. VERSION: "1.0.0"
  15219. };
  15220. if (!a.networkName) throw "Error!Not network name for bus query.";
  15221. if (a.passagewayId === null || a.passagewayId === void 0 || a.passagewayId === "") throw "Error!Not passagewayId for bus query.";
  15222. c.NETWORKNAME = a.networkName;
  15223. if (a.service !== null && a.service !== void 0) c.SERVICE = a.service;
  15224. if (a.version !== null && a.version !== void 0) c.VERSION = a.version;
  15225. if (a.passagewayId !==
  15226. null && a.passagewayId !== void 0) c.PASSAGEWAYID = a.passagewayId;
  15227. GeoGlobe.Request.GET({
  15228. url: this.url,
  15229. params: c,
  15230. scope: this,
  15231. success: function(a) {
  15232. var c = a.responseXML,
  15233. f = [];
  15234. if (!c) return b(f), f;
  15235. new GeoGlobe.Format.XML;
  15236. if ((c = c.selectNodes("/ServiceExceptionReport/ServiceExceptionMessage")) && c.length > 0) return b(f), f;
  15237. f = this._parserFeaturesNew(this._parserResponseText(a.responseText), "Stations");
  15238. b(f)
  15239. }
  15240. })
  15241. },
  15242. _queryByName: function(a, b, c) {
  15243. var d = this,
  15244. e = null;
  15245. d.queryKeyWord({
  15246. networkName: d.networkName,
  15247. keyWord: a,
  15248. keyWordType: 1,
  15249. SEARCHTYPE: 2
  15250. }, function(a) {
  15251. if (a.length == 0) alert("\u6ca1\u6709\u67e5\u8be2\u5230\u8d77\u70b9");
  15252. else {
  15253. var g = a[0].geometry.x + " " + a[0].geometry.y;
  15254. d.queryKeyWord({
  15255. networkName: d.networkName,
  15256. keyWord: b,
  15257. keyWordType: 1,
  15258. SEARCHTYPE: 2
  15259. }, function(a) {
  15260. a.length == 0 ? alert("\u6ca1\u6709\u67e5\u8be2\u5230\u7ec8\u70b9") : e = d._queryTransferScheme(g, a[0].geometry.x + " " + a[0].geometry.y, c)
  15261. })
  15262. }
  15263. });
  15264. return e
  15265. },
  15266. queryBus: function(a, b, c) {
  15267. var d = this,
  15268. e = null;
  15269. d.getCapabilities(GeoGlobe.Function.bind(function(f) {
  15270. var g = f.responseXML;
  15271. if (!g || !g.documentElement) g =
  15272. f.responseText;
  15273. f = (new GeoGlobe.Format.BusCapabilities).read(g);
  15274. f.capability ? (d.networkName = f.capability.networks[0], e = typeof a == "string" && typeof b == "string" ? d._queryByName(a, b, c) : d._queryTransferScheme(a.lng + " " + a.lat, b.lng + " " + b.lat, c)) : alert("\u516c\u4ea4\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + url + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  15275. },
  15276. this), function() {
  15277. alert("\u516c\u4ea4\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + url + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  15278. });
  15279. return {
  15280. flag: e ? !0 : !1,
  15281. featuresInfo: e
  15282. }
  15283. },
  15284. failFn: function() {
  15285. alert("\u516c\u4ea4\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" +
  15286. url + "\n\u64cd\u4f5c\u7c7b\u578b\uff1aGetCapabilities")
  15287. },
  15288. _queryTransferScheme: function(a, b, c) {
  15289. this.queryTransferScheme({
  15290. networkName: this.networkName,
  15291. transferMode: c ? c : 0,
  15292. inputMode: 0,
  15293. startInput: a,
  15294. endInput: b
  15295. }, function(a) {
  15296. featuresInfo = a
  15297. });
  15298. this.transferScheme = featuresInfo.transferScheme;
  15299. return featuresInfo
  15300. },
  15301. queryBusTransferSchemeByIndex: function(a) {
  15302. var b = null,
  15303. a = this.transferScheme[parseInt(a)].SectionInfo,
  15304. c = [],
  15305. d = [];
  15306. for (i = 0; i < a.length; i++) {
  15307. var e = a[i].SectionLine[0];
  15308. c.push([0, e.data.ID, e.data.FromOrdinal,
  15309. e.data.ToOrdinal
  15310. ]);
  15311. d.push(a[i].FromStation);
  15312. d.push(a[i].ToStation)
  15313. }
  15314. this.queryTransferGeometry({
  15315. networkName: this.networkName,
  15316. parameterInfo: c
  15317. }, function(a) {
  15318. var c = new GeoGlobe.Format.GeoJSON,
  15319. e = c.write(a),
  15320. c = c.write(d),
  15321. j = new GeoGlobe.Format.JSON,
  15322. e = j.read(e),
  15323. c = j.read(c);
  15324. b = {
  15325. lineFeatures: a,
  15326. geojsonRoute: e,
  15327. stationFeatures: d,
  15328. geojsonStation: c
  15329. }
  15330. });
  15331. return b
  15332. },
  15333. CLASS_NAME: "GeoGlobe.Query.BusQuery"
  15334. });
  15335. (function() {
  15336. if (document.implementation.hasFeature("XPath", "3.0")) XMLDocument.prototype.selectNodes = function(a, b) {
  15337. b || (b = this);
  15338. for (var c = this.evaluate(a, b, function(a) {
  15339. return {
  15340. csw: "http://www.opengis.net/cat/csw",
  15341. smmd: "http://data.sbsm.gov.cn/smmd/2007",
  15342. wfs: "http://www.opengis.net/wfs",
  15343. gml: "http://www.opengis.net/gml",
  15344. geoglobe: "http://www.geostar.com.cn/geoglobe"
  15345. }[a] || null
  15346. }, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null), d = [], e = 0; e < c.snapshotLength; e++) d[e] = c.snapshotItem(e);
  15347. return d
  15348. }, Element.prototype.selectNodes =
  15349. function(a) {
  15350. if (this.ownerDocument.selectNodes) return this.ownerDocument.selectNodes(a, this);
  15351. else throw "For XML Elements Only";
  15352. };
  15353. if (document.implementation.hasFeature("XPath", "3.0")) XMLDocument.prototype.selectSingleNode = function(a, b) {
  15354. b || (b = this);
  15355. var c = this.selectNodes(a, b);
  15356. return c.length > 0 ? c[0] : null
  15357. }, Element.prototype.selectSingleNode = function(a) {
  15358. if (this.ownerDocument.selectSingleNode) return this.ownerDocument.selectSingleNode(a, this);
  15359. else throw "For XML Elements Only";
  15360. }
  15361. })();
  15362. GeoGlobe.Query.WFSQuery = GeoGlobe.Class4OL({
  15363. url: null,
  15364. version: "1.0.0",
  15365. featureNS: null,
  15366. isReverse: !1,
  15367. featurePrefix: "",
  15368. featureType: "",
  15369. maxFeatures: 10,
  15370. filter: null,
  15371. geometryName: "the_geom",
  15372. protocol: null,
  15373. format: null,
  15374. outputFormat: "GML",
  15375. formatOptions: null,
  15376. isSeparate: !1,
  15377. srsName: "EPSG:4326",
  15378. time: null,
  15379. userecent: !0,
  15380. sortBy: null,
  15381. groupBy: null,
  15382. resultType: "Results",
  15383. startPosition: null,
  15384. initialize: function(a, b, c) {
  15385. this.url = a;
  15386. this.featureType = b;
  15387. a = null;
  15388. if (c) c.isReverse === !0 ? (this.isReverse = c.isReverse, a = !c.isReverse) : c.isReverse ===
  15389. !1 ? (this.isReverse = c.isReverse, a = !c.isReverse) : a = !this.isReverse, c.format ? (c.format instanceof GeoGlobe.Format.GML.v2 || c.format instanceof GeoGlobe.Format.GML.v3) && c.format.setFeatureType_(b) : this.format = new GeoGlobe.Format.GML({
  15390. xy: a
  15391. });
  15392. GeoGlobe.Util.extend(this, c);
  15393. this.format instanceof GeoGlobe.Format.GeoJSON ? (this.outputFormat = "GeoJson", this.version = "1.0.0") : this.outputFormat = "GML"
  15394. },
  15395. query: function(a, b, c) {
  15396. this.protocol = new GeoGlobe.Protocol.WFS({
  15397. readFormat: this.format,
  15398. formatOptions: this.formatOptions,
  15399. propertyNames: this.propertyNames,
  15400. maxFeatures: this.maxFeatures,
  15401. featurePrefix: this.featurePrefix,
  15402. featureNS: this.featureNS,
  15403. url: this.url,
  15404. version: this.version,
  15405. geometryName: this.geometryName,
  15406. featureType: this.featureType,
  15407. time: this.time,
  15408. userecent: this.userecent,
  15409. srsName: this.srsName
  15410. });
  15411. var a = a || this.filter,
  15412. d = b || this.successFn,
  15413. e = c || this.failFn,
  15414. b = GeoGlobe.Function.bind(function(a) {
  15415. if (a.success()) {
  15416. var b = a.features;
  15417. this.isSeparate && (b = this._separateFeatures(b));
  15418. (a = this._read_trueName(a)) && (b.trueNames = a);
  15419. a = (new GeoGlobe.Format.GeoJSON).write(b);
  15420. a = (new GeoGlobe.Format.JSON).read(a);
  15421. d({
  15422. features: b,
  15423. geojson: a
  15424. })
  15425. } else e()
  15426. }, this);
  15427. this.response = this.protocol.read({
  15428. outputFormat: this.outputFormat,
  15429. sortBy: this.sortBy,
  15430. filter: a,
  15431. callback: b
  15432. })
  15433. },
  15434. queryPage: function(a, b, c, d) {
  15435. var e = d && d.perPageNumber || 15;
  15436. this.protocol = new GeoGlobe.Protocol.WFS({
  15437. readFormat: this.format,
  15438. multi: !0,
  15439. formatOptions: this.formatOptions,
  15440. propertyNames: this.propertyNames,
  15441. maxFeatures: e,
  15442. startPosition: ((d && d.pageNumber || 1) - 1) * e + 1,
  15443. featurePrefix: this.featurePrefix,
  15444. url: this.url,
  15445. featureNS: this.featureNS,
  15446. version: this.version,
  15447. geometryName: this.geometryName,
  15448. featureType: this.featureType,
  15449. time: this.time,
  15450. userecent: this.userecent,
  15451. srsName: this.srsName
  15452. });
  15453. var a = a || this.filter,
  15454. f = b || this.successFn,
  15455. g = c || this.failFn,
  15456. b = GeoGlobe.Function.bind(function(a) {
  15457. if (a.success()) {
  15458. var b = a.features;
  15459. this.isSeparate && (b = this._separateFeatures(b));
  15460. a = this._read_trueName(a);
  15461. b.trueNames = a;
  15462. a = (new GeoGlobe.Format.GeoJSON).write(b);
  15463. a = (new GeoGlobe.Format.JSON).read(a);
  15464. f({
  15465. features: b,
  15466. geojson: a
  15467. })
  15468. } else g()
  15469. }, this);
  15470. this.response = this.protocol.read({
  15471. outputFormat: this.outputFormat,
  15472. sortBy: this.sortBy,
  15473. filter: a,
  15474. callback: b
  15475. })
  15476. },
  15477. queryTotalNumber: function(a, b, c) {
  15478. var d = new GeoGlobe.Format.WFSHits;
  15479. this.protocol = new GeoGlobe.Protocol.WFS({
  15480. readFormat: d,
  15481. propertyNames: this.propertyNames,
  15482. resultType: "hits",
  15483. maxFeatures: this.maxFeatures,
  15484. featurePrefix: this.featurePrefix,
  15485. featureNS: this.featureNS,
  15486. url: this.url,
  15487. version: this.version,
  15488. geometryName: this.geometryName,
  15489. featureType: this.featureType,
  15490. time: this.time,
  15491. userecent: this.userecent
  15492. });
  15493. var a = a || this.filter,
  15494. e = b || this.successFn,
  15495. f = c || this.failFn,
  15496. b = GeoGlobe.Function.bind(function(a) {
  15497. a.success() ?
  15498. e(a.features) : f()
  15499. }, this);
  15500. this.response = this.protocol.read({
  15501. outputFormat: this.outputFormat,
  15502. filter: a,
  15503. callback: b
  15504. })
  15505. },
  15506. _read_trueName: function(a) {
  15507. if (this.outputFormat !== "GML") return null;
  15508. var b = [];
  15509. if (a.priv && a.priv.responseText) {
  15510. if (null == this.format) return null;
  15511. a = this.format.getXMLDoc().getElementsByTagName("trueName");
  15512. if (a == null || a.length == 0) return null;
  15513. for (var c = 0; c < a.length; c++) b.push(a[c].text)
  15514. }
  15515. return b
  15516. },
  15517. getBufferRegion: function(a, b, c) {
  15518. var d = this._getFeaturesCenter(a);
  15519. switch (c) {
  15520. case "km":
  15521. b *= 1E3;
  15522. case "m":
  15523. b =
  15524. this._meterToDegree(b, d)
  15525. }
  15526. return GeoGlobe.Geometry.Polygon.createRegularPolygon(a.geometry, b, 40, 360)
  15527. },
  15528. _getFeaturesCenter: function(a) {
  15529. return this._getFeaturesExtent(a).getCenterLonLat()
  15530. },
  15531. _getFeaturesExtent: function(a) {
  15532. GeoGlobe.Util.isArray(a) || (a = [a]);
  15533. var b = null;
  15534. if (a && a.length > 0)
  15535. for (var b = new GeoGlobe.LngLatBounds, c = null, d = 0, e = a.length; d < e; d++)(c = a[d].geometry) && b.extend(c.getBounds());
  15536. return b
  15537. },
  15538. _meterToDegree: function(a, b) {
  15539. return a * (8.99E-6 / Math.cos(GeoGlobe.Util.rad(b.lat)))
  15540. },
  15541. pointQuery: function(a,
  15542. b, c, d, e) {
  15543. this.query(new GeoGlobe.Filter.Spatial({
  15544. type: GeoGlobe.Filter.Spatial.DWITHIN,
  15545. property: this.geometryName,
  15546. distance: b || 0,
  15547. distanceUnits: c || "degree",
  15548. value: a
  15549. }), d, e)
  15550. },
  15551. pathQuery: function(a, b, c, d, e) {
  15552. this.query(new GeoGlobe.Filter.Spatial({
  15553. type: GeoGlobe.Filter.Spatial.DWITHIN,
  15554. property: this.geometryName,
  15555. distance: b || 0,
  15556. distanceUnits: c || "degree",
  15557. value: a
  15558. }), d, e)
  15559. },
  15560. polygonQuery: function(a, b, c, d) {
  15561. this.query(new GeoGlobe.Filter.Spatial({
  15562. type: b ? GeoGlobe.Filter.Spatial.CONTAINS : GeoGlobe.Filter.Spatial.INTERSECTS,
  15563. property: this.geometryName,
  15564. value: a
  15565. }), c, d)
  15566. },
  15567. bboxQuery: function(a, b, c) {
  15568. this.query(new GeoGlobe.Filter.Spatial({
  15569. type: GeoGlobe.Filter.Spatial.BBOX,
  15570. property: this.geometryName,
  15571. value: a
  15572. }), b, c)
  15573. },
  15574. attributeQuery: function(a, b, c, d, e, f) {
  15575. this.query(new GeoGlobe.Filter.Comparison({
  15576. type: a,
  15577. property: b,
  15578. value: c,
  15579. matchCase: d && d.matchCase,
  15580. lowerBoundary: d ? d.lowerBoundary : null,
  15581. upperBoundary: d ? d.upperBoundary : null
  15582. }), e, f)
  15583. },
  15584. statisticsQuery: function(a, b, c) {
  15585. this.protocol = new GeoGlobe.Protocol.WFS({
  15586. readFormat: this.format,
  15587. formatOptions: this.formatOptions,
  15588. propertyNames: this.propertyNames,
  15589. resultType: "statistics",
  15590. maxFeatures: this.maxFeatures,
  15591. featurePrefix: this.featurePrefix,
  15592. featureNS: this.featureNS,
  15593. url: this.url,
  15594. version: this.version,
  15595. geometryName: this.geometryName,
  15596. featureType: this.featureType,
  15597. time: this.time,
  15598. userecent: this.userecent
  15599. });
  15600. var a = a || this.filter,
  15601. d = b || this.successFn,
  15602. e = c || this.failFn,
  15603. b = GeoGlobe.Function.bind(function(a) {
  15604. if (a.success()) {
  15605. try {
  15606. var b = this._analysis_StatisticsResult(a.priv.responseXML)
  15607. } catch (c) {
  15608. d(a.priv.responseText);
  15609. return
  15610. }
  15611. d(b)
  15612. } else e()
  15613. },
  15614. this);
  15615. this.response = this.protocol.read({
  15616. sortBy: this.sortBy,
  15617. groupBy: this.groupBy,
  15618. filter: a,
  15619. callback: b
  15620. })
  15621. },
  15622. _analysis_StatisticsResult: function(a) {
  15623. var b = {},
  15624. a = a.documentElement.firstChild.childNodes;
  15625. if (0 < a.length) b.layers = this._analysis_StatisticsResult_results(a);
  15626. return b
  15627. },
  15628. _analysis_StatisticsResult_results: function(a) {
  15629. for (var b = [], c = 0; c < a.length; c++) {
  15630. for (var d = {}, e = [], f = a[c].childNodes, g = 0; g < f.length; g++) {
  15631. var h = {};
  15632. h.layerName = f[g].parentNode.nodeName;
  15633. h.result = navigator.appName == "Microsoft Internet Explorer" ?
  15634. this._analysis_StatisticsResult_results_result_IE(f[g]) : this._analysis_StatisticsResult_results_result_google(f[g]);
  15635. e.push(h)
  15636. }
  15637. d.results = e;
  15638. b.push(d)
  15639. }
  15640. return b
  15641. },
  15642. _analysis_StatisticsResult_results_result_IE: function(a) {
  15643. var b = {},
  15644. c = 0;
  15645. if ("Key" == a.childNodes[0].nodeName) b.Key = a.childNodes[0].text, c = 1;
  15646. for (var d = [], e = []; c < a.childNodes.length; c++) {
  15647. var f = {},
  15648. g = {};
  15649. f.name = a.childNodes[c].getAttribute("name");
  15650. g.Value = a.childNodes[c].text;
  15651. d.push(f);
  15652. e.push(g)
  15653. }
  15654. b.name = d;
  15655. b.values = e;
  15656. return b
  15657. },
  15658. _analysis_StatisticsResult_results_result_google: function(a) {
  15659. var b = {},
  15660. c = 0;
  15661. if ("Key" == a.childNodes[0].nodeName) b.Key = a.childNodes[0].innerHTML, c = 1;
  15662. for (var d = [], e = []; c < a.childNodes.length; c++) {
  15663. var f = {},
  15664. g = {};
  15665. f.name = a.childNodes[c].getAttribute("name");
  15666. g.Value = a.childNodes[c].innerHTML;
  15667. d.push(f);
  15668. e.push(g)
  15669. }
  15670. b.name = d;
  15671. b.values = e;
  15672. return b
  15673. },
  15674. successFn: function() {},
  15675. failFn: function() {
  15676. alert("\u5bf9\u4e0d\u8d77,\u67e5\u8be2\u5931\u8d25,\u8bf7\u67e5\u8be2\u670d\u52a1\u662f\u5426\u6b63\u5e38\u3002")
  15677. },
  15678. _separateFeatures: function(a) {
  15679. for (var b = {}, c = 0; c < a.length; c++) {
  15680. var d = a[c],
  15681. e;
  15682. e = d.gml ?
  15683. d.gml.featureType : d.type;
  15684. b[e] || (b[e] = []);
  15685. b[e].push(d)
  15686. }
  15687. return b
  15688. },
  15689. setTime: function(a) {
  15690. this.time = a
  15691. },
  15692. setUserecent: function(a) {
  15693. this.userecent = a
  15694. },
  15695. CLASS_NAME: "GeoGlobe.Query.WFSQuery"
  15696. });
  15697. GeoGlobe.Query.WFSQuery.reverseGeometryXY = function(a) {
  15698. var b = {
  15699. Point: function(a) {
  15700. var b = a.x,
  15701. e = a.y,
  15702. a = a.clone(a);
  15703. a.x = e;
  15704. a.y = b;
  15705. return a
  15706. },
  15707. LineString: function(a, b) {
  15708. for (var e = a.clone(a), f = 0; f < e.components.length; f++) {
  15709. var g = b.Point(e.components[f]);
  15710. e.components[f] = g
  15711. }
  15712. return e
  15713. },
  15714. Polygon: function(a, b) {
  15715. for (var e = a.clone(a), f = 0; f < e.components.length; f++)
  15716. for (var g = 0; g < e.components[f].components.length - 1; g++) {
  15717. var h = b.Point(e.components[f].components[g]);
  15718. e.components[f].components[g] = h
  15719. }
  15720. return e
  15721. }
  15722. };
  15723. return b[{
  15724. "GeoGlobe.Geometry.Point": "Point",
  15725. "GeoGlobe.Geometry.MultiPoint": "MultiPoint",
  15726. "GeoGlobe.Geometry.LineString": "LineString",
  15727. "GeoGlobe.Geometry.MultiLineString": "MultiLineString",
  15728. "GeoGlobe.Geometry.Polygon": "Polygon",
  15729. "GeoGlobe.Geometry.MultiPolygon": "MultiPolygon",
  15730. "GeoGlobe.Geometry.Collection": "GeometryCollection"
  15731. }[a.CLASS_NAME]](a, b)
  15732. };
  15733. GeoGlobe.Format.WFSHits = GeoGlobe.Class4OL(GeoGlobe.Format.XML, {
  15734. wfsns: "http://www.opengis.net/wfs",
  15735. featureCollection: "FeatureCollection",
  15736. read: function(a) {
  15737. typeof a == "string" && (a = GeoGlobe.Format.XML.prototype.read.apply(this, [a]));
  15738. return {
  15739. numberOfFeatures: parseInt(a.documentElement.getAttribute("numberOfFeatures"))
  15740. }
  15741. }
  15742. });
  15743. GeoGlobe.Query.GeoCodingQuery = function(a, b) {
  15744. var b = GeoGlobe.Util.applyDefaults(b, GeoGlobe.Query.GeoCodingQuery.DEFAULTS),
  15745. c = GeoGlobe.Query.GeoCodingQuery["v" + b.version.replace(/\./g, "_")];
  15746. if (!c) throw "\u4e0d\u652f\u6301\u7684\u5730\u5740\u5339\u914d\u670d\u52a1\u7248\u672c: " + b.version;
  15747. return new c(a, b)
  15748. };
  15749. GeoGlobe.Query.GeoCodingQuery.DEFAULTS = {
  15750. version: "1.0.0"
  15751. };
  15752. GeoGlobe.Query.GeoCodingQuery.v1 = GeoGlobe.Class4OL({
  15753. version: "1.0.0",
  15754. url: null,
  15755. initialize: function(a, b) {
  15756. this.url = a;
  15757. GeoGlobe.Util.extend(this, b);
  15758. this.format = new GeoGlobe.Format.JSON
  15759. },
  15760. getCommonParams: function(a) {
  15761. var b = {
  15762. request: "GetCategory",
  15763. service: "GeoCoding",
  15764. version: this.version,
  15765. output: "json"
  15766. };
  15767. GeoGlobe.Util.extend(b, a);
  15768. return b
  15769. },
  15770. getCategoryByName: function(a, b, c) {
  15771. var d = this.getCommonParams();
  15772. if (typeof a === "string" && a.length !== 0) d.categoryName = a;
  15773. c = c || this.failFn;
  15774. GeoGlobe.Function.bind(this._requestCategory,
  15775. this)(d, b, c)
  15776. },
  15777. getCategoryByCode: function(a, b, c) {
  15778. var d = this.getCommonParams();
  15779. if (typeof a === "number") d.categoryCode = a;
  15780. GeoGlobe.Function.bind(this._requestCategory, this)(d, b, c)
  15781. },
  15782. getAllCategory: function(a, b) {
  15783. var c = this.getCommonParams();
  15784. GeoGlobe.Function.bind(this._requestCategory, this)(c, a, b)
  15785. },
  15786. _requestCategory: function(a, b, c) {
  15787. c = c || this.failFn;
  15788. GeoGlobe.loadURL(this.url, a, this, function(a) {
  15789. try {
  15790. var c = this.format.read(a.responseText)
  15791. } catch (f) {
  15792. b(a.responseText);
  15793. return
  15794. }
  15795. b(c)
  15796. }, c)
  15797. },
  15798. _analysis_GeoCodeResult: function(a) {
  15799. var b = {
  15800. status: a.status
  15801. };
  15802. switch (a.status) {
  15803. case "OK":
  15804. if (a = a.results) b.results = this._analysis_GeoCodeResult_results(a);
  15805. break;
  15806. case "INVALID_REQUEST":
  15807. break;
  15808. case "NO_RESULTS":
  15809. break;
  15810. case "UNKNOWN_ERROR":
  15811. break;
  15812. default:
  15813. if (b = {
  15814. requestKeyWord: a.requestKeyWord,
  15815. count: a.count,
  15816. statisticsLevel: a.statisticsLevel,
  15817. statisticsLevelName: a.statisticsLevelName
  15818. }, a && a.count > 0 && (a = a.results)) b.results = this._analysis_GeoCodeResult_statistics(a)
  15819. }
  15820. return b
  15821. },
  15822. _analysis_GeoCodeResult_results: function(a) {
  15823. var b = [];
  15824. if (GeoGlobe.Util.isArray(a)) {
  15825. for (var c =
  15826. 0, d = a.length; c < d; c++) {
  15827. var e = {};
  15828. e.requestKeyWord = a[c].requestKeyWord;
  15829. if (a[c].errorCorrectionTips) e.errorCorrectionTips = a[c].errorCorrectionTips;
  15830. e.count = a[c].count;
  15831. if (a[c].result) e.result = this._analysis_GeoCodeResult_results_result(a[c].result);
  15832. b.push(e)
  15833. }
  15834. return b
  15835. }
  15836. },
  15837. _analysis_GeoCodeResult_statistics: function(a) {
  15838. var b = [];
  15839. if (GeoGlobe.Util.isArray(a)) {
  15840. for (var c = 0, d = a.length; c < d; c++) {
  15841. var e = {};
  15842. if (a[c].errorCorrectionTips) e.errorCorrectionTips = a[c].errorCorrectionTips;
  15843. if (a[c]) e.name = a[c].name, e.value = a[c].value,
  15844. e.remark = a[c].remark;
  15845. b.push(e)
  15846. }
  15847. return b
  15848. }
  15849. },
  15850. _analysis_GeoCodeResult_results_result: function(a) {
  15851. for (var b = [], c = 0, d = a.length; c < d; c++) {
  15852. var e = {},
  15853. f = {};
  15854. e.resultType = a[c].resultType;
  15855. e.precise = a[c].precise;
  15856. e.isBrief = a[c].isBrief;
  15857. e.score = a[c].score;
  15858. if (a[c].addressComponent.street) f = a[c].addressComponent.street;
  15859. if (e.isBrief == !1) e.addressComponent = this._analysis_GeoCodeResult_results_result_address(a[c].addressComponent, e.resultType);
  15860. e.poiArray = this._analysispoiArray(a[c].poiArray);
  15861. if (a[c].location) e.location =
  15862. a[c].location;
  15863. if (e.precise == 0) e.referenceAddressArray = a[c].referenceAddressArray;
  15864. if (f) e.street_path = f;
  15865. b.push(e)
  15866. }
  15867. return b
  15868. },
  15869. _analysis_GeoCodeResult_results_result_address: function(a, b) {
  15870. var c = {
  15871. country: a.country
  15872. };
  15873. if (a.province) c.province = a.province;
  15874. if (a.city) c.city = a.city;
  15875. if (a.district) c.district = a.district;
  15876. if (a.town) c.town = a.town;
  15877. if (a.street && (c.street = {
  15878. name: a.street.name
  15879. }, b === "street" && a.street.geometry)) {
  15880. var d = this.format.read(a.street.geometry),
  15881. e = null;
  15882. if (d.paths) e = this._getGeometry(d), c.street.geometry =
  15883. e;
  15884. else if (d.rings) e = this._getGeometry(d), c.street.geometry = e;
  15885. else if (d.x && d.y) e = this._getGeometry(d), c.street.geometry = e
  15886. }
  15887. if (a.streetNumber) c.streetNumber = a.streetNumber;
  15888. if (a.buildingNumber) c.buildingNumber = a.buildingNumber;
  15889. if (b === "adminArea") {
  15890. if (a.geometry)
  15891. if (d = this.format.read(a.geometry), e = null, d.rings) e = this._getGeometry(d), c.geometry = e;
  15892. else if (d.paths) e = this._getGeometry(d), c.geometry = e;
  15893. else if (typeof d.x === "number" && typeof d.y === "number") c.geometry = this._getGeometry(d);
  15894. if (a.subordinate) c.subordinate =
  15895. a.subordinate;
  15896. if (a.zipCode) c.zipCode = a.zipCode;
  15897. if (a.callingCode) c.callingCode = a.callingCode
  15898. }
  15899. return c
  15900. },
  15901. _analysispoiArray: function(a) {
  15902. for (var b = [], c = 0, d = a.length; c < d; c++) {
  15903. var e = {},
  15904. f;
  15905. for (f in a[c]) e[f] = a[c][f];
  15906. if ("" != e.geometry && void 0 != e.geometry) {
  15907. var g = this.format.read(e.geometry);
  15908. e.geometry = this._getGeometry(g)
  15909. }
  15910. b.push(e)
  15911. }
  15912. return b
  15913. },
  15914. _analysisLocation: function() {},
  15915. _getGeometry: function(a) {
  15916. for (var b in a) {
  15917. if ("spatialReference" == b) break;
  15918. return a = a.hasOwnProperty("x") && a.hasOwnProperty("y") ? new GeoGlobe.Geometry.Point(a.x,
  15919. a.y) : a.hasOwnProperty("xmin") && a.hasOwnProperty("ymin") && a.hasOwnProperty("xmax") && a.hasOwnProperty("ymax") ? (new GeoGlobe.LngLatBounds(a.xmin, a.ymin, a.xmax, a.ymax)).toGeometry() : this._geometryType[b](a[b])
  15920. }
  15921. },
  15922. _geometryType: {
  15923. points: function(a) {
  15924. var b = [];
  15925. if (GeoGlobe.Util.isArray(a))
  15926. for (var c = 0, d = a.length; c < d; c++) {
  15927. var e = new GeoGlobe.Geometry.Point(a[c][0], a[c][1]);
  15928. b.push(e)
  15929. }
  15930. return b
  15931. },
  15932. paths: function(a) {
  15933. var b = [];
  15934. if (GeoGlobe.Util.isArray(a)) {
  15935. for (var c = 0, d = a.length; c < d; c++) {
  15936. for (var e = [], f = 0, g = a[c].length; f <
  15937. g; f++) e.push(new GeoGlobe.Geometry.Point(a[c][f][0], a[c][f][1]));
  15938. e = new GeoGlobe.Geometry.LineString(e);
  15939. b.push(e)
  15940. }
  15941. c = new GeoGlobe.Geometry.MultiLineString(b)
  15942. }
  15943. return c
  15944. },
  15945. rings: function(a) {
  15946. var b = [];
  15947. if (GeoGlobe.Util.isArray(a)) {
  15948. for (var c = 0, d = a.length; c < d; c++) {
  15949. for (var e = [], f = 0, g = a[c].length; f < g; f++) e.push(new GeoGlobe.Geometry.Point(a[c][f][0], a[c][f][1]));
  15950. e = new GeoGlobe.Geometry.LinearRing(e);
  15951. b.push(e)
  15952. }
  15953. c = new GeoGlobe.Geometry.Polygon(b)
  15954. }
  15955. return c
  15956. }
  15957. },
  15958. failFn: function(a) {
  15959. typeof a == "string" && alert(a);
  15960. alert("\u5bf9\u4e0d\u8d77\uff0c\u67e5\u8be2\u8bf7\u6c42\u5931\u8d25\uff01\u8bf7\u68c0\u67e5\u5730\u5740\u5339\u914d\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u3002\n\u5f53\u524d\u670d\u52a1\u5730\u5740\u4e3a\uff1a" +
  15961. this.url)
  15962. },
  15963. CLASS_NAME: "GeoGlobe.Query.GeoCodingQuery.v1"
  15964. });
  15965. GeoGlobe.Query.GeoCodingQuery.v1_0_0 = GeoGlobe.Class4OL(GeoGlobe.Query.GeoCodingQuery.v1, {
  15966. addressesToLocations: function(a, b) {
  15967. var c = this.getCommonParams({
  15968. request: "GeoCoder"
  15969. });
  15970. if (typeof a.address === "string") c.address = a.address;
  15971. else if (GeoGlobe.Util.isArray(a.address)) {
  15972. for (var d = "", e = 0; e < a.address.length; e++) d += a.address[e] + ",";
  15973. d = d.substr(0, d.length - 1);
  15974. c.address = d
  15975. } else if (a.address == void 0 || a.address == null) throw "address\u662f\u5fc5\u9009\u53c2\u6570\uff01";
  15976. if (typeof a.categoryCode === "number") c.categoryCode =
  15977. a.categoryCode;
  15978. if (a.extent instanceof mapboxgl.LngLatBounds) c.bbox = a.extent.toBBOX(null, !0);
  15979. else if (a.extent instanceof GeoGlobe.Geometry.Polygon) {
  15980. for (var d = a.extent, f = [], e = 0, g = d.components.length; e < g; e++)
  15981. for (var h = d.components[e].components, j = 0; j < h.length; j++) f.push(h[j].toShortString());
  15982. c.bbox = f.join(",")
  15983. }
  15984. if (typeof a.fuzzyMatch === "boolean") c.fuzzyMatch = a.fuzzyMatch;
  15985. if (typeof a.resultType === "string") c.resultType = a.resultType;
  15986. if (typeof a.maxCount === "number") c.maxCount = a.maxCount;
  15987. if (typeof a.startPosition ===
  15988. "number") c.startPosition = a.startPosition;
  15989. GeoGlobe.loadURL(this.url, c, this, function(a) {
  15990. try {
  15991. var d = this.format.read(a.responseText),
  15992. e = c.resultType == "result" ? this._parseQueryResultToFeature(d) : this._analysis_GeoCodeResult(d)
  15993. } catch (f) {
  15994. b(a.responseText);
  15995. return
  15996. }
  15997. b(e)
  15998. }, this.failFn)
  15999. },
  16000. locationToAddresses: function(a, b) {
  16001. var c = this.getCommonParams({
  16002. request: "GeoCoder"
  16003. });
  16004. if (a.lonlat) c.latlng = a.lonlat.lat + "," + a.lonlat.lng;
  16005. else throw "address\u662f\u5fc5\u9009\u53c2\u6570\uff01\u8bf7\u586b\u5199\u6b63\u786e\u7684\u6570\u636e\u7c7b\u578b\uff01";
  16006. if (typeof a.tolerance === "number") c.tolerance = a.tolerance;
  16007. if (typeof a.unit === "string") c.unit = a.unit;
  16008. if (typeof a.resultType === "string") c.resultType = a.resultType;
  16009. if (typeof a.maxCount === "number") c.maxCount = a.maxCount;
  16010. if (typeof a.startPosition === "number") c.startPosition = a.startPosition;
  16011. GeoGlobe.loadURL(this.url, c, this, function(a) {
  16012. try {
  16013. var e = this.format.read(a.responseText),
  16014. f = c.resultType == "result" ? this._parseQueryResultToFeature(e) : this._analysis_GeoCodeResult(e)
  16015. } catch (g) {
  16016. b(a.responseText);
  16017. return
  16018. }
  16019. b(f, e)
  16020. },
  16021. this.failFn)
  16022. },
  16023. getLocations: function(a, b, c) {
  16024. this.addressesToLocations(a, GeoGlobe.Function.bind(function(a) {
  16025. b(this._parseQueryResultToFeature(a, total))
  16026. }, this), c)
  16027. },
  16028. getLocationsByPage: function(a, b, c) {
  16029. a.resultType = "hits";
  16030. this.addressesToLocations(a, GeoGlobe.Function.bind(function(d) {
  16031. if (d.status == "OK") {
  16032. a.resultType = "result";
  16033. var e = d.results[0].count;
  16034. if (a.maxCount == void 0 || a.maxCount == null) a.maxCount = 3;
  16035. a.startPosition = (a.startPosition - 1) * a.maxCount + 1;
  16036. this.addressesToLocations(a, GeoGlobe.Function.bind(function(a) {
  16037. b(this._parseQueryResultToFeature(a,
  16038. e))
  16039. }, this), c)
  16040. } else alert("\u6ca1\u6709\u67e5\u8be2\u5230\u4efb\u4f55\u6570\u636e")
  16041. }, this), c)
  16042. },
  16043. getAddresses: function(a, b, c) {
  16044. this.locationToAddresses(a, GeoGlobe.Function.bind(function(a) {
  16045. b(this._parseQueryResultToFeature(a, total))
  16046. }, this), c)
  16047. },
  16048. getAddressesByPage: function(a, b, c) {
  16049. a.resultType = "hits";
  16050. this.locationToAddresses(a, GeoGlobe.Function.bind(function(d) {
  16051. if (d.status == "OK") {
  16052. a.resultType = "result";
  16053. var e = d.results[0].count;
  16054. if (a.maxCount == void 0 || a.maxCount == null) a.maxCount = 3;
  16055. a.startPosition = (a.startPosition -
  16056. 1) * a.maxCount + 1;
  16057. this.locationToAddresses(a, GeoGlobe.Function.bind(function(a) {
  16058. b(this._parseQueryResultToFeature(a, e))
  16059. }, this), c)
  16060. } else alert("\u6ca1\u6709\u67e5\u8be2\u5230\u4efb\u4f55\u6570\u636e")
  16061. }, this), c)
  16062. },
  16063. _parseQueryResultToFeature: function(a) {
  16064. var b = [];
  16065. if (a.status == "OK" && a.results)
  16066. for (var c = 0; c < a.results.length; c++) {
  16067. var d = a.results[c].result;
  16068. if (d)
  16069. for (var e = 0; e < d.length; e++) {
  16070. var f = {},
  16071. g = null;
  16072. f.requestKeyWord = a.results[c].requestKeyWord;
  16073. if (GeoGlobe.Util.isArray(d[e].poiArray))
  16074. for (var h = 0; h < d[e].poiArray.length; h++) f.CONTINENT =
  16075. d[e].poiArray[h].CONTINENT, f.GBCODE = d[e].poiArray[h].GBCODE, f.STANDARDNAME = d[e].poiArray[h].STANDARDNAME, f.name = d[e].poiArray[h].name;
  16076. if (d[e].addressComponent) f.address = this._getAddress(d[e].addressComponent, f.name), f.country = d[e].addressComponent.country, f.province = d[e].addressComponent.province, f.city = d[e].addressComponent.city, f.district = d[e].addressComponent.district, d[e].addressComponent.street ? (f.streetName = d[e].addressComponent.street.name, f.streetgeometry = d[e].addressComponent.street.geometry) :
  16077. f.streetName = "", f.streetNumber = d[e].addressComponent.streetNumber;
  16078. if (d[e].location) {
  16079. if (d[e].location.lng) f.lng = d[e].location.lng;
  16080. if (d[e].location.lat) f.lat = d[e].location.lat;
  16081. g = new GeoGlobe.Geometry.Point(d[e].location.lng, d[e].location.lat)
  16082. }
  16083. f.isBrief = d[e].isBrief;
  16084. f.precise = d[e].precise;
  16085. f.resultType = d[e].resultType;
  16086. f.score = d[e].score;
  16087. f = new GeoGlobe.Feature(g, f);
  16088. b.push(f)
  16089. }
  16090. }
  16091. c = (new GeoGlobe.Format.GeoJSON).write(b);
  16092. c = (new GeoGlobe.Format.JSON).read(c);
  16093. return {
  16094. status: a.status,
  16095. features: b,
  16096. geojsonFeatures: c
  16097. }
  16098. },
  16099. _getAddress: function(a, b) {
  16100. var c = "";
  16101. a.country && (c += a.country);
  16102. a.province && (c += a.province);
  16103. a.city && (c += a.city);
  16104. a.district && (c += a.district);
  16105. a.street && (a.street.name && (c += a.street.name), a.streetNumber && (c += a.streetNumber + "\u53f7"));
  16106. b && (c += b);
  16107. return c
  16108. },
  16109. CLASS_NAME: "GeoGlobe.Query.GeoCodingQuery.v1_0_0"
  16110. });
  16111. GeoGlobe.Query.GeoCodingQuery.v1_1_0 = GeoGlobe.Class4OL(GeoGlobe.Query.GeoCodingQuery.v1, {
  16112. method: "get",
  16113. initialize: function(a, b) {
  16114. GeoGlobe.Util.extend(this, b);
  16115. this.filterFormat = new GeoGlobe.Format.Filter;
  16116. GeoGlobe.Query.GeoCodingQuery.v1.prototype.initialize.apply(this, arguments)
  16117. },
  16118. addressesToLocations: function(a, b, c) {
  16119. var d = this.getCommonParams({
  16120. request: "GeoCoder"
  16121. });
  16122. d.reverseMatch = !1;
  16123. if (typeof a.address === "string") d.keyword = a.address;
  16124. if (typeof a.categoryCode === "number") d.categoryCode = a.categoryCode;
  16125. if ((a.address ==
  16126. void 0 || a.address == null) && (a.categoryCode == void 0 || a.categoryCode == null)) throw "address\u662f\u5fc5\u9009\u53c2\u6570\uff01";
  16127. if (a.extent instanceof mapboxgl.LngLatBounds) d.bbox = a.extent.toBBOX(null, !0);
  16128. else if (a.extent instanceof GeoGlobe.Geometry.Polygon) {
  16129. for (var e = a.extent, f = [], g = 0, h = e.components.length; g < h; g++)
  16130. for (var j = e.components[g].components, l = 0; l < j.length; l++) f.push(j[l].toShortString());
  16131. d.bbox = f.join(",")
  16132. }
  16133. if (a.filter instanceof GeoGlobe.Filter) e = this.filterFormat.write(a.filter), e = GeoGlobe.Format.XML.prototype.write.apply(this.filterFormat, [e]), d.filter = e;
  16134. if (typeof a.resultType === "string") d.resultType = a.resultType;
  16135. if (a.resultType == "statistics") d.statisticsLevel = a.statisticsLevel;
  16136. if (typeof a.maxCount === "number") d.maxCount = a.maxCount;
  16137. if (typeof a.startPosition === "number") d.startPosition = a.startPosition;
  16138. if (typeof a.semanticAnalysis === "boolean") d.semanticAnalysis = a.semanticAnalysis;
  16139. if (typeof a.customWeight === "boolean") d.customWeight = a.customWeight;
  16140. this._setGeoCoderCommonProperty(d, a);
  16141. this._getCodingRequest(d, b, c)
  16142. },
  16143. _getCodingRequest: function(a,
  16144. b) {
  16145. if (this.method == "get") GeoGlobe.loadURL(this.url, a, this, function(c) {
  16146. try {
  16147. var e = this.format.read(c.responseText),
  16148. f = a.resultType == "result" ? this._parseQueryResultToFeature(e) : this._analysis_GeoCodeResult(e)
  16149. } catch (g) {
  16150. b(c.responseText);
  16151. return
  16152. }
  16153. b(f)
  16154. }, this.failFn);
  16155. else {
  16156. var c = GeoGlobe.Util.getParameterString(a, !0);
  16157. GeoGlobe.Request.POST({
  16158. url: this.url,
  16159. data: c,
  16160. success: function(a) {
  16161. try {
  16162. var c = this._analysis_GeoCodeResult(this.format.read(a.responseText))
  16163. } catch (f) {
  16164. b(a.responseText);
  16165. return
  16166. }
  16167. b(c)
  16168. },
  16169. failure: this.failFn,
  16170. scope: this
  16171. })
  16172. }
  16173. },
  16174. _setGeoCoderCommonProperty: function(a, b) {
  16175. if (typeof b.sortFields === "string") a.sortFields = b.sortFields;
  16176. if (typeof b.scoreFilter === "string") a.scoreFilter = b.scoreFilter
  16177. },
  16178. locationToAddresses: function(a, b, c) {
  16179. var d = this.getCommonParams({
  16180. request: "GeoCoder"
  16181. });
  16182. d.reverseMatch = !0;
  16183. if (a.lonlat) d.keyword = a.lonlat.lat + "," + a.lonlat.lng;
  16184. else throw "address\u662f\u5fc5\u9009\u53c2\u6570\uff01\u8bf7\u586b\u5199\u6b63\u786e\u7684\u6570\u636e\u7c7b\u578b\uff01";
  16185. if (typeof a.tolerance === "number") d.tolerance =
  16186. a.tolerance;
  16187. if (typeof a.unit === "string") d.unit = a.unit;
  16188. if (typeof a.resultType === "string") d.resultType = a.resultType;
  16189. if (a.resultType == "statistics") d.statisticsLevel = a.statisticsLevel;
  16190. if (typeof a.maxCount === "number") d.maxCount = a.maxCount;
  16191. if (typeof a.startPosition === "number") d.startPosition = a.startPosition;
  16192. if (typeof a.customWeight === "boolean") d.customWeight = a.customWeight;
  16193. this._setGeoCoderCommonProperty(d, a);
  16194. this._getCodingRequest(d, b, c)
  16195. },
  16196. batchAddressesToLocations: function(a, b, c) {
  16197. var d = this.getCommonParams({
  16198. request: "BatchGeoCoder",
  16199. service: "GeoCoding"
  16200. });
  16201. d.reverseMatch = !1;
  16202. if (GeoGlobe.Util.isArray(a.address)) {
  16203. for (var e = "", f = 0; f < a.address.length; f++) e += a.address[f] + ",";
  16204. e = e.substr(0, e.length - 1);
  16205. d.keywords = e
  16206. } else if (a.address == void 0 || a.address == null) throw "address\u662f\u5fc5\u9009\u53c2\u6570\uff01";
  16207. if (typeof a.singleKeywordResultCount === "number") d.singleKeywordResultCount = a.singleKeywordResultCount;
  16208. if (a.filter instanceof GeoGlobe.Filter) e = this.filterFormat.write(a.filter), e = GeoGlobe.Format.XML.prototype.write.apply(this.filterFormat, [e]), d.filter = e;
  16209. this._setGeoCoderCommonProperty(d, a);
  16210. this._getCodingRequest(d, b, c)
  16211. },
  16212. batchLocationToAddresses: function(a, b, c) {
  16213. var d = this.getCommonParams({
  16214. request: "BatchGeoCoder",
  16215. service: "GeoCoding"
  16216. });
  16217. d.reverseMatch = !0;
  16218. if (a.lonlats instanceof GeoGlobe.LonLat) a.lonlats = [a.lonlats];
  16219. else if (!GeoGlobe.Util.isArray(a.lonlats)) throw "address\u662f\u5fc5\u9009\u53c2\u6570\uff01\u8bf7\u586b\u5199\u6b63\u786e\u7684\u6570\u636e\u7c7b\u578b\uff01";
  16220. if (GeoGlobe.Util.isArray(a.lonlats)) {
  16221. for (var e = "", f = 0; f < a.lonlats.length; f++) e +=
  16222. a.lonlats[f].lat + "," + a.lonlats[f].lng + ";";
  16223. e = e.substr(0, e.length - 1);
  16224. d.keywords = e
  16225. }
  16226. if (typeof a.tolerance === "number") d.tolerance = a.tolerance;
  16227. if (typeof a.unit === "string") d.unit = a.unit;
  16228. if (typeof a.singleKeywordResultCount === "number") d.singleKeywordResultCount = a.singleKeywordResultCount;
  16229. this._setGeoCoderCommonProperty(d, a);
  16230. this._getCodingRequest(d, b, c)
  16231. },
  16232. _getAddress: function(a, b) {
  16233. var c = "";
  16234. a.country && (c += a.country);
  16235. a.province && (c += a.province);
  16236. a.city && (c += a.city);
  16237. a.district && (c += a.district);
  16238. a.street && (a.street.name &&
  16239. (c += a.street.name), a.streetNumber && (c += a.streetNumber + "\u53f7"));
  16240. b && (c += b);
  16241. return c
  16242. },
  16243. getLocations: function(a, b, c) {
  16244. this.addressesToLocations(a, GeoGlobe.Function.bind(function(a) {
  16245. b(this._parseQueryResultToFeature(a, total))
  16246. }, this), c)
  16247. },
  16248. getLocationsByPage: function(a, b, c) {
  16249. a.resultType = "hits";
  16250. this.addressesToLocations(a, GeoGlobe.Function.bind(function(d) {
  16251. if (d.status == "OK") {
  16252. a.resultType = "result";
  16253. var e = d.results[0].count;
  16254. if (a.maxCount == void 0 || a.maxCount == null) a.maxCount = 3;
  16255. a.startPosition = (a.startPosition -
  16256. 1) * a.maxCount + 1;
  16257. this.addressesToLocations(a, GeoGlobe.Function.bind(function(a) {
  16258. b(this._parseQueryResultToFeature(a, e))
  16259. }, this), c)
  16260. } else alert("\u6ca1\u6709\u67e5\u8be2\u5230\u4efb\u4f55\u6570\u636e")
  16261. }, this), c)
  16262. },
  16263. getAddresses: function(a, b, c) {
  16264. this.locationToAddresses(a, GeoGlobe.Function.bind(function(a) {
  16265. b(this._parseQueryResultToFeature(a, total))
  16266. }, this), c)
  16267. },
  16268. getAddressesByPage: function(a, b, c) {
  16269. a.resultType = "hits";
  16270. this.locationToAddresses(a, GeoGlobe.Function.bind(function(d) {
  16271. if (d.status == "OK") {
  16272. a.resultType =
  16273. "result";
  16274. var e = d.results[0].count;
  16275. if (a.maxCount == void 0 || a.maxCount == null) a.maxCount = 3;
  16276. a.startPosition = (a.startPosition - 1) * a.maxCount + 1;
  16277. this.locationToAddresses(a, GeoGlobe.Function.bind(function(a) {
  16278. b(this._parseQueryResultToFeature(a, e))
  16279. }, this), c)
  16280. } else alert("\u6ca1\u6709\u67e5\u8be2\u5230\u4efb\u4f55\u6570\u636e")
  16281. }, this), c)
  16282. },
  16283. batchGetAddresses: function(a, b, c) {
  16284. this.batchLocationToAddresses(a, GeoGlobe.Function.bind(function(a) {
  16285. b(this._parseQueryResultToFeature(a))
  16286. }, this), c)
  16287. },
  16288. batchGetLocations: function(a,
  16289. b, c) {
  16290. this.batchAddressesToLocations(a, GeoGlobe.Function.bind(function(a) {
  16291. b(this._parseQueryResultToFeature(a))
  16292. }, this), c)
  16293. },
  16294. _parseQueryResultToFeature: function(a) {
  16295. var b = [];
  16296. if (a.status == "OK" && a.results)
  16297. for (var c = 0; c < a.results.length; c++) {
  16298. var d = a.results[c].result;
  16299. if (d)
  16300. for (var e = 0; e < d.length; e++) {
  16301. var f = {},
  16302. g = null;
  16303. f.requestKeyWord = a.results[c].requestKeyWord;
  16304. if (GeoGlobe.Util.isArray(d[e].poiArray))
  16305. for (var h = 0; h < d[e].poiArray.length; h++) f.CONTINENT = d[e].poiArray[h].CONTINENT, f.GBCODE = d[e].poiArray[h].GBCODE,
  16306. f.STANDARDNAME = d[e].poiArray[h].STANDARDNAME, f.name = d[e].poiArray[h].name;
  16307. if (d[e].addressComponent) f.address = this._getAddress(d[e].addressComponent, f.name), f.country = d[e].addressComponent.country, f.province = d[e].addressComponent.province, f.city = d[e].addressComponent.city, f.district = d[e].addressComponent.district, d[e].addressComponent.street ? (f.streetName = d[e].addressComponent.street.name, f.streetgeometry = d[e].addressComponent.street.geometry) : f.streetName = "", f.streetNumber = d[e].addressComponent.streetNumber;
  16308. if (d[e].location) {
  16309. if (d[e].location.lng) f.lng = d[e].location.lng;
  16310. if (d[e].location.lat) f.lat = d[e].location.lat;
  16311. g = new GeoGlobe.Geometry.Point(d[e].location.lng, d[e].location.lat)
  16312. }
  16313. f.isBrief = d[e].isBrief;
  16314. f.precise = d[e].precise;
  16315. f.resultType = d[e].resultType;
  16316. f.score = d[e].score;
  16317. f = new GeoGlobe.Feature(g, f);
  16318. b.push(f)
  16319. }
  16320. }
  16321. c = (new GeoGlobe.Format.GeoJSON).write(b);
  16322. c = (new GeoGlobe.Format.JSON).read(c);
  16323. return {
  16324. status: a.status,
  16325. features: b,
  16326. geojsonFeatures: c
  16327. }
  16328. },
  16329. CLASS_NAME: "GeoGlobe.Query.GeoCodingQuery.v1_1_0"
  16330. });
  16331. GeoGlobe.Query.DQSQuery = GeoGlobe.Class4OL({
  16332. url: null,
  16333. initialize: function(a) {
  16334. GeoGlobe.Util.extend(this, a)
  16335. },
  16336. getCapabilities: function(a, b, c) {
  16337. GeoGlobe.loadURL(this.url, {
  16338. SERVICE: "DataQueryService",
  16339. VERSION: "1.0.0",
  16340. REQUEST: "GetCapabilities"
  16341. }, this, function(a) {
  16342. b && (a = JSON.parse(a.responseText), b(a))
  16343. }, function(a) {
  16344. c && c(a)
  16345. })
  16346. },
  16347. getDataSetList: function(a, b, c) {
  16348. var d = this.url,
  16349. e = {
  16350. SERVICE: "DataQueryService",
  16351. VERSION: "1.0.0",
  16352. REQUEST: "GetDataSetList"
  16353. };
  16354. if (a && a.startPosition) e.STARTPOSITION = a.startPosition;
  16355. if (a && a.maxCount) e.MAXCOUNT =
  16356. a.maxCount;
  16357. GeoGlobe.loadURL(d, e, this, function(a) {
  16358. a = JSON.parse(a.responseText);
  16359. b && b(a)
  16360. }, function(a) {
  16361. c && c(a)
  16362. })
  16363. },
  16364. describeDataSet: function(a, b, c) {
  16365. GeoGlobe.loadURL(this.url, {
  16366. SERVICE: "DataQueryService",
  16367. VERSION: "1.0.0",
  16368. REQUEST: "DescribeDataSet",
  16369. DATASETID: a.dataSetId
  16370. }, this, function(a) {
  16371. a = JSON.parse(a.responseText);
  16372. b && b(a)
  16373. }, function(a) {
  16374. c && c(a)
  16375. })
  16376. },
  16377. query: function(a, b, c) {
  16378. var d = this.url,
  16379. e = {
  16380. SERVICE: "DataQueryService",
  16381. VERSION: "1.0.0",
  16382. REQUEST: "Query",
  16383. DATASETID: a.dataSetId
  16384. };
  16385. if (a && a.startPosition) e.STARTPOSITION = a.startPosition;
  16386. if (a && a.maxCount) e.MAXCOUNT = a.maxCount;
  16387. if (a && a.rowFilter) e.ROWFILTER = this._makeSQLFilter(a.rowFilter);
  16388. if (a && a.colFilter) e.COLFILTER = a.colFilter;
  16389. a && e && GeoGlobe.loadURL(d, e, this, function(a) {
  16390. a = JSON.parse(a.responseText);
  16391. b && b(a)
  16392. }, function(a) {
  16393. c && c(a)
  16394. })
  16395. },
  16396. _makeSQLFilter: function(a, b) {
  16397. if (a && a.length) {
  16398. var c = "",
  16399. b = b || " AND ";
  16400. a.forEach(function(a) {
  16401. a.type && a.type.indexOf(" ") > -1 && (c = c.substr(0, c.length - b.length));
  16402. c += [a.name, " ", a.type || "=", " '", a.value, "'", b].join("")
  16403. });
  16404. return c.substr(0, c.length - b.length).trim()
  16405. } else return ""
  16406. },
  16407. CLASS_NAME: "GeoGlobe.Query.DQSQuery"
  16408. });
  16409. GeoGlobe.Query.TDTCodingQuery = GeoGlobe.Class4OL({
  16410. url: "https://api.tianditu.gov.cn/search",
  16411. token: "e90d56e5a09d1767899ad45846b0cefd",
  16412. queryType: 1,
  16413. start: 0,
  16414. count: 10,
  16415. initialize: function(a) {
  16416. this.token = a || this.token
  16417. },
  16418. query: function(a, b, c) {
  16419. if (!a || !a.keyWord) throw Error("\u67e5\u8be2\u53c2\u6570\u9519\u8bef -- keyWord\u5fc5\u4f20");
  16420. if (!a.mapBound) {
  16421. var d = map.getBounds();
  16422. a.mapBound = d._ne.lng + "," + d._ne.lat + "," + d._sw.lng + "," + d._sw.lat
  16423. }
  16424. if (!a.level) a.level = Math.round(map.getZoom());
  16425. if (!a.queryType) a.queryType = this.queryType;
  16426. if (!a.start) a.start = this.start;
  16427. if (!a.count) a.count = this.count;
  16428. a = {
  16429. postStr: JSON.stringify(a),
  16430. type: "query",
  16431. tk: this.token
  16432. };
  16433. GeoGlobe.Request.GET({
  16434. url: this.url,
  16435. params: a,
  16436. scope: this,
  16437. async: !1,
  16438. noProxy: !0,
  16439. success: function(a) {
  16440. a = this._compositionData(JSON.parse(a.responseText));
  16441. b(a)
  16442. },
  16443. failure: c
  16444. })
  16445. },
  16446. _compositionData: function(a) {
  16447. var b;
  16448. switch (Number(a.resultType)) {
  16449. case 1:
  16450. b = this._compositionDataByPois(a.pois);
  16451. break;
  16452. case 2:
  16453. b = this._compositionDataByStatistics(a.statistics);
  16454. break;
  16455. case 3:
  16456. this._renderCity(a);
  16457. b = a;
  16458. break;
  16459. case 4:
  16460. b =
  16461. a.suggests;
  16462. break;
  16463. case 5:
  16464. b = a;
  16465. break;
  16466. default:
  16467. b = []
  16468. }
  16469. return {
  16470. resultType: a.resultType,
  16471. features: b,
  16472. count: a.count,
  16473. possess: a
  16474. }
  16475. },
  16476. _compositionDataByPois: function(a) {
  16477. try {
  16478. for (var b = [], c = 0; c < a.length; c++) {
  16479. var d = a[c].lonlat.split(" "),
  16480. e = {
  16481. lng: d[0],
  16482. lat: d[1]
  16483. };
  16484. a[c].location = e;
  16485. var f = new GeoGlobe.Geometry.Point(e.lng, e.lat),
  16486. g = new GeoGlobe.Feature(f, a[c]);
  16487. b.push(g)
  16488. }
  16489. return b
  16490. } catch (h) {}
  16491. },
  16492. _compositionDataByStatistics: function(a) {
  16493. try {
  16494. for (var b = {
  16495. allAdmins: [],
  16496. priorityCitys: []
  16497. }, c = 0; c < a.priorityCitys.length; c++) {
  16498. var d = {
  16499. lng: a.priorityCitys[c].lon,
  16500. lat: a.priorityCitys[c].lat
  16501. };
  16502. a.priorityCitys[c].location = d;
  16503. var e = new GeoGlobe.Geometry.Point(d.lng, d.lat),
  16504. f = new GeoGlobe.Feature(e, a.priorityCitys[c]);
  16505. b.priorityCitys.push(f)
  16506. }
  16507. for (c = 0; c < a.allAdmins.length; c++) {
  16508. var g = a.allAdmins[c].childAdmins;
  16509. if (g)
  16510. for (var h = 0; h < g.length; h++) d = {
  16511. lng: g[h].lon,
  16512. lat: g[h].lat
  16513. }, g[h].location = d, e = new GeoGlobe.Geometry.Point(d.lng, d.lat), g[h] = new GeoGlobe.Feature(e, g[h]);
  16514. d = {
  16515. lng: a.allAdmins[c].lon,
  16516. lat: a.allAdmins[c].lat
  16517. };
  16518. a.allAdmins[c].location = d;
  16519. e = new GeoGlobe.Geometry.Point(d.lng,
  16520. d.lat);
  16521. f = new GeoGlobe.Feature(e, a.allAdmins[c]);
  16522. b.allAdmins.push(f)
  16523. }
  16524. return b
  16525. } catch (j) {}
  16526. },
  16527. _renderCity: function(a) {
  16528. var b = GeoGlobe.LngLatBounds.fromString(a.area.bound);
  16529. b.getCenterLonLat();
  16530. b && map.fitBounds(b);
  16531. if (a.area.points[0]) {
  16532. for (var b = a.area.points[0].region.split(","), a = [], c = 0; c < b.length; c++) a.push(b[c].replace(/[ ]/g, ","));
  16533. b = [];
  16534. for (c = 0; c < a.length; c++) b.push([eval(a[c].split(",")[0]), eval(a[c].split(",")[1])]);
  16535. map.addSource("polygon_xzq_query", {
  16536. type: "geojson",
  16537. data: {
  16538. type: "Feature",
  16539. geometry: {
  16540. type: "Polygon",
  16541. coordinates: [b]
  16542. }
  16543. }
  16544. });
  16545. map.addLayer({
  16546. id: "polygon_xzq_query",
  16547. type: "fill",
  16548. source: "polygon_xzq_query",
  16549. layout: {},
  16550. paint: {
  16551. "fill-color": "#022CFF",
  16552. "fill-outline-color": "#0027EB",
  16553. "fill-opacity": 0.2
  16554. }
  16555. })
  16556. }
  16557. },
  16558. CLASS_NAME: "GeoGlobe.Query.TDTCodingQuery"
  16559. });
  16560. GeoGlobe.Query.TDTGeoCoderQuery = GeoGlobe.Class4OL({
  16561. url: "https://api.tianditu.gov.cn/geocoder",
  16562. token: "e90d56e5a09d1767899ad45846b0cefd",
  16563. initialize: function(a) {
  16564. this.token = a || this.token
  16565. },
  16566. dsToLonLatQuery: function(a, b, c) {
  16567. if (!a || !a.keyWord) throw Error("\u67e5\u8be2\u53c2\u6570\u9519\u8bef -- keyWord\u5fc5\u4f20");
  16568. a = {
  16569. ds: JSON.stringify(a),
  16570. tk: this.token
  16571. };
  16572. GeoGlobe.Request.GET({
  16573. url: this.url,
  16574. params: a,
  16575. scope: this,
  16576. async: !1,
  16577. noProxy: !0,
  16578. success: function(a) {
  16579. a = JSON.parse(a.responseText);
  16580. b(a)
  16581. },
  16582. failure: c
  16583. })
  16584. },
  16585. lonLatToDsQuery: function(a,
  16586. b, c) {
  16587. if (!a || !a.lon || !a.lat) throw Error("\u67e5\u8be2\u53c2\u6570\u9519\u8bef -- lon,lat\u5fc5\u4f20");
  16588. a.ver = 1;
  16589. a = {
  16590. postStr: JSON.stringify(a),
  16591. tk: this.token,
  16592. type: "geocode"
  16593. };
  16594. GeoGlobe.Request.GET({
  16595. url: this.url,
  16596. params: a,
  16597. scope: this,
  16598. async: !1,
  16599. noProxy: !0,
  16600. success: function(a) {
  16601. a = JSON.parse(a.responseText);
  16602. b(a)
  16603. },
  16604. failure: c
  16605. })
  16606. },
  16607. CLASS_NAME: "GeoGlobe.Query.TDTGeoCoderQuery"
  16608. });
  16609. GeoGlobe.Query.TDTRouteQuery = GeoGlobe.Class4OL({
  16610. initialize: function(a) {
  16611. this.token = a || "e90d56e5a09d1767899ad45846b0cefd"
  16612. },
  16613. searchByDrive: function(a, b, c) {
  16614. var d = this;
  16615. if (!a.start) throw Error("\u8d77\u70b9\u4e3a\u7a7a");
  16616. if (!a.end) throw Error("\u7ec8\u70b9\u4e3a\u7a7a");
  16617. var e = {
  16618. orig: a.start.join(","),
  16619. dest: a.end.join(","),
  16620. style: a.style || 0
  16621. };
  16622. if (a.mid) e.mid = a.mid.join(";");
  16623. a = {
  16624. postStr: JSON.stringify(e),
  16625. type: "search",
  16626. tk: this.token
  16627. };
  16628. GeoGlobe.loadURL("https://api.tianditu.gov.cn/drive", a, this, function(a) {
  16629. var c = d.parseXML(a.responseText),
  16630. c = c.result,
  16631. e = [];
  16632. c.mid && c.mid.split(";").forEach(function(a) {
  16633. e.push(a.split(","))
  16634. });
  16635. var a = c.routelatlon.split(";"),
  16636. j = [];
  16637. a.pop();
  16638. a.forEach(function(a) {
  16639. j.push(a.split(","))
  16640. });
  16641. var l = [];
  16642. Object.prototype.toString.call(c.simple) == "[object Object]" && c.simple.item.forEach(function(a) {
  16643. var b = a.streetLatLon.split(";"),
  16644. d = [];
  16645. b.pop();
  16646. b.forEach(function(a) {
  16647. d.push(a.split(","))
  16648. });
  16649. var b = {
  16650. type: "Feature",
  16651. geometry: {
  16652. type: "LineString",
  16653. coordinates: d
  16654. },
  16655. properties: a,
  16656. items: []
  16657. },
  16658. e = a.segmentNumber.split("-");
  16659. if (e.length >= 2) {
  16660. a =
  16661. 1 + Number(e[1]);
  16662. for (e = e[0]; e < a; e++) b.items.push(c.routes.item[e])
  16663. } else b.items.push(c.routes.item[e[0]]);
  16664. l.push(b)
  16665. });
  16666. a = {
  16667. startLngLat: c.orig.split(","),
  16668. midLngLat: e,
  16669. endLngLat: c.dest.split(","),
  16670. distance: c.distance,
  16671. times: c.duration,
  16672. mapinfo: {
  16673. center: c.mapinfo.center.split(","),
  16674. zoom: c.mapinfo.scale
  16675. },
  16676. routeLngLat: j,
  16677. geojsonRoute: {
  16678. type: "FeatureCollection",
  16679. features: l
  16680. }
  16681. };
  16682. a = {
  16683. originalData: c,
  16684. processedData: a
  16685. };
  16686. b && b(a)
  16687. }, function(a) {
  16688. c && c(a)
  16689. })
  16690. },
  16691. searchByBus: function(a, b, c) {
  16692. if (!a.start) throw Error("\u8d77\u70b9\u4e3a\u7a7a");
  16693. if (!a.end) throw Error("\u7ec8\u70b9\u4e3a\u7a7a");
  16694. var d = {
  16695. startposition: a.start.join(","),
  16696. endposition: a.end.join(","),
  16697. linetype: a.style || 1
  16698. };
  16699. a.mid && a.mid.join(";");
  16700. a = {
  16701. type: "busline",
  16702. postStr: JSON.stringify(d),
  16703. tk: this.token
  16704. };
  16705. GeoGlobe.loadURL("https://api.tianditu.gov.cn/transit", a, this, function(a) {
  16706. if (b) {
  16707. var a = JSON.parse(a.responseText),
  16708. c = "";
  16709. a.resultCode == 1 ? c = "\u627e\u4e0d\u5230\u8d77\u70b9\u3002" : a.resultCode == 2 ? c = "\u627e\u4e0d\u5230\u7ec8\u70b9\u3002" : a.resultCode == 3 ? c = "\u89c4\u5212\u7ebf\u8def\u5931\u8d25\u3002" :
  16710. a.resultCode == 4 ? c = "\u8d77\u7ec8\u70b9\u8ddd\u79bb200\u7c73\u4ee5\u5185\uff0c\u4e0d\u89c4\u5212\u7ebf\u8def\uff0c\u5efa\u8bae\u6b65\u884c\u3002" : a.resultCode == 5 ? c = "\u8d77\u7ec8\u70b9\u8ddd\u79bb500\u7c73\u5185\uff0c\u8fd4\u56de\u7ebf\u8def\u3002" : a.resultCode == 6 && (c = "\u8f93\u5165\u53c2\u6570\u9519\u8bef\u3002");
  16711. c = {
  16712. resultCode: a.resultCode,
  16713. errorMsg: c,
  16714. data: []
  16715. };
  16716. if (a.resultCode == 0 && a.results.length) {
  16717. var d = [];
  16718. a.results[0].lines.forEach(function(a) {
  16719. var b = a.lineName.split("|");
  16720. b.pop();
  16721. var c = [],
  16722. e = 0,
  16723. f = 0,
  16724. p = 0;
  16725. a.segments.forEach(function(a) {
  16726. var b = a.segmentLine[0],
  16727. d = [];
  16728. b.linePoint.split(";").forEach(function(a) {
  16729. d.push(a.split(","))
  16730. });
  16731. d.pop();
  16732. e += b.segmentTime;
  16733. f += b.segmentDistance;
  16734. a.segmentType == 1 && (p += b.segmentDistance);
  16735. c.push({
  16736. type: "Feature",
  16737. geometry: {
  16738. type: "LineString",
  16739. coordinates: d
  16740. },
  16741. properties: {
  16742. segmentType: a.segmentType,
  16743. stationStart: a.stationStart,
  16744. stationEnd: a.stationEnd,
  16745. SEndTime: b.SEndTime,
  16746. byuuid: b.byuuid,
  16747. segmentTransferTime: b.segmentTransferTime,
  16748. direction: b.direction,
  16749. lineName: b.lineName,
  16750. segmentDistance: b.segmentDistance,
  16751. segmentStationCount: b.segmentStationCount,
  16752. segmentTime: b.segmentTime
  16753. }
  16754. })
  16755. });
  16756. d.push({
  16757. nameArr: b,
  16758. lineItems: {
  16759. type: "FeatureCollection",
  16760. features: c
  16761. },
  16762. allTimes: e,
  16763. walkingDistance: p,
  16764. allDistance: f
  16765. })
  16766. });
  16767. c.data = d
  16768. }
  16769. b({
  16770. originalData: a,
  16771. processedData: c
  16772. })
  16773. }
  16774. }, function(a) {
  16775. c && c(a)
  16776. })
  16777. },
  16778. searchLineOrStation: function(a, b, c) {
  16779. if (!a.uuid) throw Error("uuid\u4e3a\u7a7a");
  16780. a = {
  16781. type: "busline",
  16782. postStr: JSON.stringify({
  16783. uuid: a.uuid
  16784. }),
  16785. tk: this.token
  16786. };
  16787. GeoGlobe.loadURL("https://api.tianditu.gov.cn/transit", a, this, function(a) {
  16788. if (b) {
  16789. var a = JSON.parse(a.responseText),
  16790. c = a.linepoint.split(";"),
  16791. f = [];
  16792. c.pop();
  16793. c.forEach(function(a) {
  16794. f.push(a.split(","))
  16795. });
  16796. a.geojsonLine = {
  16797. type: "FeatureCollection",
  16798. features: [{
  16799. type: "Feature",
  16800. geometry: {
  16801. type: "LineString",
  16802. coordinates: f
  16803. }
  16804. }]
  16805. };
  16806. var g = {
  16807. type: "FeatureCollection",
  16808. features: []
  16809. };
  16810. a.station.forEach(function(a) {
  16811. g.features.push({
  16812. type: "Feature",
  16813. geometry: {
  16814. type: "Point",
  16815. coordinates: a.lonlat.split(",")
  16816. },
  16817. properties: a
  16818. })
  16819. });
  16820. a.geojsonStation = g;
  16821. b(a)
  16822. }
  16823. }, function(a) {
  16824. c && c(a)
  16825. })
  16826. },
  16827. searchBackRoute: function(a, b, c) {
  16828. if (!a.lineUuid) throw Error("lineUuid\u4e3a\u7a7a");
  16829. if (!a.stationUuid) throw Error("stationUuid\u4e3a\u7a7a");
  16830. a = {
  16831. type: "busline",
  16832. postStr: JSON.stringify({
  16833. uuid: a.lineUuid,
  16834. stationUuid: a.stationUuid
  16835. }),
  16836. tk: this.token
  16837. };
  16838. GeoGlobe.loadURL("https://api.tianditu.gov.cn/transit", a, this, function(a) {
  16839. if (b) {
  16840. var a = JSON.parse(a.responseText),
  16841. c = a.linepoint.split(";"),
  16842. f = [];
  16843. c.pop();
  16844. c.forEach(function(a) {
  16845. f.push(a.split(","))
  16846. });
  16847. a.geojsonLine = {
  16848. type: "FeatureCollection",
  16849. features: [{
  16850. type: "Feature",
  16851. geometry: {
  16852. type: "LineString",
  16853. coordinates: f
  16854. }
  16855. }]
  16856. };
  16857. var g = {
  16858. type: "FeatureCollection",
  16859. features: []
  16860. };
  16861. a.station.forEach(function(a) {
  16862. g.features.push({
  16863. type: "Feature",
  16864. geometry: {
  16865. type: "Point",
  16866. coordinates: a.lonlat.split(",")
  16867. },
  16868. properties: a
  16869. })
  16870. });
  16871. a.geojsonStation = g;
  16872. b(a)
  16873. }
  16874. }, function(a) {
  16875. c && c(a)
  16876. })
  16877. },
  16878. parseXML: function(a) {
  16879. var b;
  16880. if (window.DOMParser) {
  16881. b = new DOMParser;
  16882. a = b.parseFromString(a, "application/xml");
  16883. if (!a) return;
  16884. b = a.documentElement
  16885. } else if (window.ActiveXObject) b = new ActiveXObject("Microsoft.XMLDOM"), b.async = !1, b.loadXML(a), b = b.documentElement;
  16886. if (b) return this._parseDOM(b)
  16887. },
  16888. _parseDOM: function(a) {
  16889. if (a) {
  16890. this.__force_array = {};
  16891. if (this.force_array)
  16892. for (var b = 0; b < this.force_array.length; b++) this.__force_array[this.force_array[b]] = 1;
  16893. b = this._parseElement(a);
  16894. this.__force_array[a.nodeName] && (b = [b]);
  16895. if (a.nodeType != 11) {
  16896. var c = {};
  16897. c[a.nodeName] = b;
  16898. b = c
  16899. }
  16900. return b
  16901. }
  16902. },
  16903. _parseElement: function(a) {
  16904. if (a.nodeType != 7) {
  16905. if (a.nodeType == 3 || a.nodeType == 4) {
  16906. if (a.nodeValue.match(/[^\x00-\x20]/) == null) return;
  16907. return a.nodeValue
  16908. }
  16909. var b, c = {};
  16910. if (a.attributes && a.attributes.length) {
  16911. b = {};
  16912. for (var d = 0; d < a.attributes.length; d++) {
  16913. var e = a.attributes[d].nodeName;
  16914. if (typeof e ==
  16915. "string") {
  16916. var f = a.attributes[d].nodeValue;
  16917. f && (typeof c[e] == "undefined" && (c[e] = 0), c[e]++, this._addNode(b, e, c[e], f))
  16918. }
  16919. }
  16920. }
  16921. if (a.childNodes && a.childNodes.length) {
  16922. e = !0;
  16923. b && (e = !1);
  16924. for (d = 0; d < a.childNodes.length && e; d++) f = a.childNodes[d].nodeType, f == 3 || f == 4 || (e = !1);
  16925. if (e) {
  16926. b || (b = "");
  16927. for (d = 0; d < a.childNodes.length; d++) b += a.childNodes[d].nodeValue
  16928. } else {
  16929. b || (b = {});
  16930. for (d = 0; d < a.childNodes.length; d++)
  16931. if (e = a.childNodes[d].nodeName, typeof e == "string" && (f = this._parseElement(a.childNodes[d]))) typeof c[e] == "undefined" && (c[e] =
  16932. 0), c[e]++, this._addNode(b, e, c[e], f)
  16933. }
  16934. }
  16935. return b
  16936. }
  16937. },
  16938. _addNode: function(a, b, c, d) {
  16939. this.__force_array[b] ? (c == 1 && (a[b] = []), a[b][a[b].length] = d) : c == 1 ? a[b] = d : c == 2 ? a[b] = [a[b], d] : a[b][a[b].length] = d
  16940. },
  16941. CLASS_NAME: "GeoGlobe.Query.TDTRouteQuery"
  16942. });
  16943. GeoGlobe.LayerGroup = GeoGlobe.Class4OL({
  16944. map: null,
  16945. initialize: function() {},
  16946. addGroup: function(a, b, c, d) {
  16947. mapboxgl.LayerGroup.addGroup(a, b, c, d)
  16948. },
  16949. addLayerToGroup: function(a, b, c, d) {
  16950. mapboxgl.LayerGroup.addLayerToGroup(a, b, c, d)
  16951. },
  16952. removeLayerFromGroup: function(a, b, c) {
  16953. for (var d = a.getStyle().layers, e = 0; e < d.length; e++) d[e].metadata && d[e].metadata.group === c && d[e].id == b && a.removeLayer(d[e].id)
  16954. },
  16955. removeGroup: function(a, b) {
  16956. mapboxgl.LayerGroup.removeGroup(a, b)
  16957. },
  16958. moveGroup: function(a, b, c) {
  16959. mapboxgl.LayerGroup.moveGroup(a,
  16960. b, c)
  16961. },
  16962. getGroupFirstLayerId: function(a, b) {
  16963. return mapboxgl.LayerGroup.getGroupFirstLayerId(a, b)
  16964. },
  16965. getGroupLastLayerId: function(a, b) {
  16966. return mapboxgl.LayerGroup.getGroupLastLayerId(a, b)
  16967. },
  16968. CLASS_NAME: "GeoGlobe.LayerGroup"
  16969. });
  16970. GeoGlobe.Service = GeoGlobe.Class({
  16971. name: null,
  16972. url: null,
  16973. version: null,
  16974. userid: "test@liferay.com",
  16975. initialize: function(a, b, c) {
  16976. this.name = a;
  16977. this.url = b;
  16978. GeoGlobe.Util.extend(this, c)
  16979. },
  16980. getCapabilities: function() {},
  16981. isExist: function() {},
  16982. failFn: function(a) {
  16983. alert("\u670d\u52a1\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u6216\u8bf7\u6c42\u5730\u5740\u662f\u5426\u6b63\u786e\u3002\n\u8bf7\u6c42\u5730\u5740\uff1a" + this.url + "\n\u64cd\u4f5c\u7c7b\u578b\uff1a" + a)
  16984. },
  16985. _parseToXML: function(a) {
  16986. var b =
  16987. a.responseXML;
  16988. if (!b || !b.documentElement) b = a.responseText;
  16989. return (new GeoGlobe.Format.XML).read(b)
  16990. },
  16991. _checkIsError: function(a) {
  16992. if ((new GeoGlobe.Format.XML).read(a).selectNodes("ServiceExceptionReport").length > 0) return this._parseToJSON(a);
  16993. return null
  16994. },
  16995. _isException: function(a) {
  16996. if (a && a.ServiceExceptionReport) return !0;
  16997. return !1
  16998. },
  16999. _parseToJSON: function(a) {
  17000. return (new GeoGlobe.Util.Format.XML2JSON).read(a)
  17001. },
  17002. xmltoJson: function(a) {
  17003. var b = {};
  17004. if (a.nodeType == 1) {
  17005. if (a.attributes.length > 0) {
  17006. b.attributes = {};
  17007. for (var c =
  17008. 0; c < a.attributes.length; c++) {
  17009. var d = a.attributes.item(c);
  17010. b.attributes[d.nodeName] = d.nodeValue
  17011. }
  17012. }
  17013. } else if (a.nodeType == 3) b = a.nodeValue;
  17014. if (a.hasChildNodes())
  17015. for (c = 0; c < a.childNodes.length; c++) {
  17016. var d = a.childNodes.item(c),
  17017. e = d.nodeName.replace("ows:", ""),
  17018. e = e.replace("#", "");
  17019. if (typeof b[e] == "undefined") b[e] = this.xmltoJson(d);
  17020. else {
  17021. if (typeof b[e].push == "undefined") {
  17022. var f = b[e];
  17023. b[e] = [];
  17024. b[e].push(f)
  17025. }
  17026. b[e].push(this.xmltoJson(d))
  17027. }
  17028. }
  17029. return b
  17030. },
  17031. CLASS_NAME: "GeoGlobe.Service"
  17032. });
  17033. GeoGlobe.Service.WFST = GeoGlobe.Class4OL(GeoGlobe.Service, {
  17034. xy: !0,
  17035. initialize: function() {
  17036. GeoGlobe.Service.prototype.initialize.apply(this, arguments)
  17037. },
  17038. getCapabilities: function(a, b) {
  17039. var c = this.url,
  17040. d = {
  17041. REQUEST: "GetCapabilities",
  17042. SERVICE: "WFS",
  17043. VERSION: "1.0.0"
  17044. };
  17045. b || (b = function() {
  17046. this.failFn(d.REQUEST)
  17047. });
  17048. GeoGlobe.loadURL(c, d, this, function(b) {
  17049. a(b)
  17050. }, b)
  17051. },
  17052. isExist: function() {
  17053. var a = !1;
  17054. GeoGlobe.Request.GET({
  17055. url: this.url,
  17056. params: {
  17057. REQUEST: "GetCapabilities",
  17058. SERVICE: "WFS"
  17059. },
  17060. scope: this,
  17061. async: !1,
  17062. success: function() {
  17063. a = !0
  17064. }
  17065. });
  17066. return a
  17067. },
  17068. describeFeatureType: function(a, b, c) {
  17069. var d = this.url;
  17070. GeoGlobe.Util.applyDefaults(a, {
  17071. SERVICE: "WFS",
  17072. VERSION: "1.0.0",
  17073. REQUEST: "DescribeFeatureType"
  17074. });
  17075. c || (c = function() {
  17076. this.failFn(a.REQUEST)
  17077. });
  17078. GeoGlobe.loadURL(d, a, this, function(a) {
  17079. b(a)
  17080. }, c)
  17081. },
  17082. getFeature: function(a, b, c) {
  17083. var d = this.url;
  17084. GeoGlobe.Util.applyDefaults(a, {
  17085. SERVICE: "WFS",
  17086. VERSION: "1.0.0",
  17087. REQUEST: "GetFeature"
  17088. });
  17089. c || (c = function() {
  17090. this.failFn(a.REQUEST)
  17091. });
  17092. GeoGlobe.loadURL(d, a, this, function(a) {
  17093. b(a)
  17094. }, c)
  17095. },
  17096. lockFeature: function(a, b, c) {
  17097. GeoGlobe.Util.applyDefaults(a, {
  17098. service: "WFS",
  17099. version: "1.0.0",
  17100. request: "LockFeature",
  17101. expiry: 1,
  17102. lockAction: "ALL"
  17103. });
  17104. var d = this._parserFilterToString(a.filter),
  17105. d = GeoGlobe.String.format('<?xml version="1.0" encoding="UTF-8"?><LockFeature version="${version}" service="${service}" lockAction="${lockAction}" expiry="${expiry}" xmlns:wfs=" http://www.opengis.net/wfs" xmlns:gml=" http://www.opengis.net/gml" xmlns:myns=" http://www.someserver.com/myns" xmlns:ogc=" http://www.opengis.net/ogc" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs ../wfs/1.1.0/WFS.xsd"><Lock typeName="${typeName}">${filterXMLString}</Lock></LockFeature>', {
  17106. version: a.version,
  17107. service: a.service,
  17108. lockAction: a.lockAction,
  17109. expiry: a.expiry,
  17110. typeName: a.typeName,
  17111. filterXMLString: d
  17112. });
  17113. c || (c = function() {
  17114. this.failFn(a.request)
  17115. });
  17116. new GeoGlobe.Request.POST({
  17117. url: this.url,
  17118. data: d,
  17119. scope: this,
  17120. success: b,
  17121. failure: c
  17122. })
  17123. },
  17124. transaction: function(a, b, c, d, e, f) {
  17125. var g = this.url;
  17126. GeoGlobe.Util.applyDefaults(a, {
  17127. service: "WFS",
  17128. version: "1.0.0",
  17129. request: "Transaction",
  17130. releaseAction: "ALL"
  17131. });
  17132. var h = a.lockId,
  17133. j = "";
  17134. h && (j += "<LockId>" + h + "</LockId>");
  17135. h = "";
  17136. b && (h += this._getInsertString(b));
  17137. c && (h += this._getUpdateString(c));
  17138. d && (h += this._getDeleteString(d));
  17139. b = GeoGlobe.String.format('<?xml version="1.0" encoding="UTF-8"?><wfs:Transaction releaseAction="${releaseAction}" handle="Transaction 01" version="${version}" service="${service}" xmlns="http://www.someserver.com/myns" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">${lockIdString}${transactionString}</wfs:Transaction>', {
  17140. releaseAction: a.releaseAction,
  17141. version: a.version,
  17142. service: a.service,
  17143. lockIdString: j,
  17144. transactionString: h
  17145. });
  17146. f || (f = function() {
  17147. this.failFn(a.request)
  17148. });
  17149. new GeoGlobe.Request.POST({
  17150. url: g,
  17151. data: b,
  17152. scope: this,
  17153. success: e,
  17154. failure: f
  17155. })
  17156. },
  17157. parseTransactionResult: function(a) {
  17158. var b = (new GeoGlobe.Format.XML2JSON).read(a.responseText),
  17159. a = [],
  17160. c = this._objToArray(b.wfs_WFS_TransactionResponse.wfs_TransactionResult.wfs_Status),
  17161. b = this._objToArray(b.wfs_WFS_TransactionResponse.wfs_InsertResults);
  17162. if (!c) return a;
  17163. for (var d = 0; d < c.length; d++) c[d].wfs_SUCCESS !== void 0 ?
  17164. a.push({
  17165. status: "SUCCESS",
  17166. fid: b && b[d] ? b[d].ogc_FeatureId.fid : null
  17167. }) : a.push({
  17168. status: "FAILED",
  17169. fid: null
  17170. });
  17171. return a
  17172. },
  17173. _objToArray: function(a) {
  17174. a && !(a instanceof Array) && (a = [a]);
  17175. return a
  17176. },
  17177. _getInsertString: function(a) {
  17178. for (var b = a.features, a = a.typeName, c = "", d = 0; d < b.length; d++) c += '<wfs:Insert handle="Insert ' + d + '">' + this._getInsertFeatureString(b[d], a) + "</wfs:Insert>";
  17179. return c
  17180. },
  17181. _getInsertFeatureString: function(a, b) {
  17182. var c = "",
  17183. d;
  17184. for (d in a.attributes) d != "OID" && (c += GeoGlobe.String.format("<${tag}><![CDATA[${value}]]\></${tag}>", {
  17185. value: a.attributes[d] ? a.attributes[d] : "",
  17186. tag: d
  17187. }));
  17188. c += GeoGlobe.String.format("<GEOMETRY>${geometry}</GEOMETRY>", {
  17189. geometry: this._getGeometryStringByFeature(a)
  17190. });
  17191. return c = GeoGlobe.String.format("<${typeName}>${content}</${typeName}>", {
  17192. typeName: b,
  17193. content: c
  17194. })
  17195. },
  17196. _getUpdateString: function(a) {
  17197. for (var b = a.typeName, a = a.features, c = "", d = 0; d < a.length; d++)
  17198. if (a[d].geometry) {
  17199. var e = this._getUpdatePropertyString(a[d]),
  17200. f = this._parserFilterToString(new GeoGlobe.Filter.FeatureId({
  17201. fids: [b + "." + a[d].attributes.OID]
  17202. }));
  17203. c +=
  17204. '<wfs:Update typeName="' + b + '" handle="Update ' + d + '">' + e + f + "</wfs:Update>"
  17205. }
  17206. return c
  17207. },
  17208. _getUpdatePropertyString: function(a) {
  17209. var b = "",
  17210. c;
  17211. for (c in a.data) c != "OID" && a.data[c] && (b += "<wfs:Property><wfs:Name><![CDATA[" + c + "]]\></wfs:Name><wfs:Value><![CDATA[" + (a.data[c] ? a.data[c] : "") + "]]\></wfs:Value></wfs:Property>");
  17212. b += "<wfs:Property><wfs:Name>Geometry</wfs:Name><wfs:Value>" + this._getGeometryStringByFeature(a) + "</wfs:Value></wfs:Property>";
  17213. return b
  17214. },
  17215. _getGeometryStringByFeature: function(a) {
  17216. var b = new GeoGlobe.Format.GML({
  17217. xy: this.xy
  17218. });
  17219. b.buildCoordinatesNode = GeoGlobe.Function.bind(function(a) {
  17220. var b = this.createElementNS(this.gmlns, "gml:coordinates");
  17221. b.setAttribute("decimal", ".");
  17222. b.setAttribute("cs", ",");
  17223. b.setAttribute("ts", " ");
  17224. var e = [];
  17225. if (a instanceof GeoGlobe.LngLatBounds) this.xy ? (e.push(a.left + "," + a.bottom), e.push(a.right + "," + a.top)) : (e.push(a.bottom + "," + a.left), e.push(a.top + "," + a.right));
  17226. else
  17227. for (var a = a.components ? a.components : [a], f = 0; f < a.length; f++) this.xy ? e.push(a[f].x + "," + a[f].y) : e.push(a[f].y + "," + a[f].x);
  17228. e = this.createTextNode(e.join(" "));
  17229. b.appendChild(e);
  17230. return b
  17231. }, b);
  17232. a = b.buildGeometryNode(a.geometry);
  17233. return (new GeoGlobe.Format.XML).write(a)
  17234. },
  17235. _getDeleteString: function(a) {
  17236. for (var b = a.filter, a = a.typeName, c = "", d = 0; d < b.fids.length; d++) {
  17237. c += '<wfs:Delete typeName="' + a + '" handle="Delete ' + d + '">';
  17238. var e = new GeoGlobe.Filter.FeatureId({
  17239. fids: [b.fids[d]]
  17240. });
  17241. c += this._parserFilterToString(e);
  17242. c += "</wfs:Delete>"
  17243. }
  17244. return c
  17245. },
  17246. _parserFilterToString: function(a) {
  17247. var b = "";
  17248. a && (a = (new GeoGlobe.Format.Filter.v1).write(a), b = (new GeoGlobe.Format.XML).write(a));
  17249. return b
  17250. },
  17251. CLASS_NAME: "GeoGlobe.Service.WFST"
  17252. });
  17253. GeoGlobe.Service.CTS = GeoGlobe.Class4OL(GeoGlobe.Service, {
  17254. initialize: function() {
  17255. GeoGlobe.Service.prototype.initialize.apply(this, arguments)
  17256. },
  17257. getCapabilities: function(a, b) {
  17258. var c = this.url,
  17259. d = {
  17260. REQUEST: "GetCapabilities",
  17261. SERVICE: "CTS"
  17262. };
  17263. b || (b = function() {
  17264. this.failFn(d.REQUEST)
  17265. });
  17266. GeoGlobe.loadURL(c, d, this, function(b) {
  17267. a(b)
  17268. }, b)
  17269. },
  17270. isExist: function() {
  17271. var a = !1;
  17272. GeoGlobe.Request.GET({
  17273. url: this.url,
  17274. params: {
  17275. REQUEST: "GetCapabilities",
  17276. SERVICE: "CTS"
  17277. },
  17278. scope: this,
  17279. async: !1,
  17280. success: function() {
  17281. a = !0
  17282. }
  17283. });
  17284. return a
  17285. },
  17286. TransCoords: function(a,
  17287. b, c) {
  17288. var d = this.url;
  17289. GeoGlobe.Util.applyDefaults(a, {
  17290. SERVICE: "CTS",
  17291. REQUEST: "TransCoords"
  17292. });
  17293. c || (c = function() {
  17294. this.failFn(a.REQUEST)
  17295. });
  17296. GeoGlobe.loadURL(d, a, this, function(c) {
  17297. if (a.FORMAT == "xml") {
  17298. var d = {},
  17299. c = this.xmltoJson(c.responseXML);
  17300. d.attributes = c.CTS_TransResult["cts:Coordinate"].attributes.dim;
  17301. for (var c = c.CTS_TransResult["cts:Coordinate"].text.split(","), g = [], h = 0; h < c.length; h++) g.push(c[h]);
  17302. d.coordvalue = g
  17303. } else if (a.FORMAT == "json") d = {}, c = c.responseText, c = (new GeoGlobe.Format.JSON).read(c), d.attributes =
  17304. c.CTS_TransResult.dim, d.coordvalue = c.CTS_TransResult.Coordinate;
  17305. b(d)
  17306. }, c)
  17307. },
  17308. AffineTransform: function(a, b, c) {
  17309. var d = this.url;
  17310. GeoGlobe.Util.applyDefaults(a, {
  17311. SERVICE: "CTS",
  17312. REQUEST: "AffineTransform"
  17313. });
  17314. c || (c = function() {
  17315. this.failFn(a.REQUEST)
  17316. });
  17317. GeoGlobe.loadURL(d, a, this, function(c) {
  17318. if (a.FORMAT == "xml") {
  17319. var d = {},
  17320. c = this.xmltoJson(c.responseXML);
  17321. d.attributes = c.CTS_AffineTransResult["cts:Coordinate"].attributes.dim;
  17322. for (var c = c.CTS_AffineTransResult["cts:Coordinate"].text.split(","), g = [], h = 0; h < c.length; h++) g.push(c[h]);
  17323. d.coordvalue = g
  17324. } else if (a.FORMAT == "json") d = {}, c = c.responseText, c = (new GeoGlobe.Format.JSON).read(c), d.attributes = c.CTS_AffineTransResult.dim, d.coordvalue = c.CTS_AffineTransResult.Coordinate;
  17325. b(d)
  17326. }, c)
  17327. },
  17328. CLASS_NAME: "GeoGlobe.Service.CTS"
  17329. });
  17330. GeoGlobe.Service.VTS = GeoGlobe.Class4OL(GeoGlobe.Service, {
  17331. initialize: function() {
  17332. GeoGlobe.Service.prototype.initialize.apply(this, arguments)
  17333. },
  17334. getCapabilities: function(a, b) {
  17335. var c = this.url,
  17336. d = {
  17337. REQUEST: "GetCapabilities",
  17338. SERVICE: "WMTS",
  17339. VERSION: "1.0.0"
  17340. };
  17341. b || (b = function() {
  17342. this.failFn(d.REQUEST)
  17343. });
  17344. GeoGlobe.loadURL(c, d, this, function(b) {
  17345. var b = this.xmlToJson(b.responseXML),
  17346. c = [],
  17347. d, h = [],
  17348. b = b.Capabilities;
  17349. if (b.Contents.Layer.length)
  17350. for (var j = 0; j < b.Contents.Layer.length; j++) h.push(b.Contents.Layer[j]);
  17351. else h.push(b.Contents.Layer);
  17352. for (var l = 0; l < h.length; l++) {
  17353. d = {};
  17354. d.version = b.attributes.version;
  17355. d.format = h[l].Format[4].text;
  17356. d.LayerIdentifier = h[l].Identifier.text;
  17357. d.StyleIdentifier = h[l].Style.Identifier.text;
  17358. d.MatrixSet = h[l].TileMatrixSetLink[0].TileMatrixSet.text;
  17359. if (h[l].BoundingBox) d.Bounding = h[l].BoundingBox;
  17360. for (var m = "", j = 0; j < b.Contents.TileMatrixSet.length; j++)
  17361. if (b.Contents.TileMatrixSet[j].Identifier.text == d.MatrixSet) var n = b.Contents.TileMatrixSet[j];
  17362. d.mapCRS = n.SupportedCRS.text;
  17363. var p = n.TileMatrix[0];
  17364. d.initZoom = p.Identifier.text;
  17365. if (p.length > 0) {
  17366. for (var j = 0, q = p.length; j < q; j++) {
  17367. if (j == q) break;
  17368. m += p[j].ScaleDenominator.text + ","
  17369. }
  17370. d.Scales = m.substr(0, m.length - 1);
  17371. d.zoomOffset = p[0].Identifier.text
  17372. } else if (p) m += p.ScaleDenominator.text + ",", d.Scales = m.substr(0, m.length - 1), d.zoomOffset = p.Identifier.text;
  17373. c[l] = d
  17374. }
  17375. a(c, b)
  17376. }, b)
  17377. },
  17378. GetTile: function(a) {
  17379. var b = {
  17380. REQUEST: "GetTile",
  17381. SERVICE: "WMTS",
  17382. VERSION: "1.0.0"
  17383. };
  17384. if (a.layer) b.LAYER = a.layer;
  17385. if (a.format) b.FORMAT = a.format;
  17386. if (a.tileMatrixSet) b.TILEMATRIXSET = a.tileMatrixSet;
  17387. if (a.width) b.WIDTH = a.width;
  17388. if (a.height) b.HEIGHT =
  17389. a.height;
  17390. if (a.TILEMATRIX) b.TILEMATRIX = a.TILEMATRIX;
  17391. if (a.TILEROW) b.TILEROW = a.TILEROW;
  17392. if (a.TILECOL) b.TILECOL = a.TILECOL;
  17393. a = {};
  17394. a.url = this.url;
  17395. a.param = b;
  17396. return GeoGlobe.Util.urlAppend(a.url, GeoGlobe.Util.getParameterString(a.param || {}))
  17397. },
  17398. GetStyleName: function(a, b) {
  17399. var c = this.url,
  17400. d = {
  17401. REQUEST: "GetStyle",
  17402. SERVICE: "WMTS",
  17403. VERSION: "1.0.0"
  17404. };
  17405. b || (b = function() {
  17406. this.failFn(d.REQUEST)
  17407. });
  17408. GeoGlobe.Request.GET({
  17409. url: c,
  17410. params: d,
  17411. scope: this,
  17412. async: this.async,
  17413. success: function(c) {
  17414. c = c.responseText;
  17415. if (!c) return b(), !1;
  17416. var c = (new GeoGlobe.Format.JSON).read(c),
  17417. d = [];
  17418. if (c.style)
  17419. for (var g = 0; g < c.style.length; g++) d.push(c.style[g].styleName);
  17420. else if (c.styleName)
  17421. for (g = 0; g < c.styleName.length; g++) d.push(c.styleName[g]);
  17422. a(d)
  17423. },
  17424. failure: b
  17425. })
  17426. },
  17427. GetStyle: function(a, b, c) {
  17428. var d = this.url;
  17429. if (a == "" || a == void 0) alert("\u8bf7\u67e5\u770b\u6837\u5f0f\u540d\u79f0\u662f\u5426\u5b58\u5728");
  17430. else {
  17431. var e = {
  17432. REQUEST: "GetStyle",
  17433. SERVICE: "WMTS",
  17434. VERSION: "1.0.0",
  17435. STYLENAME: a
  17436. };
  17437. c || (c = function() {
  17438. this.failFn(e.REQUEST)
  17439. });
  17440. GeoGlobe.Request.GET({
  17441. url: d,
  17442. params: e,
  17443. scope: this,
  17444. async: this.async,
  17445. success: function(a) {
  17446. a =
  17447. a.responseText;
  17448. if (!a) return c(), !1;
  17449. a = (new GeoGlobe.Format.JSON).read(a);
  17450. b(a)
  17451. },
  17452. failure: c
  17453. })
  17454. }
  17455. },
  17456. isExist: function() {
  17457. var a = !1;
  17458. GeoGlobe.Request.GET({
  17459. url: this.url,
  17460. params: {
  17461. REQUEST: "GetCapabilities",
  17462. SERVICE: "WFS"
  17463. },
  17464. scope: this,
  17465. async: !1,
  17466. success: function() {
  17467. a = !0
  17468. }
  17469. });
  17470. return a
  17471. },
  17472. CLASS_NAME: "GeoGlobe.Service.VTS"
  17473. });
  17474. GeoGlobe.Service.WMS = GeoGlobe.Class4OL(GeoGlobe.Service, {
  17475. initialize: function() {
  17476. GeoGlobe.Service.prototype.initialize.apply(this, arguments)
  17477. },
  17478. getCapabilities: function(a, b) {
  17479. var c = this.url,
  17480. d = {
  17481. REQUEST: "GetCapabilities",
  17482. SERVICE: "WMS"
  17483. };
  17484. b || (b = function() {
  17485. this.failFn(d.REQUEST)
  17486. });
  17487. GeoGlobe.loadURL(c, d, this, function(b) {
  17488. var b = this.xmlToJson(b.responseXML),
  17489. c = {},
  17490. d = b.WMT_MS_Capabilities,
  17491. h = d.Capability.Layer.Layer,
  17492. j = d.Capability.Request,
  17493. h = h.length ? h[0] : h;
  17494. c.version = d.attributes.version;
  17495. c.format = j.GetMap.Format[1].text;
  17496. c.layer = h.Title.text;
  17497. c.bbox = h.BoundingBox.attributes.SRS;
  17498. c.maxExtent = d.Capability.Layer.LatLonBoundingBox.attributes;
  17499. a(c, b)
  17500. }, b)
  17501. },
  17502. isExist: function() {
  17503. var a = !1;
  17504. GeoGlobe.Request.GET({
  17505. url: this.url,
  17506. params: {
  17507. REQUEST: "GetCapabilities",
  17508. SERVICE: "WMS"
  17509. },
  17510. scope: this,
  17511. async: !1,
  17512. success: function() {
  17513. a = !0
  17514. }
  17515. });
  17516. return a
  17517. },
  17518. getMap: function(a) {
  17519. var b = this.url,
  17520. b = {};
  17521. if (a.layers) b.LAYERS = a.layers;
  17522. if (a.format) b.FORMAT = a.format;
  17523. if (a.bbox) b.BBOX = "{bbox-epsg-3857}";
  17524. if (a.width) b.WIDTH = a.width;
  17525. if (a.height) b.HEIGHT = a.height;
  17526. if (a.version) b.VERSION =
  17527. a.version;
  17528. if (a.SRS) b.SRS = a.SRS;
  17529. GeoGlobe.Util.applyDefaults(b, {
  17530. service: "WMS",
  17531. request: "GetMap",
  17532. TRANSPARENT: !0
  17533. });
  17534. return b = GeoGlobe.Util.urlAppend(this.url, GeoGlobe.Util.getParameterString(b || {}))
  17535. },
  17536. CLASS_NAME: "GeoGlobe.Service.WMS"
  17537. });
  17538. GeoGlobe.Service.WMTS = GeoGlobe.Class4OL(GeoGlobe.Service, {
  17539. initialize: function() {
  17540. GeoGlobe.Service.prototype.initialize.apply(this, arguments)
  17541. },
  17542. getCapabilities: function(a, b) {
  17543. var c = this.url,
  17544. d = {
  17545. REQUEST: "GetCapabilities",
  17546. SERVICE: "WMTS"
  17547. };
  17548. b || (b = function() {
  17549. this.failFn(d.REQUEST)
  17550. });
  17551. GeoGlobe.loadURL(c, d, this, function(b) {
  17552. var b = this.xmlToJson(b.responseXML),
  17553. c = b.Capabilities,
  17554. d = {},
  17555. h = c.Contents.Layer;
  17556. h.length && (h = h[0]);
  17557. d.version = c.attributes.version;
  17558. c = c.Contents;
  17559. d.layer = h.Title.text;
  17560. d.LayerIdentifier = h.Identifier.text;
  17561. d.StyleIdentifier = h.Style.Identifier.text;
  17562. d.MatrixSet = h.TileMatrixSetLink[0].TileMatrixSet.text;
  17563. d.Format = h.Format[1].text;
  17564. d.Bounding = h.BoundingBox;
  17565. h = "";
  17566. c = c.TileMatrixSet[0].TileMatrix;
  17567. if (c.length > 0)
  17568. for (var j = 0, l = c.length; j < l; j++) {
  17569. if (j == l) break;
  17570. h += c[j].ScaleDenominator.text + ","
  17571. }
  17572. d.Scales = h.substr(0, h.length - 1);
  17573. d.zoomOffset = c[0].Identifier.text;
  17574. a(d, b)
  17575. }, b)
  17576. },
  17577. isExist: function() {
  17578. var a = !1;
  17579. GeoGlobe.Request.GET({
  17580. url: this.url,
  17581. params: {
  17582. REQUEST: "GetCapabilities",
  17583. SERVICE: "WMTS"
  17584. },
  17585. scope: this,
  17586. async: !1,
  17587. success: function() {
  17588. a = !0
  17589. }
  17590. });
  17591. return a
  17592. },
  17593. getTile: function(a) {
  17594. var b = {};
  17595. if (a.layer) b.LAYER = a.layer;
  17596. if (a.format) b.FORMAT = a.format;
  17597. if (a.tileMatrixSet) b.TILEMATRIXSET = a.tileMatrixSet;
  17598. if (a.TILEMATRIX) b.TILEMATRIX = a.TILEMATRIX;
  17599. if (a.TILEROW) b.TILEROW = a.TILEROW;
  17600. if (a.TILECOL) b.TILECOL = a.TILECOL;
  17601. if (a.version) b.VERSION = a.version;
  17602. if (a.style) b.STYLE = a.style;
  17603. GeoGlobe.Util.applyDefaults(b, {
  17604. service: "WMTS",
  17605. request: "GetTile"
  17606. });
  17607. return GeoGlobe.Util.urlAppend(this.url, GeoGlobe.Util.getParameterString(b || {}))
  17608. },
  17609. getCapabilitiesForRest: function(a,
  17610. b) {
  17611. var c = this.url;
  17612. c.match(/\/$/) || (c += "/");
  17613. c += "1.0.0/WMTSCapabilities.xml";
  17614. b || (b = function() {
  17615. this.failFn("GetCapabilities")
  17616. });
  17617. GeoGlobe.loadURL(c, null, this, function(b) {
  17618. a(b)
  17619. }, b)
  17620. },
  17621. getTileForRest: function(a) {
  17622. var b = a.layer,
  17623. c = a.style,
  17624. d = a.tileMatrixSet,
  17625. e = a.tileMatrix,
  17626. f = a.tileRow,
  17627. g = a.tileCol,
  17628. h = null,
  17629. a = a.format ? a.format : "image/png",
  17630. j = {
  17631. "image/png": "png",
  17632. "image/png8": "png",
  17633. "image/png24": "png",
  17634. "image/png32": "png",
  17635. png: "png",
  17636. "image/jpeg": "jpg",
  17637. "image/jpg": "jpg",
  17638. jpeg: "jpg",
  17639. jpg: "jpg"
  17640. };
  17641. h || (h = j[a] || a.split("/").pop());
  17642. b = b + "/" + c + "/" + d + "/" + e + "/" + f + "/" + g + "." + h;
  17643. c = this.url;
  17644. c.match(/\/$/) || (c += "/");
  17645. c += b;
  17646. return c
  17647. },
  17648. CLASS_NAME: "GeoGlobe.Service.WMTS"
  17649. });
  17650. GeoGlobe.Service.DTJ = GeoGlobe.Class4OL(GeoGlobe.Service, {
  17651. initialize: function() {
  17652. GeoGlobe.Service.prototype.initialize.apply(this, arguments)
  17653. },
  17654. getCapabilities: function(a, b) {
  17655. var c = this.url,
  17656. d = {
  17657. REQUEST: "GetCapabilities",
  17658. SERVICE: "WMS"
  17659. };
  17660. b || (b = function() {
  17661. this.failFn(d.REQUEST)
  17662. });
  17663. GeoGlobe.loadURL(c, d, this, function(b) {
  17664. b = this.xmlToJson(b.responseXML);
  17665. a(b)
  17666. }, b)
  17667. },
  17668. getMap: function(a) {
  17669. var b = {};
  17670. if (a.layers) b.LAYERS = a.layers;
  17671. if (a.format) b.FORMAT = a.format;
  17672. if (a.bbox) b.BBOX = "{bbox-epsg-3857}";
  17673. if (a.width) b.WIDTH = a.width;
  17674. if (a.height) b.HEIGHT = a.height;
  17675. if (a.interval) b.INTERVAL = a.interval;
  17676. if (a.GRADSIZE) b.GRADSIZE = a.GRADSIZE;
  17677. if (a.simplitymethod) b.SIMPLIFYMETHOD = a.simplitymethod;
  17678. if (a.intervalcolor) b.INTERVALCOLOR = a.intervalcolor;
  17679. if (a.SIMPLIFYSIZE) b.SIMPLIFYSIZE = a.SIMPLIFYSIZE;
  17680. if (a.INTERPOLAION) b.INTERPOLATIONMETHOD = a.INTERPOLAION;
  17681. if (a.RADIUS) b.RADIUS = a.RADIUS;
  17682. GeoGlobe.Util.applyDefaults(b, {
  17683. request: "GetMap",
  17684. service: "WMS",
  17685. version: "1.1.1"
  17686. });
  17687. return GeoGlobe.Util.urlAppend(this.url, GeoGlobe.Util.getParameterString(b || {}))
  17688. },
  17689. getStatisticInfo: function(a, b, c) {
  17690. var d = {};
  17691. if (a.layers) d.LAYERNAME = a.layers;
  17692. if (a.lnglat) d.X = a.lnglat.lng, d.Y = a.lnglat.lat;
  17693. if (a.simplitymethod) d.SIMPLIFYMETHOD = a.simplitymethod;
  17694. if (a.INTERPOLATIONMETHOD) d.INTERPOLATIONMETHOD = a.INTERPOLATIONMETHOD;
  17695. if (a.SIMPLIFYSIZE) d.SIMPLIFYSIZE = a.SIMPLIFYSIZE;
  17696. if (a.INTERPOLAION) d.INTERPOLAION = a.INTERPOLAION;
  17697. if (a.RADIUS) d.RADIUS = a.RADIUS;
  17698. GeoGlobe.Util.applyDefaults(d, {
  17699. request: "GetStatisticalValue",
  17700. service: "WMS",
  17701. version: "1.1.1"
  17702. });
  17703. a = GeoGlobe.Util.urlAppend(this.url, GeoGlobe.Util.getParameterString(d || {}));
  17704. GeoGlobe.loadURL(a, d, this, function(a) {
  17705. a = this.xmlToJson(a.responseXML);
  17706. a.FeatureCollection.featureMember && b(a.FeatureCollection.featureMember)
  17707. }, c)
  17708. },
  17709. getParams: function(a) {
  17710. var b = {
  17711. request: "GetMap",
  17712. service: "WMS",
  17713. version: "1.1.1"
  17714. };
  17715. GeoGlobe.Util.extend(b, a);
  17716. return b
  17717. },
  17718. CLASS_NAME: "GeoGlobe.Service.DTJ"
  17719. });
  17720. GeoGlobe.Service.Fonts = GeoGlobe.Class4OL(GeoGlobe.Service, {
  17721. initialize: function() {
  17722. GeoGlobe.Service.prototype.initialize.apply(this, arguments)
  17723. },
  17724. getCapabilities: function(a, b) {
  17725. var c = this.url,
  17726. d = {
  17727. REQUEST: "GetCapabilities",
  17728. SERVICE: "FLS",
  17729. VERSION: "1.0"
  17730. };
  17731. b || (b = function() {
  17732. this.failFn(d.REQUEST)
  17733. });
  17734. GeoGlobe.loadURL(c, d, this, function(b) {
  17735. var b = b.responseText,
  17736. c = new GeoGlobe.Format.JSON,
  17737. b = b ? c.read(b) : {};
  17738. a(b)
  17739. }, b)
  17740. },
  17741. isExist: function() {
  17742. var a = !1;
  17743. GeoGlobe.Request.GET({
  17744. url: this.url,
  17745. params: {
  17746. REQUEST: "GetCapabilities",
  17747. SERVICE: "FLS"
  17748. },
  17749. scope: this,
  17750. async: !1,
  17751. success: function() {
  17752. a = !0
  17753. }
  17754. });
  17755. return a
  17756. },
  17757. GetFont: function(a, b) {
  17758. var c = {
  17759. REQUEST: "GetFont",
  17760. SERVICE: "FLS",
  17761. VERSION: "1.0"
  17762. };
  17763. b || (b = function() {
  17764. this.failFn(c.REQUEST)
  17765. })
  17766. },
  17767. CLASS_NAME: "GeoGlobe.Service.Fonts"
  17768. });
  17769. GeoGlobe.Service.RTDS = GeoGlobe.Class4OL(GeoGlobe.Service, {
  17770. service: "RTDS",
  17771. version: "1.0.0",
  17772. format: "json",
  17773. callback: "",
  17774. initialize: function(a, b, c) {
  17775. GeoGlobe.Service.prototype.initialize.apply(this, arguments);
  17776. GeoGlobe.Util.extend(this, c)
  17777. },
  17778. getCapabilities: function(a, b) {
  17779. var c = this;
  17780. GeoGlobe.Request.GET({
  17781. url: this.url,
  17782. params: {
  17783. SERVICE: this.service,
  17784. VERSION: this.version,
  17785. REQUEST: "GetCapabilities",
  17786. FORMAT: this.format,
  17787. CALLBACK: this.callback
  17788. },
  17789. scope: this,
  17790. async: this.async,
  17791. success: function(d) {
  17792. var e = {};
  17793. try {
  17794. e = JSON.parse(d.responseText)
  17795. } catch (f) {
  17796. console.error("RTDS GetCapabilities Error : " +
  17797. d.responseText);
  17798. b(d.responseText);
  17799. return
  17800. }
  17801. a(e, c)
  17802. },
  17803. failure: b
  17804. });
  17805. return this
  17806. },
  17807. describeFeatureDataSet: function(a, b, c) {
  17808. var d = this;
  17809. GeoGlobe.Request.GET({
  17810. url: this.url,
  17811. params: {
  17812. SERVICE: this.service,
  17813. VERSION: this.version,
  17814. REQUEST: "DescribeFeatureDataSet",
  17815. FORMAT: this.format,
  17816. CALLBACK: this.callback,
  17817. OBSOBJSETNAME: a
  17818. },
  17819. scope: this,
  17820. async: this.async,
  17821. success: function(a) {
  17822. var f = {};
  17823. try {
  17824. f = JSON.parse(a.responseText)
  17825. } catch (g) {
  17826. console.error("RTDS DescribeFeatureDataSet Error : " + a.responseText);
  17827. c(a.responseText);
  17828. return
  17829. }
  17830. b(f, d)
  17831. },
  17832. failure: c
  17833. });
  17834. return this
  17835. },
  17836. describeObservationDataSet: function(a, b, c) {
  17837. var d = this;
  17838. GeoGlobe.Request.GET({
  17839. url: this.url,
  17840. params: {
  17841. SERVICE: this.service,
  17842. VERSION: this.version,
  17843. REQUEST: "DescribeObservationDataSet",
  17844. FORMAT: this.format,
  17845. CALLBACK: this.callback,
  17846. DATASETNAME: a
  17847. },
  17848. scope: this,
  17849. async: this.async,
  17850. success: function(a) {
  17851. var f = {};
  17852. try {
  17853. f = JSON.parse(a.responseText)
  17854. } catch (g) {
  17855. console.error("RTDS DescribeObservationDataSet Error : " + a.responseText);
  17856. c(a.responseText);
  17857. return
  17858. }
  17859. b(f, d)
  17860. },
  17861. failure: c
  17862. });
  17863. return this
  17864. },
  17865. queryFeature: function(a,
  17866. b, c) {
  17867. var d = {
  17868. SERVICE: this.service,
  17869. VERSION: this.version,
  17870. REQUEST: "QueryFeature",
  17871. FORMAT: this.format,
  17872. CALLBACK: this.callback,
  17873. OBSOBJSETNAME: a.obsobjsetname
  17874. };
  17875. a.externalid && (d.EXTERNALID = a.externalid);
  17876. a.bbox && (d.BBOX = a.bbox);
  17877. a.geometry && (d.GEOMETRY = a.geometry);
  17878. typeof a.startposition != "undefined" && (d.STARTPOSITION = a.startposition);
  17879. typeof a.maxcount != "undefined" && (d.MAXCOUNT = a.maxcount);
  17880. var e = this;
  17881. GeoGlobe.Request.GET({
  17882. url: this.url,
  17883. params: d,
  17884. scope: this,
  17885. async: this.async,
  17886. success: function(a) {
  17887. var d = {};
  17888. try {
  17889. d = JSON.parse(a.responseText)
  17890. } catch (h) {
  17891. console.error("RTDS QueryFeature Error : " +
  17892. a.responseText);
  17893. c(a.responseText);
  17894. return
  17895. }
  17896. b(d, e)
  17897. },
  17898. failure: c
  17899. });
  17900. return this
  17901. },
  17902. getObservation: function(a, b, c) {
  17903. var d = {
  17904. SERVICE: this.service,
  17905. VERSION: this.version,
  17906. REQUEST: "GetObservation",
  17907. FORMAT: this.format,
  17908. CALLBACK: this.callback,
  17909. DATASETNAME: a.datasetname
  17910. };
  17911. a.externalid && (d.EXTERNALID = a.externalid);
  17912. a.observationproperty && (d.OBSERVATIONPROPERTY = a.observationproperty);
  17913. a.bbox && (d.BBOX = a.bbox);
  17914. a.geometry && (d.GEOMETRY = a.geometry);
  17915. typeof a.startposition != "undefined" && (d.STARTPOSITION = a.startposition);
  17916. typeof a.maxcount !=
  17917. "undefined" && (d.MAXCOUNT = a.maxcount);
  17918. var e = this;
  17919. GeoGlobe.Request.GET({
  17920. url: this.url,
  17921. params: d,
  17922. scope: this,
  17923. async: this.async,
  17924. success: function(a) {
  17925. var d = {};
  17926. try {
  17927. d = JSON.parse(a.responseText)
  17928. } catch (h) {
  17929. console.error("RTDS GetObservation Error : " + a.responseText);
  17930. c(a.responseText);
  17931. return
  17932. }
  17933. b(d, e)
  17934. },
  17935. failure: c
  17936. });
  17937. return this
  17938. },
  17939. getObservationByCursor: function(a, b, c) {
  17940. var d = {
  17941. SERVICE: this.service,
  17942. VERSION: this.version,
  17943. REQUEST: "GetObservation",
  17944. FORMAT: this.format,
  17945. CALLBACK: this.callback,
  17946. DATASETNAME: a.datasetname
  17947. };
  17948. a.externalid &&
  17949. (d.EXTERNALID = a.externalid);
  17950. a.observationproperty && (d.OBSERVATIONPROPERTY = a.observationproperty);
  17951. a.bbox && (d.BBOX = a.bbox);
  17952. a.geometry && (d.GEOMETRY = a.geometry);
  17953. if (typeof a.maxcount == "undefined") console.error("RTDS GetObservationByCursor\u4e2dmaxcount\u4e3a\u5fc5\u987b\u53c2\u6570\uff01");
  17954. else {
  17955. d.MAXCOUNT = a.maxcount;
  17956. var e = d.SCROLLID = "GETSCROLL",
  17957. f = !1,
  17958. g = this,
  17959. h = function() {
  17960. GeoGlobe.Request.GET({
  17961. url: g.url,
  17962. params: d,
  17963. scope: g,
  17964. async: g.async,
  17965. success: function(a) {
  17966. var h = {};
  17967. try {
  17968. h = JSON.parse(a.responseText)
  17969. } catch (m) {
  17970. console.error("RTDS GetObservation Error : " +
  17971. a.responseText);
  17972. f = !0;
  17973. c(a.responseText);
  17974. return
  17975. }
  17976. d.SCROLLID == e && !h.scrollId ? (console.error("RTDS GetObservationByCursor \u83b7\u53d6\u6e38\u6807\u5931\u8d25\uff01"), f = !0) : (h.features.length == 0 && (f = !0), d.SCROLLID = h.scrollId, b(h, g))
  17977. },
  17978. failure: c
  17979. })
  17980. };
  17981. h();
  17982. return {
  17983. next: function() {
  17984. var a = this;
  17985. f || (d.SCROLLID == e ? setTimeout(function() {
  17986. a.next()
  17987. }, 300) : h());
  17988. return !f
  17989. }
  17990. }
  17991. }
  17992. },
  17993. getObservationHistory: function(a, b, c) {
  17994. var d = {
  17995. SERVICE: this.service,
  17996. VERSION: this.version,
  17997. REQUEST: "GetObservationHistory",
  17998. FORMAT: this.format,
  17999. CALLBACK: this.callback,
  18000. DATASETNAME: a.datasetname,
  18001. EXTERNALID: a.externalid,
  18002. STARTTIME: a.starttime,
  18003. ENDTIME: a.endtime
  18004. };
  18005. a.observationproperty && (d.OBSERVATIONPROPERTY = a.observationproperty);
  18006. typeof a.samplemethod != "undefined" && (d.SAMPLEMETHOD = a.samplemethod);
  18007. typeof a.samplecount != "undefined" && (d.SAMPLECOUNT = a.samplecount);
  18008. var e = this;
  18009. GeoGlobe.Request.GET({
  18010. url: this.url,
  18011. params: d,
  18012. scope: this,
  18013. async: this.async,
  18014. success: function(a) {
  18015. var d = {};
  18016. try {
  18017. d = JSON.parse(a.responseText)
  18018. } catch (h) {
  18019. console.error("RTDS GetObservationHistory Error : " + a.responseText);
  18020. c(a.responseText);
  18021. return
  18022. }
  18023. b(d, e)
  18024. },
  18025. failure: c
  18026. });
  18027. return this
  18028. },
  18029. featureAggs: function(a, b, c) {
  18030. var d = {
  18031. SERVICE: this.service,
  18032. VERSION: this.version,
  18033. REQUEST: "FeatureAggs",
  18034. FORMAT: this.format,
  18035. CALLBACK: this.callback,
  18036. DATASETNAME: a.datasetname,
  18037. STARTTIME: a.starttime,
  18038. ENDTIME: a.endtime
  18039. };
  18040. typeof a.precision != "undefined" && (d.PRECISION = a.precision);
  18041. a.aggtype && (d.AGGTYPE = a.aggtype);
  18042. a.groupbypro && (d.GROUPBYPRO = a.groupbypro);
  18043. a.statisticspro && (d.STATISTICSPRO = a.statisticspro);
  18044. a.profilter && (d.PROFILTER = a.profilter);
  18045. a.bbox && (d.BBOX =
  18046. a.bbox);
  18047. var e = this;
  18048. GeoGlobe.Request.GET({
  18049. url: this.url,
  18050. params: d,
  18051. scope: this,
  18052. async: this.async,
  18053. success: function(a) {
  18054. var d = {};
  18055. try {
  18056. d = JSON.parse(a.responseText)
  18057. } catch (h) {
  18058. console.error("RTDS FeatureAggs Error : " + a.responseText);
  18059. c(a.responseText);
  18060. return
  18061. }
  18062. b(d, e)
  18063. },
  18064. failure: c
  18065. });
  18066. return this
  18067. },
  18068. CLASS_NAME: "GeoGlobe.Service.RTDS"
  18069. });
  18070. GeoGlobe.Service.DSS = GeoGlobe.Class4OL(GeoGlobe.Service, {
  18071. initialize: function(a, b) {
  18072. GeoGlobe.Service.prototype.initialize.apply(this, [b, a])
  18073. },
  18074. getCapabilities: function(a, b) {
  18075. return this._commit({
  18076. method: "GET",
  18077. params: {
  18078. REQUEST: "GetCapabilities"
  18079. }
  18080. }, a, b)
  18081. },
  18082. describeFeatureType: function(a, b, c) {
  18083. return this._commit({
  18084. method: "GET",
  18085. params: {
  18086. REQUEST: "DescribeFeatureType",
  18087. DATASETNAME: a,
  18088. FORMAT: "json"
  18089. }
  18090. }, b, c)
  18091. },
  18092. getFeature: function(a, b, c) {
  18093. a instanceof GeoGlobe.DSS.Query && (a = [a]);
  18094. a = a.map(function(a) {
  18095. return a.serialize()
  18096. });
  18097. a =
  18098. "[" + a.join(",") + "]";
  18099. return this._commit({
  18100. data: ["SERVICE=DSS&VERSION=1.0.0&REQUEST=GetFeature", "QUERIES=" + a].join("&")
  18101. }, b, c)
  18102. },
  18103. analysisFeature: function(a, b, c) {
  18104. return this._commit({
  18105. data: "SERVICE=DSS&VERSION=1.0.0&REQUEST=AnalysisFeature&" + a.serialize()
  18106. }, b, c)
  18107. },
  18108. _commit: function(a, b, c) {
  18109. var d = a.method || "POST",
  18110. e = GeoGlobe.Util.extend(a.params, {
  18111. SERVICE: "DSS",
  18112. VERSION: "1.0.0"
  18113. }),
  18114. a = a.data,
  18115. f = {};
  18116. d === "POST" && a && (f = GeoGlobe.Util.extend(f, {
  18117. "Content-Type": "application/x-www-form-urlencoded"
  18118. }));
  18119. return GeoGlobe.Request.issue({
  18120. method: d,
  18121. url: this.url,
  18122. params: e,
  18123. data: a,
  18124. headers: f,
  18125. success: function(a) {
  18126. a = a.responseText;
  18127. try {
  18128. var d = (new GeoGlobe.Format.JSON).read(a);
  18129. typeof d === "object" && "error" in d ? c(d.error) : b && b(d)
  18130. } catch (e) {
  18131. c && c(e)
  18132. }
  18133. },
  18134. failure: function(a) {
  18135. c && c(a)
  18136. }
  18137. })
  18138. },
  18139. CLASS_NAME: "GeoGlobe.Service.DSS"
  18140. });
  18141. GeoGlobe.DSS.Query = GeoGlobe.Class4OL(GeoGlobe.Serializable, {
  18142. DATASETNAME: null,
  18143. FILTER: null,
  18144. SORTBY: null,
  18145. STARTINDEX: null,
  18146. COUNT: null,
  18147. SCROLLID: null,
  18148. PROPERTYNAME: null,
  18149. initialize: function(a) {
  18150. GeoGlobe.Util.extend(this, GeoGlobe.Util.pick(a, ["DATASETNAME", "FILTER", "SORTBY", "STARTINDEX", "COUNT", "SCROLLID", "PROPERTYNAME"], !0))
  18151. },
  18152. serialize: function() {
  18153. var a = GeoGlobe.Util.pick(this, ["DATASETNAME", "FILTER", "SORTBY", "STARTINDEX", "COUNT", "SCROLLID", "PROPERTYNAME"]),
  18154. b;
  18155. for (b in a) {
  18156. var c = a[b];
  18157. c === null ? delete a[b] : c instanceof
  18158. GeoGlobe.Serializable && (a[b] = c.serialize())
  18159. }
  18160. return (new GeoGlobe.Format.JSON).write(a)
  18161. },
  18162. CLASS_NAME: "GeoGlobe.DSS.Query"
  18163. });
  18164. GeoGlobe.DSS.Analysis = GeoGlobe.Class4OL(GeoGlobe.Serializable, {
  18165. DATASETNAME: null,
  18166. FILTER: null,
  18167. GROUPBY: null,
  18168. SORTBY: null,
  18169. AGGREGATIONS: null,
  18170. PRECISION: null,
  18171. SPATIALPROPERTYNAME: null,
  18172. initialize: function(a) {
  18173. GeoGlobe.Util.extend(this, GeoGlobe.Util.pick(a, ["DATASETNAME", "FILTER", "GROUPBY", "SORTBY", "AGGREGATIONS", "PRECISION", "SPATIALPROPERTYNAME"], !0))
  18174. },
  18175. serialize: function() {
  18176. var a = GeoGlobe.Util.pick(this, ["DATASETNAME", "FILTER", "GROUPBY", "SORTBY", "AGGREGATIONS", "PRECISION", "SPATIALPROPERTYNAME"]),
  18177. b = [],
  18178. c;
  18179. for (c in a) {
  18180. var d =
  18181. a[c];
  18182. d === null ? delete a[c] : (d instanceof GeoGlobe.Serializable && (d = d.serialize()), b.push(c + "=" + d))
  18183. }
  18184. return b.join("&")
  18185. },
  18186. CLASS_NAME: "GeoGlobe.DSS.Analysis"
  18187. });
  18188. GeoGlobe.DSS.Filter = GeoGlobe.Class4OL(GeoGlobe.Serializable, {
  18189. initialize: function(a) {
  18190. GeoGlobe.Util.extend(this, a)
  18191. },
  18192. CLASS_NAME: "GeoGlobe.DSS.Filter"
  18193. });
  18194. GeoGlobe.DSS.Filter.Comparison = GeoGlobe.Class4OL(GeoGlobe.DSS.Filter, {
  18195. type: null,
  18196. property: null,
  18197. value: null,
  18198. initialize: function(a) {
  18199. this.type = GeoGlobe.DSS.Filter.Comparison.LIKE;
  18200. GeoGlobe.DSS.Filter.prototype.initialize.apply(this, [a])
  18201. },
  18202. serialize: function() {
  18203. var a = this.property;
  18204. a.indexOf(".") !== -1 && (a = "nested(" + a + ")");
  18205. var b = this.value;
  18206. GeoGlobe.Util.getType(b) !== "number" && (b = "'" + String(b) + "'");
  18207. return a + " " + this.type + " " + b
  18208. },
  18209. CLASS_NAME: "GeoGlobe.DSS.Filter.Comparison"
  18210. });
  18211. GeoGlobe.DSS.Filter.Comparison.EQUAL_TO = "=";
  18212. GeoGlobe.DSS.Filter.Comparison.LESS_THAN = "<";
  18213. GeoGlobe.DSS.Filter.Comparison.GREATER_THAN = ">";
  18214. GeoGlobe.DSS.Filter.Comparison.LESS_THAN_OR_EQUAL_TO = "<=";
  18215. GeoGlobe.DSS.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";
  18216. GeoGlobe.DSS.Filter.Comparison.LIKE = "like";
  18217. GeoGlobe.DSS.Filter.Spatial = GeoGlobe.Class4OL(GeoGlobe.DSS.Filter, {
  18218. type: null,
  18219. property: null,
  18220. value: null,
  18221. distance: null,
  18222. distanceUnits: "km",
  18223. serialize: function() {
  18224. var a = this.value;
  18225. a && a.toGeometry ? a = new GeoGlobe.Feature(a.toGeometry()) : a && a.getBounds && (a = new GeoGlobe.Feature(a));
  18226. a = this.serializes[this.type].call(this, a);
  18227. return this.type + "(" + this.property + "," + a + ")"
  18228. },
  18229. serializes: {
  18230. GEO_BOUNDING_BOX: function(a) {
  18231. a = a.geometry.getBounds().toBBOX().split(",");
  18232. return [a[0], a[3], a[1], a[2]].join(",")
  18233. },
  18234. GEO_POLYGON: function(a) {
  18235. return a.geometry.getVertices().map(function(a) {
  18236. return a.x +
  18237. "," + a.y
  18238. }).join(",")
  18239. },
  18240. GEO_INTERSECTS: function(a) {
  18241. return "'" + a.geometry.toString() + "'"
  18242. },
  18243. GEO_DISTANCE: function(a) {
  18244. a = a.geometry.getBounds().getCenter();
  18245. return ["'" + this.distance + this.distanceUnits + "'", a.lng, a.lat].join(",")
  18246. }
  18247. },
  18248. CLASS_NAME: "GeoGlobe.DSS.Filter.Spatial"
  18249. });
  18250. GeoGlobe.DSS.Filter.Spatial.GEO_BOUNDING_BOX = "GEO_BOUNDING_BOX";
  18251. GeoGlobe.DSS.Filter.Spatial.GEO_POLYGON = "GEO_POLYGON";
  18252. GeoGlobe.DSS.Filter.Spatial.GEO_INTERSECTS = "GEO_INTERSECTS";
  18253. GeoGlobe.DSS.Filter.Spatial.GEO_DISTANCE = "GEO_DISTANCE";
  18254. GeoGlobe.DSS.Filter.Logical = GeoGlobe.Class4OL(GeoGlobe.DSS.Filter, {
  18255. type: null,
  18256. filters: null,
  18257. initialize: function(a) {
  18258. this.filters = [];
  18259. GeoGlobe.DSS.Filter.prototype.initialize.apply(this, [a])
  18260. },
  18261. serialize: function() {
  18262. return "(" + this.filters.map(function(a) {
  18263. return a.serialize()
  18264. }).join(" " + this.type + " ") + ")"
  18265. },
  18266. CLASS_NAME: "GeoGlobe.DSS.Filter.Logical"
  18267. });
  18268. GeoGlobe.DSS.Filter.Logical.AND = "and";
  18269. GeoGlobe.DSS.Filter.Logical.OR = "or";
  18270. GeoGlobe.DSS.PropertyName = GeoGlobe.Class4OL(GeoGlobe.Serializable, {
  18271. type: null,
  18272. properties: null,
  18273. initialize: function(a) {
  18274. this.type = GeoGlobe.DSS.PropertyName.INCLUDE;
  18275. this.properties = [];
  18276. GeoGlobe.Util.extend(this, a)
  18277. },
  18278. serialize: function() {
  18279. return this.type + "(" + this.properties.join(",") + ")"
  18280. }
  18281. });
  18282. GeoGlobe.DSS.PropertyName.INCLUDE = "include";
  18283. GeoGlobe.DSS.PropertyName.EXCLUDE = "exclude";
  18284. GeoGlobe.DSS.SortBy = GeoGlobe.Class4OL(GeoGlobe.Serializable, {
  18285. sorts: null,
  18286. initialize: function(a) {
  18287. this.sorts = [];
  18288. GeoGlobe.Util.extend(this, a)
  18289. },
  18290. serialize: function() {
  18291. return this.sorts.map(function(a) {
  18292. var b = a,
  18293. c = GeoGlobe.DSS.SortBy.ASC;
  18294. a && a.length && (b = a[0], a[1] && (c = a[1]));
  18295. b.indexOf(".") !== -1 && (b = "nested(" + b + ")");
  18296. return b + "/" + c
  18297. }).join(",")
  18298. },
  18299. CLASS_NAME: "GeoGlobe.DSS.SortBy"
  18300. });
  18301. GeoGlobe.DSS.SortBy.ASC = "ASC";
  18302. GeoGlobe.DSS.SortBy.DESC = "DESC";
  18303. GeoGlobe.DSS.GroupBy = GeoGlobe.Class4OL(GeoGlobe.Serializable, {
  18304. groups: null,
  18305. initialize: function(a) {
  18306. this.groups = [];
  18307. GeoGlobe.Util.extend(this, a)
  18308. },
  18309. serialize: function() {
  18310. return this.groups.map(function(a) {
  18311. a.indexOf(".") !== -1 && (a = "nested(" + a + ")");
  18312. return a
  18313. }).join(",")
  18314. },
  18315. CLASS_NAME: "GeoGlobe.DSS.GroupBy"
  18316. });
  18317. GeoGlobe.DSS.Aggregations = GeoGlobe.Class4OL(GeoGlobe.Serializable, {
  18318. aggregations: null,
  18319. initialize: function(a) {
  18320. this.aggregations = [];
  18321. GeoGlobe.Util.extend(this, a)
  18322. },
  18323. serialize: function() {
  18324. var a = this.aggregations.map(function(a) {
  18325. var c = a[0],
  18326. a = a[1];
  18327. c.indexOf(".") !== -1 && (c = "nested(" + c + ")");
  18328. return {
  18329. aggtype: a,
  18330. field: c
  18331. }
  18332. });
  18333. return (new GeoGlobe.Format.JSON).write(a)
  18334. },
  18335. CLASS_NAME: "GeoGlobe.DSS.Aggregations"
  18336. });
  18337. GeoGlobe.DSS.Aggregations.COUNT = "count";
  18338. GeoGlobe.DSS.Aggregations.SUM = "sum";
  18339. GeoGlobe.DSS.Aggregations.AVG = "avg";
  18340. GeoGlobe.DSS.Aggregations.MIN = "min";
  18341. GeoGlobe.DSS.Aggregations.MAX = "max";
  18342. GeoGlobe.Statistic = GeoGlobe.Class({
  18343. url: null,
  18344. type: "intersection",
  18345. initialize: function(a, b) {
  18346. this.url = a;
  18347. GeoGlobe.Util.extend(this, b)
  18348. },
  18349. paramUrl: function(a) {
  18350. var b = this.getParams({
  18351. request: "GetMap"
  18352. });
  18353. if (a.layers) b.LAYERS = a.layers;
  18354. if (a.format) b.FORMAT = a.format;
  18355. if (a.bbox) b.BBOX = "{bbox-epsg-3857}";
  18356. if (a.width) b.WIDTH = a.width;
  18357. if (a.height) b.HEIGHT = a.height;
  18358. if (a.interval) b.INTERVAL = a.interval;
  18359. if (a.GRADSIZE) b.GRADSIZE = a.GRADSIZE;
  18360. if (a.simplitymethod) b.SIMPLIFYMETHOD = a.simplitymethod;
  18361. if (a.intervalcolor) b.INTERVALCOLOR =
  18362. a.intervalcolor;
  18363. if (a.SIMPLIFYSIZE) b.SIMPLIFYSIZE = a.SIMPLIFYSIZE;
  18364. if (a.INTERPOLAION) b.INTERPOLATIONMETHOD = a.INTERPOLAION;
  18365. if (a.RADIUS) b.RADIUS = a.RADIUS;
  18366. a = {};
  18367. a.url = this.url;
  18368. a.param = b;
  18369. return GeoGlobe.Util.urlAppend(a.url, GeoGlobe.Util.getParameterString(a.param || {}))
  18370. },
  18371. getStatisticInfo: function(a) {
  18372. var b = this.getParams({
  18373. request: "GetStatisticalValue"
  18374. });
  18375. if (a.layers) b.LAYERNAME = a.layers;
  18376. if (a.lnglat) b.X = a.lnglat.lng, b.Y = a.lnglat.lat;
  18377. if (a.simplitymethod) b.SIMPLIFYMETHOD = a.simplitymethod;
  18378. if (a.INTERPOLATIONMETHOD) b.INTERPOLATIONMETHOD =
  18379. a.INTERPOLATIONMETHOD;
  18380. if (a.SIMPLIFYSIZE) b.SIMPLIFYSIZE = a.SIMPLIFYSIZE;
  18381. if (a.INTERPOLAION) b.INTERPOLAION = a.INTERPOLAION;
  18382. if (a.RADIUS) b.RADIUS = a.RADIUS;
  18383. a = {};
  18384. a.url = this.url;
  18385. a.param = b;
  18386. return this.getStatisticValue(GeoGlobe.Util.urlAppend(a.url, GeoGlobe.Util.getParameterString(a.param || {})))
  18387. },
  18388. getParams: function(a) {
  18389. var b = {
  18390. request: "GetMap",
  18391. service: "WMS",
  18392. version: "1.1.1"
  18393. };
  18394. GeoGlobe.Util.extend(b, a);
  18395. return b
  18396. },
  18397. getStatisticValue: function(a) {
  18398. var b = Cfg.proxyHostUrl + a;
  18399. Cfg.url = a;
  18400. var a = sendAjaxRequest(b, dataChange),
  18401. b = a.responseXML,
  18402. c = (new GeoGlobe.Util.Format.XML2JSON).read(b);
  18403. if (!b || !b.documentElement) b = a.responseText;
  18404. if (b)
  18405. if (c.FeatureCollection.featureMember) return c.FeatureCollection.featureMember;
  18406. else alert("\u670d\u52a1\u4e0d\u53ef\u7528!");
  18407. else alert("\u670d\u52a1\u4e0d\u53ef\u7528!")
  18408. },
  18409. CLASS_NAME: "GeoGlobe.Statistic"
  18410. });
  18411. GeoGlobe.Lang = {
  18412. code: null,
  18413. defaultCode: "zh-CN",
  18414. getCode: function() {
  18415. GeoGlobe.Lang.code || GeoGlobe.Lang.setCode();
  18416. return GeoGlobe.Lang.code
  18417. },
  18418. setCode: function(a) {
  18419. var b;
  18420. a || (a = GeoGlobe.BROWSER_NAME == "msie" ? navigator.userLanguage : navigator.language);
  18421. a = a.split("-");
  18422. a[0] = a[0].toLowerCase();
  18423. typeof GeoGlobe.Lang[a[0]] == "object" && (b = a[0]);
  18424. if (a[1]) {
  18425. var c = a[0] + "-" + a[1].toUpperCase();
  18426. typeof GeoGlobe.Lang[c] == "object" && (b = c)
  18427. }
  18428. if (!b) GeoGlobe.Console.warn("Failed to find GeoGlobe.Lang." + a.join("-") + " dictionary, falling back to default language"),
  18429. b = GeoGlobe.Lang.defaultCode;
  18430. GeoGlobe.Lang.code = b
  18431. },
  18432. translate: function(a, b) {
  18433. var c = GeoGlobe.Lang[GeoGlobe.Lang.getCode()];
  18434. (c = c && c[a]) || (c = a);
  18435. b && (c = GeoGlobe.String.format(c, b));
  18436. return c
  18437. }
  18438. };
  18439. GeoGlobe.i18n = GeoGlobe.Lang.translate;
  18440. GeoGlobe.Lang.en = {
  18441. unhandledRequest: "Unhandled request return ${statusText}",
  18442. end: ""
  18443. };
  18444. GeoGlobe.Lang["zh-CN"] = {
  18445. unhandledRequest: "\u672a\u5904\u7406\u7684\u8bf7\u6c42\uff0c\u8fd4\u56de\u503c\u4e3a ${statusText}",
  18446. end: ""
  18447. };
  18448. GeoGlobe.Convertor = GeoGlobe.Class4OL({
  18449. initialize: function() {},
  18450. baiduTogcj: function(a) {
  18451. var b = a[0] - 0.0065,
  18452. c = a[1] - 0.006,
  18453. a = Math.sqrt(b * b + c * c) - 2.0E-5 * Math.sin(c * 52.35987755982988),
  18454. b = Math.atan2(c, b) - 3.0E-6 * Math.cos(b * 52.35987755982988);
  18455. return [a * Math.cos(b), a * Math.sin(b)]
  18456. },
  18457. gcjTobaidu: function(a) {
  18458. var b = a[0],
  18459. c = a[1],
  18460. a = Math.sqrt(b * b + c * c) + 2.0E-5 * Math.sin(c * 52.35987755982988),
  18461. b = Math.atan2(c, b) + 3.0E-6 * Math.cos(b * 52.35987755982988);
  18462. return [a * Math.cos(b) + 0.0065, a * Math.sin(b) + 0.006]
  18463. },
  18464. outOfChina: function(a, b) {
  18465. return (a <
  18466. 72.004 || a > 137.8347) && (b < 0.8293 || b > 55.8271) ? !0 : !1
  18467. },
  18468. transformLat: function(a, b) {
  18469. var c = -100 + 2 * a + 3 * b + 0.2 * b * b + 0.1 * a * b + 0.2 * Math.sqrt(Math.abs(a));
  18470. c += (20 * Math.sin(6 * a * Math.PI) + 20 * Math.sin(2 * a * Math.PI)) * 2 / 3;
  18471. c += (20 * Math.sin(b * Math.PI) + 40 * Math.sin(b / 3 * Math.PI)) * 2 / 3;
  18472. c += (160 * Math.sin(b / 12 * Math.PI) + 320 * Math.sin(b * Math.PI / 30)) * 2 / 3;
  18473. return c
  18474. },
  18475. transformLon: function(a, b) {
  18476. var c = 300 + a + 2 * b + 0.1 * a * a + 0.1 * a * b + 0.1 * Math.sqrt(Math.abs(a));
  18477. c += (20 * Math.sin(6 * a * Math.PI) + 20 * Math.sin(2 * a * Math.PI)) * 2 / 3;
  18478. c += (20 * Math.sin(a * Math.PI) + 40 *
  18479. Math.sin(a / 3 * Math.PI)) * 2 / 3;
  18480. c += (150 * Math.sin(a / 12 * Math.PI) + 300 * Math.sin(a / 30 * Math.PI)) * 2 / 3;
  18481. return c
  18482. },
  18483. wgs2gcj: function(a) {
  18484. var b = a[0],
  18485. c = a[1];
  18486. if (this.outOfChina(b, c)) return console.warn("\u5750\u6807\u5728\u4e2d\u56fd\u4ee5\u5916\uff0c\u65e0\u9700\u505a\u504f\u79fb\u5904\u7406!"), a;
  18487. var a = this.transformLat(b - 105, c - 35),
  18488. d = this.transformLon(b - 105, c - 35),
  18489. e = c / 180 * Math.PI,
  18490. f = Math.sin(e),
  18491. f = 1 - 0.006693421622965943 * f * f,
  18492. g = Math.sqrt(f),
  18493. a = a * 180 / (6335552.717000426 / (f * g) * Math.PI),
  18494. d = d * 180 / (6378245 / g * Math.cos(e) * Math.PI);
  18495. return [b + d, c + a]
  18496. },
  18497. delta: function(a, b) {
  18498. var c = this.transformLat(a - 105, b - 35),
  18499. d = this.transformLon(a - 105, b - 35),
  18500. e = b / 180 * Math.PI,
  18501. f = Math.sin(e),
  18502. f = 1 - 0.006693421622965943 * f * f,
  18503. g = Math.sqrt(f),
  18504. c = c * 180 / (6335552.717000426 / (f * g) * Math.PI),
  18505. d = d * 180 / (6378245 / g * Math.cos(e) * Math.PI);
  18506. return [d, c]
  18507. },
  18508. gcj2wgs: function(a) {
  18509. var b = this.delta(a[0], a[1]);
  18510. return [a[0] - b[0], a[1] - b[1]]
  18511. },
  18512. convertor: function(a, b) {
  18513. if (!a || !b) return null;
  18514. var c = b[0] + b[1] * Math.abs(a.x),
  18515. d = Math.abs(a.y) / b[9],
  18516. d = b[2] + b[3] * d + b[4] * d * d + b[5] * d * d * d + b[6] * d * d * d * d + b[7] * d *
  18517. d * d * d * d + b[8] * d * d * d * d * d * d;
  18518. c *= a.x < 0 ? -1 : 1;
  18519. d *= a.y < 0 ? -1 : 1;
  18520. return [c, d]
  18521. },
  18522. baiduMercatorTobaiduBL: function(a) {
  18523. for (var b = [1.289059486E7, 8362377.87, 5591021, 3481989.83, 1678043.12, 0], c = [
  18524. [1.410526172116255E-8, 8.98305509648872E-6, -1.9939833816331, 200.9824383106796, -187.2403703815547, 91.6087516669843, -23.38765649603339, 2.57121317296198, -0.03801003308653, 1.73379812E7],
  18525. [-7.435856389565537E-9, 8.983055097726239E-6, -0.78625201886289, 96.32687599759846, -1.85204757529826, -59.36935905485877, 47.40033549296737, -16.50741931063887,
  18526. 2.28786674699375, 1.026014486E7
  18527. ],
  18528. [-3.030883460898826E-8, 8.98305509983578E-6, 0.30071316287616, 59.74293618442277, 7.357984074871, -25.38371002664745, 13.45380521110908, -3.29883767235584, 0.32710905363475, 6856817.37],
  18529. [-1.981981304930552E-8, 8.983055099779535E-6, 0.03278182852591, 40.31678527705744, 0.65659298677277, -4.44255534477492, 0.85341911805263, 0.12923347998204, -0.04625736007561, 4482777.06],
  18530. [3.09191371068437E-9, 8.983055096812155E-6, 6.995724062E-5, 23.10934304144901, -2.3663490511E-4, -0.6321817810242, -0.00663494467273,
  18531. 0.03430082397953, -0.00466043876332, 2555164.4
  18532. ],
  18533. [2.890871144776878E-9, 8.983055095805407E-6, -3.068298E-8, 7.47137025468032, -3.53937994E-6, -0.02145144861037, -1.234426596E-5, 1.0322952773E-4, -3.23890364E-6, 826088.5]
  18534. ], d = {
  18535. x: Math.abs(a[0]),
  18536. y: Math.abs(a[1])
  18537. }, e, f = 0, g = b.length; f < g; f++)
  18538. if (d.y >= b[f]) {
  18539. e = c[f];
  18540. break
  18541. }
  18542. return this.convertor({
  18543. x: a[0],
  18544. y: a[1]
  18545. }, e)
  18546. },
  18547. getRange: function(a, b, c) {
  18548. b != null && (a = Math.max(a, b));
  18549. c != null && (a = Math.min(a, c));
  18550. return a
  18551. },
  18552. getLoop: function(a, b, c) {
  18553. for (; a > c;) a -= c - b;
  18554. for (; a < b;) a += c - b;
  18555. return a
  18556. },
  18557. baiduBLTobaiduMercator: function(a) {
  18558. var b = [75, 60, 45, 30, 15, 0],
  18559. c = [
  18560. [-0.0015702102444, 111320.7020616939, 1704480524535203, -10338987376042340, 26112667856603880, -35149669176653700, 26595700718403920, -10725012454188240, 1800819912950474, 82.5],
  18561. [8.277824516172526E-4, 111320.7020463578, 6.477955746671607E8, -4.082003173641316E9, 1.077490566351142E10, -1.517187553151559E10, 1.205306533862167E10, -5.124939663577472E9, 9.133119359512032E8, 67.5],
  18562. [0.00337398766765, 111320.7020202162, 4481351.045890365, -2.339375119931662E7, 7.968221547186455E7, -1.159649932797253E8, 9.723671115602145E7, -4.366194633752821E7, 8477230.501135234, 52.5],
  18563. [0.00220636496208, 111320.7020209128, 51751.86112841131, 3796837.749470245, 992013.7397791013, -1221952.21711287, 1340652.697009075, -620943.6990984312, 144416.9293806241, 37.5],
  18564. [-3.441963504368392E-4, 111320.7020576856, 278.2353980772752, 2485758.690035394, 6070.750963243378, 54821.18345352118, 9540.606633304236, -2710.55326746645, 1405.483844121726, 22.5],
  18565. [-3.218135878613132E-4, 111320.7020701615, 0.00369383431289, 823725.6402795718, 0.46104986909093, 2351.343141331292, 1.58060784298199,
  18566. 8.77738589078284, 0.37238884252424, 7.45
  18567. ]
  18568. ],
  18569. a = {
  18570. x: a[0],
  18571. y: a[1]
  18572. },
  18573. d, e, f;
  18574. a.x = this.getLoop(a.x, -180, 180);
  18575. a.y = this.getRange(a.y, -74, 74);
  18576. e = 0;
  18577. for (f = b.length; e < f; e++)
  18578. if (a.y >= b[e]) {
  18579. d = c[e];
  18580. break
  18581. }
  18582. if (!d)
  18583. for (e = b.length - 1; e >= 0; e--)
  18584. if (a.y <= -b[e]) {
  18585. d = c[e];
  18586. break
  18587. }
  18588. return this.convertor(a, d)
  18589. },
  18590. wgsBL2wgsMercator: function(a) {
  18591. var b = a[0] * 2.003750834E7 / 180,
  18592. a = Math.log(Math.tan((90 + a[1]) * Math.PI / 360)) / (Math.PI / 180);
  18593. return [b, a * 2.003750834E7 / 180]
  18594. },
  18595. wgsMercator2wgsBL: function(a) {
  18596. var b = a[0] / 2.003750834E7 * 180,
  18597. a = a[1] / 2.003750834E7 * 180,
  18598. a =
  18599. 180 / Math.PI * (2 * Math.atan(Math.exp(a * Math.PI / 180)) - Math.PI / 2);
  18600. return [b, a]
  18601. },
  18602. translate: function(a, b, c) {
  18603. for (var d = 0; d < a.length; d++)
  18604. if (typeof a[d][0] === "string" || typeof a[d][1] === "string") {
  18605. console.error("string\u7c7b\u578b\u5750\u6807\u4e0d\u88ab\u652f\u6301\uff0c\u8bf7\u4f7f\u7528Number\u7c7b\u578b");
  18606. break
  18607. }
  18608. var e = [];
  18609. switch (b + "-" + c) {
  18610. case "1-2":
  18611. for (d = 0; d < a.length; d++) b = this.wgsBL2wgsMercator(a[d]), e.push(b);
  18612. break;
  18613. case "1-3":
  18614. for (d = 0; d < a.length; d++) b = this.wgs2gcj(a[d]), e.push(b);
  18615. break;
  18616. case "1-4":
  18617. for (d = 0; d <
  18618. a.length; d++) b = this.wgs2gcj(a[d]), b = this.gcjTobaidu(b), e.push(b);
  18619. break;
  18620. case "1-5":
  18621. for (d = 0; d < a.length; d++) b = this.wgs2gcj(a[d]), b = this.gcjTobaidu(b), b = this.baiduBLTobaiduMercator(b), e.push(b);
  18622. break;
  18623. case "2-1":
  18624. for (d = 0; d < a.length; d++) b = this.wgsMercator2wgsBL(a[d]), e.push(b);
  18625. break;
  18626. case "2-3":
  18627. for (d = 0; d < a.length; d++) b = this.wgsMercator2wgsBL(a[d]), b = this.wgs2gcj(b), e.push(b);
  18628. break;
  18629. case "2-4":
  18630. for (d = 0; d < a.length; d++) b = this.wgsMercator2wgsBL(a[d]), b = this.wgs2gcj(b), b = this.gcjTobaidu(b), e.push(b);
  18631. break;
  18632. case "2-5":
  18633. for (d =
  18634. 0; d < a.length; d++) b = this.wgsMercator2wgsBL(a[d]), b = this.wgs2gcj(b), b = this.gcjTobaidu(b), b = this.baiduBLTobaiduMercator(b), e.push(b);
  18635. break;
  18636. case "3-1":
  18637. for (d = 0; d < a.length; d++) b = this.gcj2wgs(a[d]), e.push(b);
  18638. break;
  18639. case "3-2":
  18640. for (d = 0; d < a.length; d++) b = this.gcj2wgs(a[d]), b = this.wgsBL2wgsMercator(b), e.push(b);
  18641. break;
  18642. case "3-4":
  18643. for (d = 0; d < a.length; d++) b = this.gcjTobaidu(a[d]), e.push(b);
  18644. break;
  18645. case "3-5":
  18646. for (d = 0; d < a.length; d++) b = this.gcjTobaidu(a[d]), b = this.baiduBLTobaiduMercator(b), e.push(b);
  18647. break;
  18648. case "4-1":
  18649. for (d =
  18650. 0; d < a.length; d++) b = this.baiduTogcj(a[d]), b = this.gcj2wgs(b), e.push(b);
  18651. break;
  18652. case "4-2":
  18653. for (d = 0; d < a.length; d++) b = this.baiduTogcj(a[d]), b = this.gcj2wgs(b), b = this.wgsBL2wgsMercator(b), e.push(b);
  18654. break;
  18655. case "4-3":
  18656. for (d = 0; d < a.length; d++) b = this.baiduTogcj(a[d]), e.push(b);
  18657. break;
  18658. case "4-5":
  18659. for (d = 0; d < a.length; d++) b = this.baiduBLTobaiduMercator(a[d]), e.push(b);
  18660. break;
  18661. case "5-1":
  18662. for (d = 0; d < a.length; d++) b = this.baiduMercatorTobaiduBL(a[d]), b = this.baiduTogcj(b), b = this.gcj2wgs(b), e.push(b);
  18663. break;
  18664. case "5-2":
  18665. for (d = 0; d <
  18666. a.length; d++) b = this.baiduMercatorTobaiduBL(a[d]), b = this.baiduTogcj(b), b = this.gcj2wgs(b), b = this.wgsBL2wgsMercator(b), e.push(b);
  18667. break;
  18668. case "5-3":
  18669. for (d = 0; d < a.length; d++) b = this.baiduMercatorTobaiduBL(a[d]), b = this.baiduTogcj(b), e.push(b);
  18670. break;
  18671. case "5-4":
  18672. for (d = 0; d < a.length; d++) b = this.baiduMercatorTobaiduBL(a[d]), e.push(b);
  18673. break;
  18674. default:
  18675. console.warn("from " + b + "\u6216to " + c + "\u4e0d\u5728\u89c4\u5b9a\u7684\u7f16\u53f7\u5185\uff01")
  18676. }
  18677. return e
  18678. },
  18679. CLASS_NAME: "GeoGlobe.Convertor"
  18680. });
  18681. GeoGlobe.Widget.Base = GeoGlobe.Class4OL({
  18682. map: null,
  18683. container: null,
  18684. options: null,
  18685. positon: null,
  18686. initialize: function(a, b) {
  18687. this.container = document.getElementById(a) || a;
  18688. if (!(this.container instanceof HTMLElement)) this.container = document.createElement("div");
  18689. this.container.parentElement && this.container.parentElement.removeChild(this.container);
  18690. this.options = b || {}
  18691. },
  18692. render: function() {},
  18693. updatePosition: function(a) {
  18694. if (a)
  18695. for (var b in GeoGlobe.Util.applyDefaults(a, {
  18696. left: "",
  18697. right: "",
  18698. top: "",
  18699. bottom: ""
  18700. }), this.positon =
  18701. GeoGlobe.Util.pick(a, ["left", "right", "top", "bottom"]), this.container.style.position = "absolute", this.positon) a = this.positon[b], a !== "" && typeof a === "number" && (a += "px"), this.container.style[b] = a
  18702. },
  18703. onAdd: function(a, b) {
  18704. if (!this.map && a) this.map = a, a.getContainer().appendChild(this.container), this.render(), this.updatePosition(b)
  18705. },
  18706. onRemove: function() {
  18707. if (this.map) map.getContainer().removeChild(this.container), this.map = null
  18708. },
  18709. CLASS_NAME: "GeoGlobe.Widget.Base"
  18710. });
  18711. GeoGlobe.Widget.Html = GeoGlobe.Class4OL(GeoGlobe.Widget.Base, {
  18712. options: null,
  18713. render: function() {
  18714. this.container.innerHTML = this.options
  18715. },
  18716. CLASS_NAME: "GeoGlobe.Widget.Html"
  18717. });
  18718. GeoGlobe.Widget.MapSwitch = GeoGlobe.Class4OL(GeoGlobe.Widget.Base, {
  18719. options: null,
  18720. baseMaps: null,
  18721. render: function() {
  18722. var a = this,
  18723. b = [{
  18724. layers: [new GeoGlobe.TDTLayer("vec_c"), new GeoGlobe.TDTLayer("cva_c")],
  18725. icon: "./\u5929\u5730\u56fe\u77e2\u91cf.png",
  18726. text: "\u5929\u5730\u56fe\u77e2\u91cf"
  18727. }, {
  18728. layers: [new GeoGlobe.TDTLayer("img_c"), new GeoGlobe.TDTLayer("cia_c")],
  18729. icon: "./\u5929\u5730\u56fe\u5f71\u50cf.png",
  18730. text: "\u5929\u5730\u56fe\u5f71\u50cf"
  18731. }],
  18732. c = this.baseMaps = function(a) {
  18733. for (var b in a) return !1;
  18734. return !0
  18735. }(this.options) ?
  18736. b : this.options,
  18737. d = document.createElement("div");
  18738. d.id = "mapType";
  18739. d.style.width = (c.length - 1) * 5 + 106 + "px";
  18740. for (b = 0; b < c.length; b++) {
  18741. var e = document.createElement("div");
  18742. e.classList.add("mapTypeCard");
  18743. e.style.right = 10 + b * 5 + "px";
  18744. e.style.zIndex = c.length + 1 - b;
  18745. e.setAttribute("layerIndex", b);
  18746. e.style.backgroundImage = "url(" + c[b].icon + ")";
  18747. if (b == 0) {
  18748. var f = e;
  18749. a.initMap().then(function() {
  18750. for (var b = c[0].layers, d = 0; d < b.length; d++) a.map.addLayer(b[d]);
  18751. f.classList.add("active")
  18752. })
  18753. }
  18754. e.onclick = function() {
  18755. var b = this;
  18756. this.parentNode.prepend(this);
  18757. for (var d = this.parentNode.children, e = 0; e < d.length; e++) d[e].classList.remove("active"), d[e].style.right = 10 + e * 5 + "px", d[e].style.zIndex = d.length + 1 - e;
  18758. this.classList.add("active");
  18759. a.initMap().then(function() {
  18760. for (var d = b.getAttribute("layerIndex"), d = c[d].layers, e = 0; e < d.length; e++) a.map.addLayer(d[e])
  18761. })
  18762. };
  18763. var g = document.createElement("span");
  18764. g.innerHTML = c[b].text;
  18765. e.appendChild(g);
  18766. d.appendChild(e)
  18767. }
  18768. d.onmouseover = function() {
  18769. d.style.width = (c.length + 1) * 10 + c.length * 86 + "px";
  18770. d.classList.add("expand");
  18771. for (var a = d.children,
  18772. b = 0; b < a.length; b++) a[b].style.right = b * 96 + 10 + "px"
  18773. };
  18774. d.onmouseout = function() {
  18775. d.style.width = (c.length - 1) * 5 + 106 + "px";
  18776. d.classList.remove("expand");
  18777. for (var a = d.children, b = 0; b < a.length; b++) a[b].style.right = b * 5 + 10 + "px"
  18778. };
  18779. this.container.appendChild(d)
  18780. },
  18781. initMap: function() {
  18782. var a = this.map;
  18783. return new Promise(function(b) {
  18784. var c = setInterval(function() {
  18785. if (a.loaded()) {
  18786. for (var d = a.getStyle().layers, e = 0; e < d.length; e++) d[e].type === "raster" && (this.map.removeLayer(d[e].id), this.map.removeSource(d[e].source));
  18787. clearInterval(c);
  18788. b("ok")
  18789. }
  18790. }, 100)
  18791. })
  18792. },
  18793. createStyle: function() {
  18794. var a = document.createElement("style");
  18795. a.setAttribute("type", "text/css");
  18796. if (a.styleSheet) a.styleSheet.cssText = "#mapType {height: 80px;/* width: 110px; */cursor: pointer;-webkit-transition-property: width, background-color;transition-property: width, background-color;-webkit-transition-duration: 0.4s;transition-duration: 0.4s;background-color: rgba(255, 255, 255, 0);}#mapType.expand {background-color: #fff;background-color: rgba(255, 255, 255, 0.8);}.mapTypeCard {height: 60px;width: 86px;position: absolute;border-radius: 2px;top: 10px;box-sizing: border-box;border: 1px solid transparent;border: 1px solid rgba(153, 153, 153, 0.42);background-size: cover;background-repeat: no-repeat;-webkit-transition-property: right, background-image;transition-property: right, background-image;-webkit-transition-duration: 0.4s;transition-duration: 0.4s;}#mapType .mapTypeCard.active span,#mapType .mapTypeCard:hover span {background-color: #3385ff;}.mapTypeCard span {position: absolute;bottom: 0;right: 0;display: inline-block;padding: 3px 0px 2px;font-size: 12px;height: 12px;width: 100%;text-align: center;line-height: 12px;color: #fff;border-top-left-radius: 2px;}";
  18797. else {
  18798. var b = document.createTextNode("#mapType {height: 80px;/* width: 110px; */cursor: pointer;-webkit-transition-property: width, background-color;transition-property: width, background-color;-webkit-transition-duration: 0.4s;transition-duration: 0.4s;background-color: rgba(255, 255, 255, 0);}#mapType.expand {background-color: #fff;background-color: rgba(255, 255, 255, 0.8);}.mapTypeCard {height: 60px;width: 86px;position: absolute;border-radius: 2px;top: 10px;box-sizing: border-box;border: 1px solid transparent;border: 1px solid rgba(153, 153, 153, 0.42);background-size: cover;background-repeat: no-repeat;-webkit-transition-property: right, background-image;transition-property: right, background-image;-webkit-transition-duration: 0.4s;transition-duration: 0.4s;}#mapType .mapTypeCard.active span,#mapType .mapTypeCard:hover span {background-color: #3385ff;}.mapTypeCard span {position: absolute;bottom: 0;right: 0;display: inline-block;padding: 3px 0px 2px;font-size: 12px;height: 12px;width: 100%;text-align: center;line-height: 12px;color: #fff;border-top-left-radius: 2px;}");
  18799. a.appendChild(b)
  18800. }
  18801. b = document.getElementsByTagName("head");
  18802. b.length ? b[0].appendChild(a) : document.documentElement.appendChild(a)
  18803. },
  18804. CLASS_NAME: "GeoGlobe.Widget.MapSwitch"
  18805. });
  18806. GeoGlobe.Widget.AreaLocation = GeoGlobe.Class4OL(GeoGlobe.Widget.Base, {
  18807. options: null,
  18808. render: function() {
  18809. this.opt_options = this.options;
  18810. if (this.options.data) {
  18811. if (!this.options.defaultName) this.options.defaultName = this.options.data[0].name;
  18812. var a = '<div id="area-change-btn">' + this.options.defaultName + "</div>";
  18813. a += this._appendPanel();
  18814. this.container.innerHTML = a;
  18815. this._bindEvent()
  18816. } else throw Error("\u672a\u4f20\u5165\u6570\u636e");
  18817. this._createCss()
  18818. },
  18819. _createCss: function() {
  18820. var a = this.options.direction,
  18821. b = "";
  18822. document.getElementById("area-location-panel").style.cssText =
  18823. a == "top-left" ? "left:0px;bottom: 40px;" : a == "top-right" ? "right:0px;bottom: 40px;" : a == "top-center" ? "right:-143px;bottom: 40px;" : a == "bottom-left" ? "left:0px;" : a == "bottom-center" ? "left:-143px;" : "right:0px;"
  18824. },
  18825. _appendPanel: function() {
  18826. var a = this,
  18827. b = '<div id="area-location-panel">';
  18828. b += '<div class="area-location-title"><span>\u57ce\u5e02\u5217\u8868</span><span class="close">\u00d7</span></div>';
  18829. b += '<div class="area-location-search"><input type="text" id="location-search-input"><button>\u641c\u7d22</button></div>';
  18830. b += "<dl>";
  18831. this.options.data.forEach(function(c) {
  18832. var d = a.random(10);
  18833. c.id = d;
  18834. b += "<div>";
  18835. var e, f, g = "";
  18836. c.center && (e = c.center[0], f = c.center[1]);
  18837. if (c.zoom) g = c.zoom;
  18838. b += '<dt class="area-location-parent" id=' + d + " lng=" + e + " lat=" + f + " zoom=" + g + ">" + c.name + "</dt>";
  18839. c.children && c.children.length && (b += "<dd>", c.children.forEach(function(c) {
  18840. c.pId = d;
  18841. var j = a.random(10);
  18842. c.id = j;
  18843. c.center && (e = c.center[0], f = c.center[1]);
  18844. if (c.zoom) g = c.zoom;
  18845. b += '<li class="area-location-children" id=' + j + " lng=" + e + " lat=" + f + " zoom=" + g + ">" + c.name +
  18846. "</li>"
  18847. }), b += "</dd>");
  18848. b += "</div>"
  18849. });
  18850. b += "</dl>";
  18851. b += "</div>";
  18852. return b
  18853. },
  18854. _bindEvent: function() {
  18855. var a = this;
  18856. document.body.onclick = function() {
  18857. var b = b || window.event,
  18858. b = b.target || b.srcElement;
  18859. if (b.id == "area-change-btn") {
  18860. var c = document.getElementById("area-location-panel");
  18861. c.style.display = c.style.display == "block" ? "none" : "block"
  18862. }
  18863. b.className == "area-location-parent" && a._onClick(b);
  18864. b.className == "area-location-children" && a._onClick(b);
  18865. b.className == "keywords-search-detail-li" && a._onClick(b);
  18866. if (b.className == "close") c =
  18867. document.getElementById("area-location-panel"), c.style.display = "none"
  18868. };
  18869. document.body.oninput = function() {
  18870. var b = b || window.event,
  18871. b = b.target || b.srcElement;
  18872. b.id == "location-search-input" && a._search(b)
  18873. }
  18874. },
  18875. _onClick: function(a) {
  18876. var b = a.textContent;
  18877. document.getElementById("area-change-btn").innerHTML = b;
  18878. var b = this.map,
  18879. a = this._keySearch(a.getAttribute("id"))[0],
  18880. c = {};
  18881. if (window.turf && turf && a.geometry && a.geometry.type == "Polygon") {
  18882. var d = turf.centroid({
  18883. geometry: a.geometry,
  18884. properties: {},
  18885. type: "Feature"
  18886. });
  18887. c.center = d.geometry.coordinates
  18888. }
  18889. if (a.center) c.center =
  18890. a.center;
  18891. if (a.zoom) c.zoom = a.zoom;
  18892. (c.center || c.zoom) && b.flyTo(c);
  18893. if (this.opt_options.onClick) this.opt_options.onClick(a);
  18894. b = document.getElementsByClassName("keywords-search-detail");
  18895. b.length && b[0].remove();
  18896. document.getElementById("area-location-panel").style.display = "none"
  18897. },
  18898. _search: function(a) {
  18899. var a = this._fuzzySearch(a.value),
  18900. b = document.getElementsByClassName("keywords-search-detail");
  18901. b.length && b[0].remove();
  18902. if (a.length) {
  18903. var c = "";
  18904. a.forEach(function(a, b) {
  18905. if (b < 10) {
  18906. var f, g, h = "";
  18907. a.center && (f = a.center[0],
  18908. g = a.center[1]);
  18909. if (a.zoom) h = a.zoom;
  18910. c += '<li class="keywords-search-detail-li" id=' + a.id + " lng=" + f + " lat=" + g + " zoom=" + h + ">" + a.name + "</li>"
  18911. }
  18912. });
  18913. a = document.createElement("ul");
  18914. a.classList.add("keywords-search-detail");
  18915. a.innerHTML = c;
  18916. document.getElementsByClassName("area-location-search")[0].appendChild(a)
  18917. }
  18918. },
  18919. _fuzzySearch: function(a) {
  18920. var b = [];
  18921. a && this.opt_options.data.forEach(function(c) {
  18922. c.name.indexOf(a) != -1 && b.push(c);
  18923. c.children && c.children.length && c.children.forEach(function(c) {
  18924. c.name.indexOf(a) != -1 && b.push(c)
  18925. })
  18926. });
  18927. return b
  18928. },
  18929. _keySearch: function(a) {
  18930. var b = [];
  18931. a && this.opt_options.data.forEach(function(c) {
  18932. c.id == a && b.push(c);
  18933. c.children && c.children.length && c.children.forEach(function(c) {
  18934. c.id == a && b.push(c)
  18935. })
  18936. });
  18937. return b
  18938. },
  18939. random: function(a) {
  18940. for (var b = "", c = [], d = 0; d < a; d++) c.push(String.fromCharCode(97 + Math.ceil(Math.random() * 25)));
  18941. for (d = 0; d < a; d++) b += c[d];
  18942. return b
  18943. },
  18944. CLASS_NAME: "GeoGlobe.Widget.AreaLocation"
  18945. });